// <summary>
/// Created by Rahul - 08/15/2017 for disabling LogisticsPostalAddress_Street control
/// </summary>
class LogisticsPostalAddress_EventHandler
{
/// <summary>
/// We are disabling LogisticsPostalAddress_Street control here
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(formStr(LogisticsPostalAddress), formMethodStr(LogisticsPostalAddress, updateControls))]
public static void LogisticsPostalAddress_Post_updateControls(XppPrePostArgs args)
{
FormRun sender = Args.getThis();
sender.control(sender.controlId(formControlStr(LogisticsPostalAddress, LogisticsPostalAddress_Street ))).allowEdit (false);
}
}
Or second way
[FormControlEventHandler(formControlStr(SalesTable, ButtonLineInventory), FormControlEventType::Clicked)]
public static void ButtonLineInventory_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormDataSource salesLine_ds = sender.formRun().dataSource("salesLine"); //DataSource form CustTable
FormRun element = sender.formRun(); //form element
FormControl buttonLineInventReservation = element.design(0).controlName("buttonLineInventReservation"); //New button on the form
buttonLineInventReservation.enabled(false);
}
Please refer below post also.
https://rahulmsdax.blogspot.com/2018/08/how-to-hide-form-control-in-ax-365.html
/// Created by Rahul - 08/15/2017 for disabling LogisticsPostalAddress_Street control
/// </summary>
class LogisticsPostalAddress_EventHandler
{
/// <summary>
/// We are disabling LogisticsPostalAddress_Street control here
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(formStr(LogisticsPostalAddress), formMethodStr(LogisticsPostalAddress, updateControls))]
public static void LogisticsPostalAddress_Post_updateControls(XppPrePostArgs args)
{
FormRun sender = Args.getThis();
sender.control(sender.controlId(formControlStr(LogisticsPostalAddress, LogisticsPostalAddress_Street ))).allowEdit (false);
}
}
Or second way
[FormControlEventHandler(formControlStr(SalesTable, ButtonLineInventory), FormControlEventType::Clicked)]
public static void ButtonLineInventory_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormDataSource salesLine_ds = sender.formRun().dataSource("salesLine"); //DataSource form CustTable
FormRun element = sender.formRun(); //form element
FormControl buttonLineInventReservation = element.design(0).controlName("buttonLineInventReservation"); //New button on the form
buttonLineInventReservation.enabled(false);
}
Please refer below post also.
https://rahulmsdax.blogspot.com/2018/08/how-to-hide-form-control-in-ax-365.html
Thanks Rahul for the post. Can you help on how to control any button on the same form. (Ex: Map button)
ReplyDeletePlease look into the below post.
Deletehttp://rahulmsdax.blogspot.com/2018/08/how-to-hide-form-control-in-ax-365.html
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. Disability niche
ReplyDelete