From a90abe4d4f067c2cbb6274ee97762f35fb2d276c Mon Sep 17 00:00:00 2001 From: "Derek C. Finlinson" Date: Tue, 15 Nov 2016 13:49:12 -0700 Subject: [PATCH] Fix ErrorCallbackDelegate signature --- xrm/xrm-tests.ts | 2 +- xrm/xrm.d.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/xrm/xrm-tests.ts b/xrm/xrm-tests.ts index ac0f115154..64fb9e8c22 100644 --- a/xrm/xrm-tests.ts +++ b/xrm/xrm-tests.ts @@ -72,7 +72,7 @@ if (Xrm.Page.data.process != null) /// Demonstrate v7.1 Quick Create form -Xrm.Utility.openQuickCreate("account").then(( newRecord: Xrm.Page.LookupValue ) => { alert( `Newly created record Id: ${newRecord.id}` ); }, (code, message) => {console.log(message)}); +Xrm.Utility.openQuickCreate("account").then(( newRecord: Xrm.Page.LookupValue ) => { alert( `Newly created record Id: ${newRecord.id}` ); }, (error) => {console.log(`Code: ${error.errorCode}, Message: ${error.message}`)}); /// Make all controls visible. diff --git a/xrm/xrm.d.ts b/xrm/xrm.d.ts index ff42d8f005..b78174523a 100644 --- a/xrm/xrm.d.ts +++ b/xrm/xrm.d.ts @@ -481,6 +481,15 @@ declare namespace Xrm */ export module Async { + /** + * Object passed to ErrorCallbackDelegate + */ + export interface ErrorCallbackObject + { + errorCode: number; + message: string; + } + /** * Called when the operation is successful. * Currently, only the Xrm.Utility.openQuickCreate successCallback @@ -491,10 +500,9 @@ declare namespace Xrm /** * Called when the operation fails. * - * @param {number} errorCode The error code. - * @param {string} message The message. + * @param {ErrorCallbackObject} error The error object */ - export type ErrorCallbackDelegate = ( errorCode: number, message: string ) => void; + export type ErrorCallbackDelegate = ( error: ErrorCallbackObject ) => void; /** * Interface for Xrm.Page.data promises.