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 CRM (Archived)

How to set value on dropdown list by java script

(0) ShareShare
ReportReport
Posted on by 1,821

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

I have the same question (0)
  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at

    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

  • Verified answer
    P NOUSHAD Profile Picture
    1,821 on at

    Hi Gopalan,

    Thanks for your help.  It is working now.

    Regards,

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans