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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

JavaScript alert Based on text value

(0) ShareShare
ReportReport
Posted on by 140

function setAlert(executionContext)

{

var formContext = executionContext.getFormContext();

// Access the field on the form

var field = fieldformContext.getAttribute("new_requesturgentflag").getText();

if(field == "Yes")

{

var alertStrings = {text: "Please contact your Supervisor immediately."};

var alertOptions = { height: 120, width: 260 };

//alert("Please contact your Supervisor immediately.");

}

}

Hey guys I am trying to find the problem with this code but could not find it . Could you guys help 

requesturgentflag is an option set 

I get this error

Web resource method does not exist: setAlert(executionContext)

I have the same question (0)
  • msboy Profile Picture
    140 on at

    function setAlert(executionContext)

    {

    var formContext = executionContext.getFormContext();

    // Access the field on the form

    var field = fieldformContext.getAttribute("new_requesturgentflag").getText();

    if(field == "Yes")

    {

    var alertStrings = {text: "Please contact your Supervisor immediately."};

    var alertOptions = { height: 120, width: 260 };

    //alert("Please contact your Supervisor immediately.");

    }

    }

    Hey guys I am trying to find the problem with this code but could not find it . Could you guys help 

    requesturgentflag is an option set 

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    So what the problem is?

  • Johao Larios Profile Picture
    1,795 on at

    what's the error that you are getting?

  • msboy Profile Picture
    140 on at

    I get this error

    Web resource method does not exist: setAlert(executionContext)

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Please, don't create duplicated threads.

    Can you please provide screenshot that demonstrates how to registered that function as an event handler?

  • msboy Profile Picture
    140 on at

    It's onchange

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Screenshot, please?

  • msboy Profile Picture
    140 on at

    pastedimage1587653704010v2.png

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    In registration use setAlert, not setAlert(executionContext) also in registration check "Pass Execution Context as a first parameter" checkbox.

  • msboy Profile Picture
    140 on at

    i get Web resource method does not exist: setAlert

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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 47 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans