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)

Unable to set Price List on Quote Via Javascript in Dynamics CRM online

(0) ShareShare
ReportReport
Posted on by


I wrote some javascript that loads values of price list and currency on Quotes entity. This used to work fine in CRM Online 8.2 but since upgrade to 9.0 I have started having a weird issue.

So on OnLoad of the form the script runs and sets the values as it should. If I wait on the quote form for like 20 seconds the form auto-refreshes which I guess is a CRM functionality, but after refreshing the Price List is wiped out and I see it clears the value of my currently selected price list.

function SetCurrency() 
{
    var object = new Array();

    object[0] = new Object();

    object[0].id = "<object_id>";

    object[0].name = "US Dollar";

    object[0].entityType = "transactioncurrency";

    Xrm.Page.getAttribute("transactioncurrencyid").setValue(object);

}
function SetPriceList() {
    var object1 = new Array();

    object1[0] = new Object();
    object1[0].id = "<object_id>";
    object1[0].name = "Default Price List";
    object1[0].entityType = "pricelevel";
    Xrm.Page.getAttribute("pricelevelid").setValue(object1);

}

I have tried debugging. The code works onLoad perfectly but after I get the "review your money field" warning, the script is not hit again. . 

P.S. the whole code is the same except that I removed the actual object.id's

*This post is locked for comments

I have the same question (0)
  • Ummacrm Profile Picture
    270 on at

    Try adding in auto-save prevention.  (disable auto-save)

  • Community Member Profile Picture
    on at

    I tried that but it didn't help. When i save the form manually I see the following "Review all the money fields in the form before you continue." After clicking OK, the Price List field is wiped out. I moved the script to onSave event of the form, the form hits the script every time it saves, same thing happens after saving the form. I wonder why only the Price List field is being wiped out on save.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    is you currency and price list matched?

    Every price list has it owns currency.

  • Community Member Profile Picture
    on at

    Yes It is USD, both currency and price are the same

  • Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    is pricelist field disabled on form itself?

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

    I tried that on my environment and it works like a charm with no issues. To be specific - what build number that you work on (I have 9.0.2.2647) and what interface do you use (Classic or UCI)?

  • Verified answer
    Community Member Profile Picture
    on at

    9.0.2.2647.

    It works the first time. then the page refreshes and the price list value is wiped out clean. I have used business rule and gotten rid of java. For now it works.

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