I am needing to show a custom message that is assigned to a product and appears if that item id is selected. The screens I need this on is the released products screen and all purchase orders screen.
I have the message system all working and have it appearing on the sales order screen (not all sales order list screen, but the SO record screen). This message system works perfectly for the sales orders screen but i'm having issues on the two screens previously mentioned.
Below is the code I currently have to get the message to appear on page load for the released product screen.
[FormEventHandler(formStr(EcoResProductDetailsExtended), FormEventType::PostRun)]
public static void EcoResProductDetailsExtended_OnPostRun(xFormRun sender, FormEventArgs e)
{
EcoResProduct ecoResProduct =sender.dataSource(formDataSourceStr(EcoResProductDetailsExtended,EcoResProduct)).cursor();
info(ecoResProduct.DisplayProductNumber);
FormDataSource EcoResProduct_ds =sender.dataSource(formDataSourceStr(EcoResProductDetailsExtended,EcoResProduct));
MJMProductMessageCommon::displayMessage(ecoResProduct.DisplayProductNumber);
}
The same block code is currently working on the SO screen, just slightly modified to accommodate the sales lines.
The issue I currently am experiencing is that the message does not appear on the record or details screen of the selected released product. it is appearing on the released product list screen where all created released products are listed. the desired screen is reached after selecting a released product and the details screen is presented.
This appears to occur because the form for the list screen and the details screen are one in the same, EcoResProductDetailsExtended. So the form event is occurring on the first screen the user will see. On the SO screen there are two different forms being used, SalesOrderListPage and SalesTable. the form event can be defined easily on the details screen in this case.
I have been looking over the EcoResProductDetailsExtended form layout to see if i can specify this on the Details (Tab Page) using its events but I am treading in new waters here.
Any idea on how I can adapt the above block of code to my needs. The same must be done for the All Purchase orders screen.
Update:____________________________________
I am posting some images of the form showing the events that are available.

