Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

confirmDialog for web resource

(0) ShareShare
ReportReport
Posted on by 76

Hello.
In html web resource, in Sourse tab, there is function call <button class="button" onclick="function()"/button>

In this function(), I need to show messagedialog, with yes, no but with conditions based on fields of entity.
For example if window.parent.Xrm.Page.getAttribute("date_field").getValue() >= new Date() then show messagedialog;
If client click OK button, I must call another function, if client click cancel, nothing to do, just return.
I tried to do by confirmDialog, but it doesn't work correctly.
How can I resolve it ?

Thanks.

----

Resolved.

*This post is locked for comments

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,052 on at
    RE: confirmDialog for web resource

    Please refer to the link below to know more about the Confirm Dialog and how you can use it.

    crmtipoftheday.com/.../use-alertdialog-and-confirmdialog-to-display-messages-to-users

    ashwaniashwin.wordpress.com/.../dynamics-365-alert-and-confirm-dialog-boxes

    Since you are trying to call from a web resource, you do have to make sure you use window.parent.Xrm....

    If it does not work, check the Dev Console (F12) and see if there are any errors

  • MMK Profile Picture
    MMK 745 on at
    RE: confirmDialog for web resource

    Marina ,

    first check your values conditions then

    use this code

    if(yourconditiontrue)

    {

    window.parent.Xrm.Utility.confirmDialog("Add your message here …………………...", CallAction, noCloseCallback);

    }

    function noCloseCallback() {

       console.log("Canceled");

    //cancel function

    }

    function CallAction() {

       console.log("Canceled");

    //wrie your logic here

    }

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans