Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Warning message while opening a form

(0) ShareShare
ReportReport
Posted on by

Hi,

I have to generate a warning message while opening a form to all the users based on some conditions ( For eg: If one date is due in the vendor form, users should get warning message while they open the Vendor form )

Alert won't work in this case, I already tried it. I already tried message box option also, but I don't know where to write the code for that. 

Your help will be highly apprecuated.

Thanks

  • neethukbabu Profile Picture
    on at
    RE: Warning message while opening a form

    I wanted to show the warning in the vendor details form.

    its working now.

    thanks

  • neethukbabu Profile Picture
    on at
    RE: Warning message while opening a form

    Thanks a lot Girish.

    This is working good.

  • Mohit Rampal Profile Picture
    12,556 Moderator on at
    RE: Warning message while opening a form

    I think you are talking about two forms, VendTableListPage and VendTable form. Do you want to show all vendors which have expiry date due in VendTableListPage (Grid) form. And current vendor's warning message in VendTable (Vendor Details) form?

    Please provide screenshot so we can help. Girish has already provided code for init method and active method. Just one suggestion in the code to improve performance. In active method, you can use this.expiryDate.

    Public void init()
    {
        VendTable vendTable;
        
        while select * from vendTable
         where vendTable.ExpiryDate < today()
        {
            warning(strfmt("%1", throw warning message here));
        }
    }

  • Verified answer
    GirishS Profile Picture
    27,823 Moderator on at
    RE: Warning message while opening a form

    Your code should look like below. 

    public int active()
    {
        int ret;
        ret = super();
        if(VendTable.ExpiryDate < today())
        {
            warning(strfmt("Throw warning message"));
        }
    }

    Thanks,

    Girish S.

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Warning message while opening a form

    If you want your warning message to throw when changing the vendors in the form - You need to add your code in the active method of VendTable form Datasource.

    Thanks,

    Girish S.

  • neethukbabu Profile Picture
    on at
    RE: Warning message while opening a form

    Hi Girish,

    No. If I am using while statement, I am getting notification for all the vendors in one vendor open form itself. So I removed it. But other issue is, If any one of the vendors expiry date is due, it is throwing warning in all the vendors open page since we are not mentioning the current form vendor in the code. Can i use this.expiryDate? or any other option?

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Warning message while opening a form

    Updated the code - Please check and let us know if it meets your scenario.

    Thanks,

    Girish S.

  • neethukbabu Profile Picture
    on at
    RE: Warning message while opening a form

    Hi,

    Thanks Mohit.

    I want it for all the vendors.

    If you are providing the coding, it will be grateful as I am not familiar with the coding.

    We have added new field in the vendtable for trade License expiry date and if it expires, users should get warning message if they are opening the Vendform. This is the actual requirement.

  • GirishS Profile Picture
    27,823 Moderator on at
    RE: Warning message while opening a form

    If you want to throw warning for all the vendors while opening the form, you need to add while select statement in the init method of the form.

    Public void init()
    {
        VendTable vendTable;
        
        while select * from vendTable
        {
            //I am assuming there is date field in vendTable.
            if(vendTable.ExpiryDate < today())
            {
                info(strfmt("%1", throw warning message here));
            }
        }
    }

    Thanks,

    Girish S.

  • neethukbabu Profile Picture
    on at
    RE: Warning message while opening a form

    Hi,

    Thanks Girish.

    Users should get notifications for all the vendors who are not meeting the condition.

    If(today > date)

    {

    info("Warning message")

    }

    I want to write above code in the form init, but I am not able to get the date field there.

    Please help me, I am not much familiar with 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,209 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans