Extension Actions
Programmatically inspect the actions that are registered in your map experience and invoke them against either a single feature or a collection of features. These helpers mirror the Action menu availability inside the Power Maps UI, making it easy to wire automations, quick buttons, or custom selection workflows.
getSingleActions
Return the ordered list of single-record actions that the current map instance exposes.
Parameters
None.
Response shape
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the action (matches the Action definition record). |
actionName | string | Display label surfaced in the UI. |
actionIcon | string | Fluent UI icon name rendered alongside the label. |
actionType | ActionType | Categorises how the action behaves (open form, run flow, custom, etc.). |
actionOrder | number | Indicates the preferred ordering in menus. |
actionData | IKeyValue[] | Arbitrary configuration payload passed into the action implementation. |
actionFilter | Filter | undefined | Optional layer filter that the action applies once it completes. |
actionRefresh* flags | boolean | undefined | Signal whether related layers should refresh after execution. |
- The returned array is already filtered down to actions that are valid for single selections in the current context.
- Check out the full list of actions
Usage
const control = globalThis.MaptaskrControlManager.getControl(controlId);
const singleActions = control.getSingleActions();
singleActions.forEach((action) => {
console.log(`${action.actionName} (${action.actionType})`);
});
getMultiActions
Return the multi-record actions that can operate on a batch of features.
Parameters
None.
Response shape
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the action (matches the Action definition record). |
actionName | string | Display label surfaced in the UI. |
actionIcon | string | Fluent UI icon name rendered alongside the label. |
actionType | ActionType | Categorises how the action behaves (open form, run flow, custom, etc.). |
actionOrder | number | Indicates the preferred ordering in menus. |
actionData | IKeyValue[] | Arbitrary configuration payload passed into the action implementation. |
actionFilter | Filter | undefined | Optional layer filter that the action applies once it completes. |
actionRefresh* flags | boolean | undefined | Signal whether related layers should refresh after execution. |
- The returned array is already filtered down to actions that are valid for single selections in the current context.
- Check out the full list of actions
Usage – surface as custom UI
const control = globalThis.MaptaskrControlManager.getControl(controlId);
const multiActions = control.getMultiActions();
multiActions.forEach((action) => {
console.log(`${action.actionName} (${action.actionType})`);
});
executeSingleAction
Run a single-record action against a specific feature that you resolved via the Extension Method API.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
action | IAction | Yes | One of the objects returned by getSingleActions(). |
customFeature | CustomFeature | Yes | Feature payload containing featureId, layerInstanceId, geometry, and properties. |
successCallback | () => void | No | Invoked when the underlying action resolves without warnings. Defaults to a console log. |
warningCallback | () => void | No | Triggered when the action reports a soft failure. Defaults to a console warning. |
errorCallback | () => void | No | Triggered when the action throws. Defaults to a console error. |
Usage – launch the first matching action
const control = globalThis.MaptaskrControlManager.getControl(controlId);
// params comes from the ExecuteJS functionParameters which looks like this {{contactid}}
globalThis.ExecuteSingleJS = async function(params) { // Name of function of your choice
const singleActions = control.getSingleActions();
const openD365Action = singleActions.find((a) => a.actionType === 'OpenD365Modal');
if (openD365Action) {
const updatedAction = {
...openD365Action,
actionData: [
{ key: 'entityName', value: 'contact' },
{ key: 'entityId', value: params },
{ key: 'formPosition', value: 'center' },
// To pass formProps use the below example. these value will need to passed through functionParameters
// {
// key: 'formProps',
// value: JSON.stringify([
// { key: '[FIELD NAME]', value: '[VALUE]', dataType: 'string' },
// ]),
// },
],
};
const [firstFeature] = control.getSelectedFeatures();
if (firstFeature) {
await control.executeSingleAction(
updatedAction,
firstFeature,
() => console.log('Success!'),
() => console.warn('Warning'),
() => console.error('Error')
);
}
}
}
All callbacks are optional; when omitted the Extension Method Service writes to the browser console.
executeMultiAction
Batch-execute one action across multiple features—ideal for mass updates, templated emails, or workflow orchestration.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
action | IAction | Yes | Must come from getMultiActions() or another action definition that supports multi-select. |
customFeatures | CustomFeature[] | Yes | Collection of features to execute against. Empty arrays are ignored. |
successCallback | () => void | No | Runs if every invocation succeeds. |
warningCallback | () => void | No | Runs when at least one invocation emits a warning. |
errorCallback | () => void | No | Runs when the batch execution fails. |
Usage – execute against current selection
const control = globalThis.MaptaskrControlManager.getControl(controlId);
// In this example we will create a new work order and pass the selected contacts id to a field in the form called msdyn_workordersummary.
// params comes from the ExecuteJS functionParameters which looks like this `{{contactid|,}}`
globalThis.ExecuteMultiJS = async function (params) {
const multiActions = control.getMultiActions();
const createWorkOrder = multiActions.find((a) => a.actionType === 'OpenD365Modal');
const selectedFeatures = control.getSelectedFeatures();
if (!selectedFeatures?.length) {
console.warn('Select at least one feature before running the action.');
return;
}
const updatedAction = {
...createWorkOrder,
actionData: [
{ key: 'entityName', value: 'msdyn_workorder' },
{ key: 'entityId', value: ''},
{ key: 'formPosition', value: 'center' },
{
key: 'formProps',
value: JSON.stringify([
{ key: 'msdyn_workordersummary', value: params, dataType: 'string' },
]),
},
],
};
await control.executeMultiAction(
updatedAction,
selectedFeatures,
() => console.log('Bulk edit complete'),
() => console.warn('Bulk edit completed with warnings'),
() => console.error('Bulk edit failed')
);
};
- All provided features are validated before the action service runs. Any features that cannot be resolved cause the entire execution to short-circuit.
- Use the callbacks to keep your UI state in sync (refresh lists, close panels, etc.).
- Multi actions respect the same refresh flags (
actionRefreshSublayersEnabled,actionAllLayersRefreshEnabled, etc.) that you configure on the action definition.