How to Fetch Approval Groups from the Workflow associated to a Catalog Item ?

Sandeep kumar J
Tera Contributor

Hi Community

Is there any mechanism that can pull the list of groups used in the "Approval user" and Approval group" activities of a workflow associated to a Catalog Item ?

The Script should be in a way that, When I run the Script It should display the Name of the Catalog Item, Name of the workflow and list of Approval groups used in the "Approval user" and "Approval group" activities.

I really Appreciate your help.

6 REPLIES 6

Soumita3
Tera Expert

Hi Sandeep,

 

As per your requirement is not clear.

Could you please elaborate on your requirement?

You want "The Script should be in a way that, When I run the Script It should display the Name of the Catalog Item, Name of the workflow and list of Approval groups used in the "Approval user" and "Approval group" activities.", but at what condition you want your script to run and fetch you details of the catalog item?

 

I hope I am able to make you understand the exact query.

Please let me know on your further updates.

 

Regards,

Soumita.

Hi Soumita

 

I really appreciate for viewing my post.

 

So Here is what I am looking for

 

I want to list out all the groups referenced in a workflow associated to a catalog item.

 

Ex: Catalog Item 1

      Workflow 1

      List out the all the group referenced in Workflow 1 for Catalog item 1

 

Ex: Catalog Item 2

      Workflow 2

      List out the all the group referenced in Workflow 2 for Catalog item 2

 

Hope this is clear now.

DirkRedeker
Mega Sage

Hi

You find the Workflow Activities in the "wf_activity" table (see screenshot below)

find_real_file.png

In the column "variables", the values of the WF Activity properties are stored

Run the following script in "Scripts - Background" to receive the SysID of the Group(s), that are listed in the "Approval Group" Activity.

The Query is filtered by the SysID of the "Approval Group" WF Activity of the given Workflow in [wf_activity] table.

var gr = new GlideRecord('wf_activity');

gr.addQuery('sys_id', '353d64e9dbdabb00d0805901cf961916');
gr.query();

if(gr.next()) {
gs.info('Hallo');
gs.info(gr.vars.groups.toString());
gs.info(gr.input.toString());

find_real_file.png

 

Similar, when I run the Query on the SysID of my WF Activity with the "Approval - User" Activity

 

var gr = new GlideRecord('wf_activity');

gr.addQuery('sys_id', '70ece069dbdabb00d0805901cf9619ec');
gr.query();

if(gr.next()) {
gs.info('Hallo');
gs.info(gr.vars.groups.toString());
gs.info(gr.vars.users.toString());
gs.info(gr.input.toString());

}

find_real_file.png

 

I hope this helps, and you can mark as "correct" or as "helpful".

 

Thanks

Dirk

PS: This is not the solution of the whole report that you need. That is more work to do on your turn. But this indicates, how tp reach the information you are searching for.

 

 

 

Hi Soumita

 

I really appreciate for replying me on my post

 

Can we pull out the groups based on the scenario explained below ?

 

I want to list out all the groups referenced in a workflow associated to a catalog item.

 

Ex: Catalog Item 1

      Workflow 1

      List out the all the group referenced in Workflow 1 for Catalog item 1

 

Ex: Catalog Item 2

      Workflow 2

      List out the all the group referenced in Workflow 2 for Catalog item 2

 

I want to update all the groups on a field  (Approval groups from attached Workflow field) on the sc_cat_item form

 

I really appreciate your  help.