Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在JavaScript中调用MS CRM操作_Javascript_Dynamics Crm_Action_Dynamics Crm Webapi - Fatal编程技术网

如何在JavaScript中调用MS CRM操作

如何在JavaScript中调用MS CRM操作,javascript,dynamics-crm,action,dynamics-crm-webapi,Javascript,Dynamics Crm,Action,Dynamics Crm Webapi,我尝试了下面的链接来调用JavaScript中的操作,但没有在下面的代码行中获取数据: var data = JSON.parse(this.response); alert(data);//Error data undefined 如果您在线,您可以执行以下操作,这是一个解除绑定操作的示例: var executeSurveyMonkeyAction = function (surveyMonkeyParameterSetId) { var reference = {}; reference

我尝试了下面的链接来调用JavaScript中的操作,但没有在下面的代码行中获取数据:

var data = JSON.parse(this.response);
alert(data);//Error data undefined

如果您在线,您可以执行以下操作,这是一个解除绑定操作的示例:

var executeSurveyMonkeyAction = function (surveyMonkeyParameterSetId) {
var reference = {};
reference.entityType  = "ade_surveymonkeydialogsparameterset";
reference.id = surveyMonkeyParameterSetId;

return new Promise(function (resolve, reject) {
    var executeActionRequest = {
        SurveyMonkeyDialogParameter: reference,
        getMetadata: function () {
            return {
                boundParameter: null,
                parameterTypes: {
                    "SurveyMonkeyDialogParameter": {
                        typeName: "mscrm.ade_surveymonkeydialogsparameterset",
                        structuralProperty: 5
                    }
                },
                operationType: 0,
                operationName: "ade_ProjectSurveyMonkey"
            };
        }
    };

    parent.Xrm.WebApi.online.execute(executeActionRequest).then(
        function (response) {
            if (response.ok) {
                if (response.status == 204) {
                    return new Promise((function (resolve) {
                        resolve({});
                    }));
                }
                return response.json();
            } else {
                throw new Error("Unknown error occured in ISV code.");
            }
        },
        function (error) {
            console.log(error.message);
            reject(error);
        }
    ).then(
        function (response) {
            if (!!response) {
                resolve(response);
            } else {
                console.log("no response");
            }

        },
        function (error) {
            console.log(error.message);
        });
});
}
以下是绑定操作请求的示例:

 var executeActionRequest = {
        entity: {
            entityType: entityName,
            id: recordId
        },
        getMetadata: function () {
            return {
                boundParameter: "entity",
                parameterTypes: {
                    "entity": {
                        typeName: "mscrm." + entityName,
                        structuralProperty: 5
                    }
                },
                operationType: 0, // This is an action. Use '1' for functions and '2' for CRUD
                operationName: actionName
            };
        }
    };

这意味着响应不是预期的JSON。您是否调试了代码/操作以查看任何线索?我可以假设您的操作没有输出参数或没有设置它。您能在CRM中提供操作定义吗?