Skip to main content

Function: MnOnPreStageChange

MnOnPreStageChange(): (target: any, key: any, descriptor: PropertyDescriptor) => void

Decorator that marks a method as an event handler for pre-stage change event.

This event is fired before the stage of a business process flow changed.

Remarks

Available on pages: Record only.

Registration: Automatic registration at runtime.

For more information, see Microsoft Client API Reference

Example

Confirm business process flow stage change

@MnComponent({
scope: {
pageType: "record",
table: "opportunity"
}
})
export class ConfirmBPFStageChangeComponent {
@MnOnPreStageChange()
async onPreStageChange(eventArg: FormEventArg) {
const args = eventArg.eventCtx.getEventArgs();
const result = await Xrm.Navigation.openConfirmDialog({
text: "Are you sure you want to change the business process flow stage?"
});
if (!result.confirmed) {
args.preventDefault();
}
}
}

Returns

fn

▸ (target, key, descriptor): void

Parameters
NameType
targetany
keyany
descriptorPropertyDescriptor
Returns

void

Defined in

packages/core/src/core/metadata/events.ts:609