Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

JavaScript alert Based on text value

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)

  • msboy Profile Picture
    msboy 140 on at
    RE: JavaScript alert Based on text value

    yes

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: JavaScript alert Based on text value

    Did that change solve your issue?

  • Verified answer
    msboy Profile Picture
    msboy 140 on at
    RE: JavaScript alert Based on text value

    hey I go the solution instead of getText() used getValue()

  • msboy Profile Picture
    msboy 140 on at
    RE: JavaScript alert Based on text value

    could it be a logical error

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: JavaScript alert Based on text value

    Based on what you provided everything should work fine.

  • msboy Profile Picture
    msboy 140 on at
    RE: JavaScript alert Based on text value

    pastedimage1587657534164v1.png

    pastedimage1587657585257v2.png

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: JavaScript alert Based on text value

    Can you please provide the screenshot that demonstrates how it is registered now and full code of your webresource.

    Based on facts you provided at the moment everything should work fine.

  • msboy Profile Picture
    msboy 140 on at
    RE: JavaScript alert Based on text value

    i get Web resource method does not exist: setAlert

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: JavaScript alert Based on text value

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

  • msboy Profile Picture
    msboy 140 on at
    RE: JavaScript alert Based on text value

    pastedimage1587653704010v2.png

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans