问题
Could anybody give any piece of advice, or code, or documentation link where I can found:
- how to bind 'entity creation' after dialog is closed with positive result,
- and change some field on his parent entity, if dialog is closed with negative (cancel) status?
I also want to know how to pass data from and to dialog.
I am talking about custom aspx dialog (like dlg_closeopp.aspx) not standard dialog which is 'Process' entity.
I call my dialog with the following js code which is bound on OnFieldChange event of Contact entity:
function onFieldChange() {
var oUrl = Mscrm.CrmUri.create("/SFA/conts/dlg_newone.aspx");
var callbackFunction = Mscrm.Utilities.createCallbackFunctionObject("performActionAfterDialogClose", this);
var ret_val = openStdDlgWithCallback(oUrl, document, 450, 420, callbackFunction);
}
function performActionAfterDialogClose(ret_val) {
if (ret_val) {
//Do Anything here
}
}
I need to create an activity if the user-chosen data on the dialog meets my conditions.
Thank you in advance.
回答1:
To pass entity data to the dialog:
oUrl.get_query()['DialogId'] = dialogId;
oUrl.get_query()['ObjectId'] = entityId;
oUrl.get_query()['EntityName'] = objectTypeCode;
Use the callback to get the result:
ret_val.setCallbackReference(function (result) { //created record based on result });
Use can use the SDK to create records based on the result.
来源:https://stackoverflow.com/questions/39286452/crm-dialog-create-entity-and-pass-data