Function: MnOnCommandInvoke
▸ MnOnCommandInvoke(commandName
): (target
: any
, key
: any
, descriptor
: PropertyDescriptor
) => void
Decorator that marks a method as an event handler for command invoke event.
This event is fired when a command is executed by pressing a button or selecting an option from the command bar.
Remarks
Available on pages: Record and list.
Registration: Manual registration only.
You can use Ribbon Workbench
to register this event or the Command Bar Editor of Power Apps.
For more information, see Microsoft Client API Reference
Example
Call a phone number when call
command is invoked on a contact record.
@MnComponent({
scope: {
pageType: "record",
table: "contact"
}
})
export class PhoneCallComponent {
@MnOnCommandInvoke("call")
onCall() {
Xrm.Navigation.openUrl({ url: "tel:123456789" });
}
Parameters
Name | Type | Description |
---|---|---|
commandName | ValueOrConfigPropertyMapper <string > | Name of the command or callback function that returns the name of the command from the component configuration. |
Returns
fn
▸ (target
, key
, descriptor
): void
Parameters
Name | Type |
---|---|
target | any |
key | any |
descriptor | PropertyDescriptor |
Returns
void