From 4e17ec2932c10f89d6e8959fd34a145eb5cbf8fd Mon Sep 17 00:00:00 2001 From: Derek Finlinson Date: Thu, 30 Jan 2020 14:17:39 -0700 Subject: [PATCH] Add missing formContext.data.process event handlers (#41963) * Fix ViewSelector methods * Add missing event handler methods * Add prevent default to stage change event args * Remove whitespace * Remove additional whitespace --- types/xrm/index.d.ts | 67 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/types/xrm/index.d.ts b/types/xrm/index.d.ts index 2ff030fc6c..430d5ebe40 100644 --- a/types/xrm/index.d.ts +++ b/types/xrm/index.d.ts @@ -517,6 +517,11 @@ declare namespace Xrm { * @returns The stage object. For switching between entities, returns the previous stage object */ getStage(): ProcessFlow.Stage; + + /** + * Prevents the stage or status change operation from being submitted to the server. + */ + preventDefault(): void; } /** @@ -3775,6 +3780,42 @@ declare namespace Xrm { */ getSelectedStage(): Stage; + /** + * Use this to add a function as an event handler for the OnPreProcessStatusChange event so that it will be called before the + * business process flow status changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnPreProcessStatusChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to add a function as an event handler for the OnPreStageChange event so that it will be called before the + * business process flow stage changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnPreStageChange(handler: Events.ContextSensitiveHandler): void; + + /** + * Use this to add a function as an event handler for the OnPreProcessStatusChange event so that it will be called when the + * business process flow status changes. + * @param handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnProcessStatusChange(handler: Events.ContextSensitiveHandler): void; + /** * Use this to add a function as an event handler for the OnStageChange event so that it will be called when the * business process flow stage changes. @@ -3787,18 +3828,6 @@ declare namespace Xrm { */ addOnStageChange(handler: Events.ContextSensitiveHandler): void; - /** - * Use this to add a function as an event handler for the OnProcessStatusChange event so that it will be called when the - * business process flow status changes. - * @param handler The function will be added to the bottom of the event - * handler pipeline. The execution context is automatically - * set to be the first parameter passed to the event handler. - * Use a reference to a named function rather than an - * anonymous function if you may later want to remove the - * event handler. - */ - addOnProcessStatusChange(handler: Events.ProcessStatusChangeHandler): void; - /** * Use this to add a function as an event handler for the OnStageSelected event so that it will be called * when a business process flow stage is selected. @@ -3811,6 +3840,20 @@ declare namespace Xrm { */ addOnStageSelected(handler: Events.ContextSensitiveHandler): void; + /** + * Use this to remove a function as an event handler for the OnPreProcessStatusChange event. + * @param handler If an anonymous function is set using the addOnPreProcessStatusChange method it + * cannot be removed using this method. + */ + removeOnPreProcessStatusChange(handler: Events.ProcessStatusChangeHandler): void; + + /** + * Use this to remove a function as an event handler for the OnPreStageChange event. + * @param handler If an anonymous function is set using the addOnPreStageChange method it + * cannot be removed using this method. + */ + removeOnPreStageChange(handler: Events.ProcessStatusChangeHandler): void; + /** * Use this to remove a function as an event handler for the OnProcessStatusChange event. * @param handler If an anonymous function is set using the addOnProcessStatusChange method it