CRM Dialog create entity and pass data

落花浮王杯 提交于 2019-12-25 07:49:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!