locked
Order - Set price list based on account RRS feed

  • Question

  • Hi,

    As you know, when creating an order from Account, both Account and Price-list will be mapped and populated on the ordrer.

    But when creating a new blank ordrer from the CRM-menu nothing is pre-filled. To make this registration process easier, I'd like to use a javascript that triggers onChange when you choose Account; and filles in the default price list registered on the Account.

    Does anyone have a similar javascript I could use. Or suggestions on how this could be done?

    Thanks,

    Tuesday, September 20, 2011 12:06 PM

Answers

  • I just paste something like that in the following forum

    http://social.microsoft.com/Forums/en-US/crm/thread/11c45c23-d86a-4370-af35-2a5093da7e77/#44347558-a8e6-4bcc-b764-62f9cc2445c4

    make few changes

    Replace this  var guid = Xrm.Page.data.entity.getId();

    with var guid = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].id;

    Replace  alert("ACTION: Retrieved account Name = \"" + retrievedAccount.Name + "\", Telephone = {" + retrievedAccount.Telephone1 + "}")

             var lookupValue = new Array();

             lookupValue[0] = new Object(); 

             lookupValue[0].id = retrievedAccount.DefaultPriceLevelId.Id; 

             lookupValue[0].name = DefaultPriceLevelId.Name; 

             lookupValue[0].entityType = "pricelevel";

    then set the value of pricelist

    Xrm.Page.data.entity.attributes.get("pricelevelid").setValue(lookupValue);

     

     

     

    I hope this helps.


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    • Proposed as answer by Amreek Singh Tuesday, September 20, 2011 12:46 PM
    • Marked as answer by Donna EdwardsMVP Friday, September 23, 2011 4:53 PM
    Tuesday, September 20, 2011 12:46 PM

All replies