Crow Canyon NITRO activated sites in:
SharePoint Online and On-Premises 2013/2016/2019/SharePoint Server Subscription Edition
In Crow Canyon Custom Actions, ‘Query List Action’ is configured to fetch the list items as per the specified criteria. It is possible to continue or stop action execution based on whether any items are fetched in the query list action execution. A message is shown to user in case custom action execution stops as per the configuration in query list action. But if ‘Auto Close’ setting is enabled, then user is unable to read that message as progress dialog closes immediately.
This article has steps to auto-close progress dialog only if action execution is not stopped due to query list action result. Otherwise, the message configured in query list action is shown to the user.
Sample use case
In this example, it is required to update ‘Sub Project’ column in Main Projects list. A custom action is configured to query Sub Projects list. Update ‘Sub Project’ column in Main Projects list only if any item is found in the query list action and then auto close the custom action dialog. If no item is found in query list action, then do not auto close so that user can read the message.
- Navigate to custom actions for the list.
Go to Main Projects list -> List settings -> Crow Canyon Custom Actions -> Configure a custom action in designer experience.
Enable ‘Auto Close’ from action settings.
- Configure a variable with default value:
Variable Name: NITRO_DialogAutoClose
Default Value: Open
Note: This is a pre-defined variable. Specify same variable name and default value.
Initially this value is set to ‘Open’ so that custom action dialog will not auto close. After query list action, if items are fetched, then this value will be set to ‘Close’. In that case no message is to be shown to user and it will auto close. Rest of the steps in this article will clarify this point.
- Action 1: Add a ‘Query List’ action on the canvas.
Configure a query list action to query Sub Projects list. In this example, ‘Only if item(s) found’ option is selected to continue custom action execution.
Note: Select any option to continue custom action execution as required. Note that in case of ‘Always’, custom action always executes, so progress dialog always closes after action execution.
- Only if item(s) found: Next action will execute only if one or more matching item(s) are fetched in this query list action. If item(s) are not fetched, then action execution stops. Message given in ‘Show message if Custom Action execution stopped’ is shown in the progress dialog.
- Only if no item found: Next action will execute only if no matching items are fetched in query list action. If any items are fetched, then action execution stops. Message given in ‘Show message if Custom Action execution stopped’ is shown in the progress dialog.
- Add ‘Set Variable’ event on the canvas.
Expand ‘Events and Controls’ section -> Drag and drop ‘Set Variable’ on the canvas.
Add variable mapping for ‘NITRO_DialogAutoClose’ variable.
- Action 2: Add an ‘Update List Item’ action on the canvas.
From ‘Actions’ section, drag and drop ‘Update List Item’ action on the canvas to update ‘Sub Project’ column in Main Projects list.
Sub Project: $parselookupvalue(QueryProject##[Title|Title])