Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to set value on dropdown list by java script

Posted on by 1,771

Hi,

I have requirement, if stage change from suspect to Prospect or Forecast, based on user id system will give below warning message and the previous value (suspect) should store in stage.

but here system give message and cursor will be on Prospect or forecast.  When click on ok button again give message . It repeating and in loop.  After 6 or 7 times click on the cursor will go to Suspect. 

I noticed when set any value on dropdown list options, the dropdown list will expand as shown below and we need select by mouse to set that option.

This could be the reason for repeating message in loop.  Please help me to set value in dropdown list by using java script.

p90.png

optrtcode = Xrm.Page.getAttribute("opportunityratingcode").getValue();      - to store current value

if(Xrm.Page.getAttribute("opportunityratingcode").getValue() == '200000'  ||Xrm.Page.getAttribute("opportunityratingcode").getValue() == '3')
{

alert(" Please contact sales manager to change stage to prospect or forecast");
Xrm.Page.getAttribute("opportunityratingcode").SetValue(optrtcode);  - to store previous value after giving      message
Xrm.Page.getControl("opportunityratingcode").setFocus(true);

}

*This post is locked for comments

  • Verified answer
    P NOUSHAD Profile Picture
    P NOUSHAD 1,771 on at
    RE: How to set value on dropdown list by java script

    Hi Gopalan,

    Thanks for your help.  It is working now.

    Regards,

  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 on at
    RE: How to set value on dropdown list by java script

    Hi

    As you are updating the same field, try introducing timeout and check.

    community.dynamics.com/.../simple-javascript-form-notification-with-timeout

    community.dynamics.com/.../234280

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans