flow designer

karunasrikuna
Tera Contributor

Hi all,

I need a help . I got a requirement from client to create the following use cases via flow designer.

1. There is a variable in the catalog form called "xyz" with choices "abc" , "def" , "ghi". (xyz is a list collector). Once the user fills all the fields and submit the request , it will create an ritm. After submitting the request,

        If "xyz"  is "abc" then it should create one catalog task.

        If  "xyz"  is "abc" , "def" then it should create 2 catalog tasks.

        If "xyz"  is "abc" , "def" , "ghi" then it should create 3 catalog tasks. 

2. Once all the tasks are closed complete then it should trigger 3 level approvals.

Can someone help me on this.

4 REPLIES 4

Yashsvi
Kilo Sage

Hi @karunasrikuna,

Create Catalog Tasks Based on List Collector Choices:

 

  • Create a Flow:

    • Go to Flow Designer > Designer and create a new flow.
    • Set the trigger to Catalog Item Requested for the specific catalog item.
  • Add an Action to Create Tasks:

    • Add a Script action.
    • Use this script to create tasks based on the selected values of the "xyz" variable:

 

 

(function execute(inputs, outputs) {
    var xyzValues = inputs.xyz.split(','); // Assuming xyz is a comma-separated string
    var taskCount = xyzValues.length;

    for (var i = 0; i < taskCount; i++) {
        var task = new GlideRecord('sc_task');
        task.initialize();
        task.short_description = 'Task for ' + xyzValues[i];
        task.request_item = inputs.request_item_sys_id;
        task.insert();
    }
})(inputs, outputs);

 

 

 

Use Case 2: Trigger 3-Level Approvals When All Tasks are Complete

  1. Wait for Tasks to Complete:

    • Add a Wait for Condition action.
    • Set the condition to wait for all sc_task records related to the RITM to be Closed Complete.
  2. Add Approval Actions:

    • Add three Create Approval actions, one for each level of approval.
    • Configure each action with the appropriate approvers.

Thank you, please make helpful if you accept the solution. 

SAI VENKATESH
Tera Sage
Tera Sage

Hi @karunasrikuna 

 

You can follow the below image and Here I have taken List collector table as group table(in the field creation)

cn399.PNG

 

Thanks and Regards

Sai Venkatesh

Hi @SAI VENKATESH 

Drop downs of the variables are not visible in the "if" condition. Can you help me on this?

Thanks,

Karuna.

Hi @karunasrikuna 

 

did you use the get catalog variables to fetch all the variables 

 

 

thanks and regards 

Sai venkatesh