How to remove particular string value and set assignment group name

lucky24
Tera Contributor

Hi team,

We have one assignment rule and script include.

In assignment rule we are getting some name from api which need to be validate and then we have to set alignments group on incident record.

Assignment rule

  

var assignGrp = new SetAssignmentGroup().populateAssignmentGroup(assignmentGroup);

if (assignGrp.indexOf("add ml group") {
gs.log("ak**bleep**a");
assignGrp.replace("add ml group",""); // Remove "add ml group" from the set
current.assignment_group.setDisplayValue(assignGrp);
}

 

script include

 

else {
            var group = new GlideRecord("sys_user_group");
            group.addQuery("name", assignmentGroup);
            group.addQuery("active", true);
            group.query();
            if (group.next()) {
    return p_assignmentGroup + " Add traning group";
          } 
 
Only in one condition if get valid name and active record so I am returning group name and some string value and in assignment rule I have to check if assignGrp  contain  "Add traning group" then I have to remove it from assignGrp and have to only set assignment group name
 
Please can we someone help me here?
1 REPLY 1

Anil Lande
Kilo Patron

Hi,

Why you are adding additional string with Assignment group name?

What is the logic behind this? why you are not returning assignment group name as it is?

 

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande