web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
RichardM Profile Picture

RichardM 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans