Function: MnOnSave
▸ MnOnSave(): (target
: any
, key
: any
, descriptor
: PropertyDescriptor
) => void
Decorator that marks a method as an event handler for save event.
This event is fired when:
- The user clicks the save button.
- save() method is called.
- Auto save is triggered.
- refresh(true) method is called.
Remarks
Available on pages: Record only.
Registration: Automatic registration at runtime.
For more information, see Microsoft Client API Reference
Example
Prevent auto save
@MnComponent({
scope: {
pageType: "record",
table: "account"
}
})
export class PreventAutoSaveComponent {
@MnOnSave()
onSave(eventArg: FormEventArg) {
const args = eventArg.eventCtx.getEventArgs();
if (args.getSaveMode() === XrmEnum.SaveMode.AutoSave) {
args.preventDefault();
}
}
}
Returns
fn
▸ (target
, key
, descriptor
): void
Parameters
Name | Type |
---|---|
target | any |
key | any |
descriptor | PropertyDescriptor |
Returns
void