Create an Action Definition: Chained Action

NOTE: This topic applies only to the Spring 2007 and later releases.

Chained Actions, introduced in the Spring 07 release, allow you to chain (or link) multiple pre-defined actions together and identify the order in which they should be executed. When a user executes a chained action, each of the actions is automatically performed one after the other against all of the selected items. As an example, you could create a chained action that modifies a list item and then sends an email link to that item. Actions can be stored in the same site, cross-site, or cross-server.

For the current release, the maximum number of actions that can be chained is three.

1.  A Chained Action is comprised of multiple actions that have already been defined. Before you begin defining a Chained Action, create the actions you want to link and test each one to make sure it can execute successfully when run as a single action.

2.  Select the Create a New Action Definition button at the top of the Actions Wizard.

3.  In the Site URL for Document Libraries field, type the URL of the action library that will hold the new action definition, or a Global Link, and click Add. If the action library is located in the current site, this field can be left blank.

4.  All of the libraries that have a type of Document Library and can therefore be used to store an action definition are displayed in the Document Library for Action Definition area. Highlight the action library you want to use.

•      Actions cannot be written to an action library located in a sub-area.

5.  Type the name of the new action definition in the Action Name field.

•      This is the name that will be displayed to users, so make sure the name makes the purpose of the action as clear as possible.

•      At the same time, keep in mind that the drop-down that displays the action titles will automatically resize to fit the longest title. As a result, CorasWorks recommends that you limit your action names to approximately 30 characters in length.

6.  Use the Action Type drop-down to select Create Item Link. When you make this selection, the page is refreshed and the Configure Action Type section of the display is expanded with the appropriate entry fields for that action type.

7.  In the Message Displayed for Successful Action field, type the message to be displayed to users when an action is completed successfully.

•      The default success and error messages for an instance of the Actions Wizard can be changed via the Localization tab on the administration interface.

•      If the Chained Action succeeds, this is the message that will be displayed, not the message defined in any of the individual chained actions.

•      As of Spring 2007, a default message of “Success” is placed in this field. The message can be changed if you wish.

8.  In the Error Message Displayed for Failed Action field, type the message to be displayed to users when an action fails for any reason.

•      If the Chained Action fails, this is the message that will be displayed, not the message defined in any of the individual chained actions.

•      As of Spring 2007, a default message of “Error” is placed in this field. The message can be changed if you wish.

9.  If you also want to include any SharePoint error details when an action fails, select the Include SharePoint Error Details checkbox. When this option is enabled, SharePoint details will be appended to the error message you define in the step above.

•      As of Spring 2007, this checkbox is selected by default

10. If you are working with Spring 2007 or a later release, and the user will be prompted for additional information when any of the actions are executed, you have three options for the background color of the entry form displayed to the user when the action is executed:

•      To use the standard gray background for the entry form, leave the Background Color for Entry Form properties blank.

•      To specify a particular color for the entry form, click the Choose Color link and select the desired color from the Color Picker. You can also enter the hexadecimal value for the color if you wish.

•      To inherit the background color from the css file, select the Inherit from CSS checkbox. When you select this option, the entry field and the Color Picker to the left are disabled.

11. In the Action 1 drop-down, select the first action that you want to perform.

12. In the Action 2 drop-down, select the second action that you want to perform.

13. In the Action 3 drop-down, select the last action that you want to perform. This is optional.

•      If there are only two action definitions in the identified action library, then only two prompts to select an action will be displayed.

•      These action definitions can be stored cross-site or cross-server. They do not all have to exist on the current site.

14. When you are finished, click the Save button at the bottom of the page. The new chained action is now available to be added to an Active Display or Cross-Connect. The Action Selector does not support chained actions.

 

IMPORTANT: When you are deciding on the order of the actions to be chained, think about exactly what each action is going to do. Also keep in mind the fact that each of the chained actions is performed on the item that was originally selected in the Active Display or Cross-Connect. As a result:

•      You cannot define a chained action that creates or publishes a new list item and then sends an email link to that new item.

•      Delete actions should always be the last action executed.

•      Do not attempt to combine a Delete action and an Email Item Link action. Regardless of the order of the actions, the emailed link will lead to a deleted record.

Back to Top

 

What Happens when Chained Actions are Executed

When the user executes a set of chained actions, all of the actions are performed on the first item selected in the Active Display or Cross-Connect, then the second item selected, and so on. The exception to this rule is Email Item Links, because it is possible to send multiple item links in a single email. As a result, the email is sent after all of the other actions are executed.

If one of the chained actions presents the user with an entry form, the following action is named at the bottom of the form.

The success or failure message defined for the chained action is displayed when all of the actions have been completed.

Keep in mind that, as with any type of action, the more items you select to execute the action against, the more the response time will be affected.

Back to Top

 

Portability of Chained Actions

If you were to open up a chained action definition’s XML file, you would see that the definition stores the complete URL of each action in the chain. This is an important factor to keep in mind when you copy the chained action definition to another site or save it in a site template. When you do either of these things, the chained action will look for the actions in the chain in the original site that was specified.  If it does not have access, the chained action will fail.

To resolve this issue, you can use global links in the chained action definition. This is what CorasWorks has done with the solutions in the Spring 07 Solution Set that utilize chained actions. If you use any of these CorasWorks solutions, you have two options:

•      Turn on Central Configuration and add the global variable(s) referenced in the solution to your implementation.

•      Or, you can use the Actions Wizard to reconfigure the chained action and point it to the desired actions.

Details for both of these options are provided in the Solution Setup Guides, available online.

Back to Top