Custom Action setup (create your own action type)

Custom Action setup (create your own action type)

Note: This tutorial is for the classic UI only (Actions in Rich Forms and Actions Links) and will not (yet) work for Modern Forms and Modern List Actions.

 

In the CustomActionShared.zip archive attached below there are two files:
• sbExecuteCustomLogicConfiguration.txt
• sbExecuteCustomLogic.js

 

1) Upload sbExecuteCustomLogicConfiguration.txt to Site Assets/sbSharedAction.
2) In Site Assets  document library, sbSharedActions folder create sbExecuteCustomLogic folder with Scripts subfolder.
3) Upload sbExecuteCustomLogic.js to sbExecuteCustomLogic/Scripts.

 

There is a stub in sbExecuteCustomLogicExecutor in sbExecuteCustomLogic.js:

 

Ein Bild, das Text, Screenshot, Software, Schrift enthält.

KI-generierte Inhalte können fehlerhaft sein.

 

Just place your custom code inside this function body.


Enhanced configuration


If you would like to have an advanced configuration for your custom action in Action Builder like in out of the box teamsware Actions, please follow the next steps.
In the script you will find the Message property configured for the action. It is possible to add other properties and assign values or Expressions to them.

 

1) Provide template. In this step it is needed to set the HTML template with the inputs and bindings for the properties. (For more information on template and bindings please visit https://knockoutjs.com/
).
In the sbExecuteCustomLogic.js find CustomActionConfigVM.prototype.LoadTemplate:

 

Ein Bild, das Text, Screenshot, Software enthält.

KI-generierte Inhalte können fehlerhaft sein.

 

- In the template, there is a table row (<tr>) that represents the input for the property.
- Also data-bind attribute specifies the binding of this input to the Message property.
- this.MapPropertyToObservable('Message'); - specifies the binding logic.

 

2) To provide the evaluation of the properties in CustomActionExecutor.prototype.ExecuteAction:

 

Ein Bild, das Text, Screenshot, Reihe, Software enthält.

KI-generierte Inhalte können fehlerhaft sein.

 

- Specify all the properties names in props array. The names of the properties should be the same as the ones specified in the previous step.
- evaluatedValues – object that stores all the evaluated properties values. Now it is possible to retrieve the value using evaluatedValues[“PROPERTY_NAME”] syntax and pass them as parameters to the CustomActionExecutor.prototype.ExecuteActionInternal function. You can modify the number of arguments of this function to match your properties set or pass the whole object and then access properties via [“PROPERTY_NAME”] in function body to execute your custom logic.


    • Related Articles

    • Action: Clone team

      Clone team action allows to create a copy of an existing Microsoft team with the specified configuration options. You can select what to include in the copy: apps, channels, members and tabs. Example of Clone team action configuration on the current ...
    • Action: Create new folder

      Create new folder action allows to create a new folder dynamically in a specified SharePoint library. Example of Create new folder action configuration on the current site For more information about Action Builder read Action Builder introduction ...
    • Action: Delete meeting

      Delete meeting action will delete online meeting from the calendar in Microsoft Teams and in Outlook as well. It allows to delete both a single meeting and a series of meetings. Example of Delete meeting action configuration on the current site For ...
    • Action: Get image data

      Get image data action allows you to retrieve the image data information such as geolocation and the size of the image. Example of Get image data action configuration on the current site For more information about Action Builder read Action Builder ...
    • Action: Create channel

      Create channel action allows automatically create a Standard, Private or Shared channel in ‎ Microsoft Teams. Example of Create channel action configuration on the current site For more information about Action Builder read Action Builder ...