Hi,
Lock or Disable a text field in d365 form in X++
[FormControlEventHandler(formControlStr(PurchTable, Cdetail), FormControlEventType::GotFocus)]
public static void Cdetail_OnGotFocus(FormControl sender, FormControlEventArgs e)
{
FormControl callerStr = sender as FormControl;
FormRun form = callerStr.formRun(); /
//Disable the text field if data is already exists
FormStringControl Cdetail = form.design(0).controlName("Cdetail");
if(Cdetail.text())
{
Cdetail.allowEdit(false);
Cdetail.lock();
}
else if(!Cdetail.text())
{
Cdetail.allowEdit(true );
}
//Disable the text field if data is already exists
}
Awesome Blog !! inventory management software
ReplyDelete