Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Removes a previously registered custom handler for a Microsoft 365 Copilot action.
Syntax
Xrm.Copilot.removeActionHandler(actionId, actionHandler).then(successCallback, errorCallback);
Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
actionId |
string | Yes | The unique identifier of the action. |
actionHandler |
Function | Yes | The handler to remove. Must be the same function reference passed to addActionHandler. |
successCallback |
Function | Yes | A function to call when the operation succeeds. |
errorCallback |
Function | Yes | A function to call when the operation fails. |
Return Value
Type: Promise<void>
Remarks
The method removes only the specific function reference you pass. It doesn't affect other handlers for the same actionId. If Microsoft 365 Copilot isn't enabled, the method does nothing.
Example
const handler = async (data) => { /* ... */ };
await Xrm.Copilot.addActionHandler("My.Namespace.MyActionMessage", handler);
// Later, when no longer needed:
await Xrm.Copilot.removeActionHandler("My.Namespace.MyActionMessage", handler);