Flow Designer Flow's action storage table

Rooma1
Tera Contributor

Just as workflow variables are being stored in the sys_variable_value table, I would just like to ask where the actions - Ask for Approval value get stored in the servicenow?

 

I need to build a script which will validate if any group approval has been used in the flow designer before deactivating the group.

 

Thanks,

Rooma

9 REPLIES 9

gurjot5
ServiceNow Employee
ServiceNow Employee

Hi i believe you are asking about 'ask for approval value' so the approval record would reside in the standard table 'sysapproval_approver.list' specified record table name even for the flow designer actions

 

You can query the sysapproval_approver table with the appropriate query to achieve the required outcome

 

Example : the approval record associated this incident this would reside in sysapproval_approver table

gurjot5_0-1694697525213.png

 

Please mark the response as helpful if it solves the issue which you are facing

 

Rooma1
Tera Contributor

Hi @gurjot5 ,

If 'Ask for Approval' is having the 'Group' table, how do we get to know the Group value? If the approval is triggering to a particular group, how do we get that value from?

 

Thanks,

Rooma

Hi,

If you're looking for the Group Approval table, it is sysapproval_group.

Rooma1
Tera Contributor

Hi @SeanPT ,

 

In the sysapproval_group table, there is no reference to the Flow which will give me the details under which flow, which group has been used for the Group Approval in the Ask for Approval action.

 

Below is the script which I have written for the workflow engine where it gives me all the published workflow version with the 'Group Approval' activity.

 

I want the same functionality with the Flow Designer as well but not getting the exact table where the values are getting stored of the actions for the flow.

 

var group_guid = '074873ae6fb36100af77c7178d3ee4e8'; //IT Security Admin

 

var workflowRecords = []; //names of Workflows
var arrayUtil = new ArrayUtil();

 

//get sys_variable_value where value is the group GUID/  Only looking where the table (document) is 'wf_activity'
var gr_svv = new GlideRecord('sys_variable_value');
gr_svv.addQuery('value', group_guid);
gr_svv.addQuery('document', 'wf_activity');
gr_svv.query();
while (gr_svv.next()) {

 

    //get records from the wf_activity table, using the document_key from the sys_variable_value table
    //only intested in published workflows as that should be the only version that needs action
    //there can be multiple activites for the same workflow with reference to the group (eg. group approvals, catalgue task assignment)
    var gr_wfa = new GlideRecord('wf_activity');

    gr_wfa.addQuery('sys_id', gr_svv.getValue('document_key'));
    gr_wfa.addQuery('workflow_version.published', true);
    gr_wfa.query();
    while (gr_wfa.next()) {

        workflowRecords.push(gr_wfa.workflow_version.getDisplayValue('name'));
        gs.print('Found a published workflow with references to the group record');
        gs.print('Workflow version Name: ' + gr_wfa.workflow_version.getDisplayValue('name'));
        gs.print('Table the workflow is attached to: ' + gr_wfa.workflow_version.table.toString());
        gs.print('Workflow Activity Name: ' + gr_wfa.getValue('name'));
        gs.print('Workflow Activity Definition: ' + gr_wfa.activity_definition.getDisplayValue());
        gs.print('System Variable Label: ' + gr_svv.variable.label.toString());
        gs.print('System Variable GUID: ' + gr_svv.getUniqueValue());
        gs.print('---------------------');
    }

 

}
    workflowRecords = arrayUtil.unique(workflowRecords);
    gs.print('');
    gs.print('Number of distinct workflows: ' + workflowRecords.length);
    gs.print('Distinct workflows: ' + workflowRecords.toString());