locked
Save function not working RRS feed

  • Question

  • We are creating Quotes using Scribe.  When a quote is opened by the user, we are loading the price list (this works fine), but when I try and save, there is an error, the ribbon is inactive and the form hangs.  When I close, we are not getting the usual MS error message dialog box.  If I remove the Xrm.Page.data.entity.save(); I can save using the ribbon.  Any ideas how to fix?

    function SetDefaultPriceList()
    {
    //set default Price List
    if(Xrm.Page.getAttribute("pricelevelid").getValue() == null)

        {
    //Create an array to set as the DataValue for the lookup control.
    var lookupData = new Array();
    //Create an Object add to the array.
    var lookupItem= new Object();
    //Set the id, typename, and name properties to the object.
    lookupItem.id = '07169356-148f-e111-97c8-00155d212418';
    lookupItem.entityType = 'pricelevel';
    lookupItem.name = 'List Price';
    // Add the object to the array.
    lookupData[0] = lookupItem;
    // Set the value of the lookup field to the value of the array.
    Xrm.Page.getAttribute("pricelevelid").setValue(lookupData);
    Xrm.Page.data.entity.save();

       }
    }


    Ken Compter

    Sunday, July 14, 2013 1:12 PM

All replies

  • Hello,

    First I will suggest you to write a retrieve call to get price list based on name, you can refer my post , also Is your field is readonly ??, try to debug your code and see if your code is not going again in this function during load because of save() function.

    HTH


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Sunday, July 14, 2013 4:11 PM
    Moderator
  • The PriceList is being loaded correctly, the field is not readonly.  I did debug and got :"Can't execute code in freed script".  I do not know what that means.  Any ideas?

    Ken Compter

    Monday, July 15, 2013 4:30 PM