Hi
I am working on a task where I need to change the behaviour of a form control- OneTime (checkbox form control) exist on LogisticsPostalAddress. My requirement is when I open this form then the OneTime control must be checked bydefault & non-editable.
For this I have write an OnIntialzed Event Handler on form to get this behaviour when form will first open.
I have write this code below:
[FormEventHandler(formStr(LogisticsPostalAddress), FormEventType::Initialized)] public static void LogisticsPostalAddress_OnInitialized(xFormRun sender, FormEventArgs e) { FormRun element = sender as FormRun; FormControl oneTimeAddress = element.design().controlName(formControlStr(LogisticsPostalAddress,OneTime)); oneTimeAddress = NoYes::Yes; // throwing type error oneTimeAddress.allowEdit(false); }
This code is working fine & make chechbox non-editable but not getting the idea how to set its value to checked as this control is not bound to any datasource & I have tried :
oneTimeAddress = NoYES::YES, but that is obviously throwing type error. then how to set its value as its a form control type.
I am using the current version D365 F&O.
Thanks & Regards,
Dinesh