Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Pass Value from one form to another

sanjhi_07
Tera Contributor

When I click on UI action, I need to pass assignment group value from my current form to next form.

But before setting the assignment group in next form I need to check that in group table if any other group with same name and type: Change assignment exists in group table.

If for assignment group any other group exist I need to set that in new form when I click on UI action.

 

below is script include where I'm checking if any other group exist for same name and type change assignment:

 

var ChangeTypeAssignmentGroup = Class.create();
ChangeTypeAssignmentGroup.prototype = {
    initialize: function() {},
 
    getGroup: function(assignmentgroup) {
 
        var gr_group = new GlideRecord('sys_user_group');
        gr_group.addQuery('name', assignmentgroup);
        gr_group.query();
        if (gr_group.next()) {
 
            var ch_group = new GlideRecord('sys_user_group');
            ch_group.addEncodedQuery('type=10590df40a0aa02e00b57c4343145781');
            ch_group.addQuery('name', gr_group.name);
            ch_group.query();
            if (ch_group.next()) {
 
                var change_group = ch_group.sys_id;
gs.info('Sanjhi'+ change_group);
return change_group;
            }
        }
    },
 
    type: 'ChangeTypeAssignmentGroup'
};
 
 
UI action where I need to set the new assignment group:
 
var pageRecord = new GlideRecord("sn_vul_action_create_cr");
pageRecord.assignment_group = new ChangeTypeAssignmentGroup.getGroup(current.assignment_group);
0 REPLIES 0