Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Fulfillment workflows are a feature in EmpowerID

...

designed to fulfill the actions to be taken once a business request item has been processed

...

and a decision has been made

...

. Depending on the decision made, the configured fulfillment workflow can be developed to execute actions such as provisioning, de-provisioning, disabling, deleting, or any other action

...

necessary in response to the decision made in the business request item. The fulfillment workflows are designed to run in the background and provide status updates to the business request item to indicate whether the fulfillment has been completed

...

.

Tip

This

...

article provides an overview of fulfillment workflows and their key concepts. For detailed guidance on developing fulfillment workflows in Workflow Studio, refer to the documentation here.

Overview of Fulfillment Workflows

A Business Request can consist of multiple Business Request items in EmpowerID, each of which may have associated Item Type Actions. By linking the fulfillment workflow with these item-type actions, you enable the automated execution of workflow for fulfillment. By design, the fulfillment workflow is best suited for No Code Flows, although it can also be triggered or executed from other EmpowerID workflows

...

.

...


...


The role of Business Request Fulfillment is to process the business requests that are ready to be fulfilled. Each business request is associated with a specific Item Type Action, such as approval or rejection. The job of

...

Business Request Fulfillment is to identify the corresponding fulfillment workflow

...

configured with the item type action and then initiate its execution to fulfill the actions accordingly.

...

The fulfillment workflow is designed to receive a list of business request items called TargetBusinessRequestItem. These items need to be fulfilled, and to do that, the fulfillment workflow retrieves all relevant business request items and gathers the necessary data to execute the specified actions. Within the fulfillment workflow, the logic required to perform the desired actions or tasks on each item for the fulfillment is embedded. Once initiated, the fulfillment workflow operates autonomously in the background and executes the specified actions without requiring

...

manual intervention. The fulfillment workflow should update the business request item status to indicate the fulfillment status and show if all actions were executed successfully.

...

For example, let's say there's a business request

...

with multiple items, each with an item type action to delete or disable all associated accounts within the business request items. In such cases, the fulfillment workflow comes into play. We integrate the necessary logic into the fulfillment workflow to handle these scenarios seamlessly. When the fulfillment workflow kicks in, it locates all accounts associated with each business request item and

...

executes the deletion or disabling

...

Create a Fulfillment Workflow

In this example, our goal is to create a fulfillment workflow that can handle the deletion of all input accounts. Follow the instructions below to develop the workflow.

...

Right-click on the Package node in the Workflow Studio and select New Workflow > Fulfillment Workflow from the context menu to create a new fulfillment workflow.

...

Upon creation, you will see the fulfillment workflow with the following default activities. Let me give you a brief summary of these activities:

...

ValidateClaimedBusinessRequestItems: This activity validates the business request items associated with incoming calls from consoles, APIs, etc. It retrieves data from the database to verify the business request items exist and their status. This activity also updates the Fulfillment Process ID for the business request item to indicate the business request that is currently fulfilling the business request item.

...

SetOperationInputs: This activity extracts the operation input parameters or the business request items against which the fulfillment has to be done.

...

Drag Operation Activities Here: This is a placeholder where you can drag and drop additional activities into the workflow.

...

...

...

...

We will perform the delete account operation using the default operation available in EmpowerID. To find the necessary activity, go to the Activities pane, enter the relevant search text, and select the Delete Account Operation from the search results. Afterward, drag and drop the activity to the "Drag Operation Activities Here” placeholder.

...

...

Click on the newly added operation activity and provide a suitable name and description.

...

...

Enabling an operation is important after adding it. Right-click on the operation and select Enable/Disable option.

...

After selecting the Enable/Disable option, a popup will appear. Click on the forward arrow (>) to select. Once the desired operations are in the right pane, they are ready to be enabled.

...

...

Add some code to the Set Operation Inputs activity in the Implement Method.

Code Block
List<Guid> targetAccountGuids = CurrentWorkflow.ValidateBRIs.ClaimedBusinessRequestItems.Select(a => a.RequestDataTargetResourceID.Value).Distinct().ToList();
           	E.TList<C.Account> targetAccounts = Account .GetByAccountGuids(targetAccountGuids);
		   	var nonDeletedAccounts=new E.TList<C.Account>(targetAccounts.Where(a => !a.Deleted).ToList());
	        CurrentWorkflow.DeleteAccounts.TargetAccounts=nonDeletedAccounts;
			CurrentWorkflow.BusinessRequestItemDictionary = new Dictionary<Guid, BusinessRequestItem>();
			foreach (var bri in CurrentWorkflow.ValidateBRIs.ClaimedBusinessRequestItems)
			{
				if (!nonDeletedAccounts.Where(a=>a.AccountGUID==bri.RequestDataTargetResourceID.Value).Any())
				{
					 bri.ProcessStatus = 4;
					 bri.BusinessRequestItemFulfillmentStatusID=4;

				}
		       CurrentWorkflow.BusinessRequestItemDictionary[bri.RequestDataTargetResourceID.Value]=bri;
			}

...

Add Code to the Implement Method of the SetBusinessRequestItemStatus activity.

Code Block
List<Framework.Common.Shared.Workflow.OperationExecutionSummary> oplist = CurrentWorkflow.DeleteAccounts.OperationsExecutionSummary;
			foreach (Framework.Common.Shared.Workflow.OperationExecutionSummary op in oplist)
            {
               var bri = CurrentWorkflow.BusinessRequestItemDictionary[op.TargetResourceGUID];
                bri.ProcessStatus = 2;
                if (op.OperationExecuted)
                {
                    bri.BusinessRequestItemFulfillmentStatusID = 3; //success
                }
                else
                {
                    bri.BusinessRequestItemFulfillmentStatusID = 4; //Fail
                    bri.ProcessStatus = 3;
                    bri.FailedCount += 1;
                    bri.LastFailed = DateTime.UtcNow;
                    bri.NextAttempt = DateTime.UtcNow.AddMinutes(10 * bri.FailedCount * bri.FailedCount);
					bri.LastFailedError=op.ExecutionResultMessage;
                }

             }
			 var businessRequestItems=new E.TList<C.BusinessRequestItem>(CurrentWorkflow.BusinessRequestItemDictionary.Select(a => a.Value).ToList());
			 BusinessRequestItem.Update(businessRequestItems);

...

process

...

To create a new rule, click on the Create New button.

...

Click on Add after providing a suitable name to save the rule. Click Close to return to the previous window.

...

...

Right-click on the operation activity and select Edit_{YourRuleName} from the context menu. Add the following code into the Evaluate method to include skip logic to the skip rule.

Code Block
return CurrentWorkflow.DeleteAccounts.TargetAccounts==null||CurrentWorkflow.DeleteAccounts.TargetAccounts.Count==0;

Compile and Publish the Workflow

Before we can test the fulfillment workflow, the workflow needs to be published. Publish it to EmpowerID. For more information about it, find more details here.

Link Fulfillment Workflow to an Item Type Action

Once you've created a fulfillment workflow, it's crucial to set up its trigger mechanism. One typical approach is to link it with No Code Flows via Item Type Actions. This method ensures that whenever a certain Item Type action is chosen for a specific business request type, the corresponding configured workflow is automatically activated to perform the designated action.

...

.

...

image-20240314-082135.pngImage Removed

...

stylefloat:left; position:fixed;
idarticleNav

IN THIS ARTICLE

...