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)

Set Default Currency using JavaScript onload

(0) ShareShare
ReportReport
Posted on by 1,829

Hi All,

I want to set the default currency. So On load I am setting the value of currency.

Its working as expected for new records but not working for existing records.

When I open any exiting record I can see the default currency which I have set on load but when I enter value to the amount field It doesn't allows.

I tried with Business rules that doesn't works for me.

Please help me on this.
Thanks In advance.

*This post is locked for comments

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Could you please provide scripts, screenshots of error messages, e.t.c.?

  • Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi Andrii,

    This is my code:

    Xrm.Page.getAttribute(lookupName).setValue([

    {

       id: recorid,

       name: recordname,

       entityType: entityname

    }]);

    This is the error message :

    "A currency is required if a value exists in a money field. Select a currency and try again."

    Thanks

    Hemant

  • Community Member Profile Picture
    on at

    hi ,

    Do conversion of money field to the currency you set using js code

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

    Could you please provide a screenshot of your form?

  • Suggested answer
    Community Member Profile Picture
    on at

    You can set default currency through user settings for auto populating currency field on new records, you don't have to use JS for that. However, for existing records which do not have currency populated you can write business rule and that should work.

  • Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi Vikas,

    The same thing I have done for old records. Its strange, not working.

  • Community Member Profile Picture
    on at

    Can you please provide the screenshots of the business rule and error?

  • Verified answer
    Hemant Kumar Sahu Profile Picture
    1,829 on at

    Sorry Vikas, Now I have done some workaround fixes.

    So I cant show you the errors and business rules as they are removed now.

  • Community Member Profile Picture
    on at

    What workaround did you applied? Can you share?

  • Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi Mahatab,

    Not sure why currency value was getting set.

    For exiting record if currency is null then I am assigning currency value and refreshing the page again.

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