Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

JavaScript - Save Contact, Open Account, Close Contact form

$
0
0

We are trying to accomplish the following:

1) User changes a field value on the Contact form which triggers a JS method
2) The JS method performs the following:
     a) Saves the Contact form (this triggers an Update plugin which creates an Account record)
     b) Opens the Account form and displays newly created Account record
     c) Closes the Contact form

Here are some of our JS attempts so far:

eg 1) This results in "Error: Can't execute code from a freed script."

accountField_OnChange() {    Xrm.Page.data.entity.save('saveandclose');    Xrm.Utility.openEntityForm("account", newAccountGUID);
}

eg 2) This works except the calling Contact form is still open

accountField_OnChange() {    Xrm.Page.data.entity.save();    Xrm.Utility.openEntityForm("account", newAccountGUID);
}


Is there a recommended approach to doing this in CRM 2011? 




Viewing all articles
Browse latest Browse all 8223

Trending Articles