Hi experts,
Basically, I have created a custom workflow on item arrival in Inventory Management and I will attach the screenshot below.
I have a requirement to disable few buttons like validate and Post when the workflow stage is in Draft. I have done this part by writing a code in datasource active method and it is working fine but when I click the Edit button or when the form is in edit mode the two buttons(Validate and Post) got enable. I have researched my self and I found the code below for how to add logic to edit button and here is the code:
class WMSJournalTable_Form_EventHandler
{
[FormEventHandler(formStr(WMSJournalTable), FormEventType::Initialized)]
public static void WMSJournalTable_OnInitialized(xFormRun sender, FormEventArgs e)
{
WMSJournalTable_Form_EventHandler myEventHandler = new WMSJournalTable_Form_EventHandler();
FormRun formRun = sender as FormRun;
formRun.viewEditModeHelper().EditModeSwitched += eventhandler(myEventHandler.enableButtons);
}
public void enableButtons()
{
info("Inside event handler");
}
}
When I click on edit button the info message is shown meaning the eventHandler is working fine but now how can I access the FormContols in my enableButtons() method because my requirement is to enable/disable the buttons (Validate and Post). I have also tried to pass the sender as a parameter to enableButtons but it shows some error. So, anyone have any suggestion which can help me out with this?
You any suggestion would be highly appreciated!
