web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Show custom message box on page load (Only)

(0) ShareShare
ReportReport
Posted on by 57

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.

form1.PNGform2.PNG

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,917 Super User 2025 Season 2 on at

    Hi ElderJoe1,

    You need to find another event to execute your coding as the form was already started. I thought there is an event as well in case you change the view from list to details, but I can't check this as I currently don't have a machine running to check this.

  • ElderJoe1 Profile Picture
    57 on at

    I added some pics above. im not sure what event handler I could use at this point.

    You can see below that the attached code is displaying at the right time but i get no item id. This is because the inventTable is not initialized at the same time of the page being activated I believe.

    [FormControlEventHandler(formControlStr(EcoResProductDetailsExtended, Details), FormControlEventType::PageActivated)]
        public static void Details_OnPageActivated(FormControl sender, FormControlEventArgs e)
        {
            InventTable inventTable;
            //InventTable inventTable =sender.datasource(formDataSourceStr(EcoResProductDetailsExtended,inventTable)).cursor();
            //return element.control(element.controlId(formControlStr(EcoResProductDetailsExtended, InventTable_ItemId))).valueStr();
            Info(InventTable.ItemId);
        }

    Is there more to the code example I need to add to reach the inventTable.

    form3.PNG

    Thanks For any help you can provide

  • André Arnaud de Calavon Profile Picture
    300,917 Super User 2025 Season 2 on at

    Hi ElderJoe1,

    There is coding out commented. Have you tried enable the coding?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans