when i try to create a new record from JS to CRM with the function XrmServiceToolkit.Soap.Create its take a lot of time to finish.. so the JS continuing to execute the other function, in the function RecalculateSurface i retreive the value of the record created by the first function so i can't get the value of record because its not saved yet.
function save()
{
//some code
delivery.attributes["eoz_unit"] = Unit;
delivery.attributes["description"] = quoteDetail.Description;
delivery.attributes["quoteid"] = { id: quoteId, logicalName: "quote", type: "EntityReference" };
XrmServiceToolkit.Soap.Create(delivery); //function 1
RecalculateSurface();
}
function RecalculateSurface()
{
// code to retreive the record created in function 1
}
any idea to make the function RecalculateSurface() wait the save of the record? the function XrmServiceToolkit.Soap.Create return the id of the record created.