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

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

    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.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

    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)?

  • Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

    Hi,

    is pricelist field disabled on form itself?

  • Community Member Profile Picture
    on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

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

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

    Hi,

    is you currency and price list matched?

    Every price list has it owns currency.

  • Community Member Profile Picture
    on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

    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.

  • Ummacrm Profile Picture
    270 on at
    RE: Unable to set Price List on Quote Via Javascript in Dynamics CRM online

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

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans