How to extract Assignment group from Catalog Item to SCtask assignment group

Sid2024
Tera Contributor

Hi

 

Can you please assist with extracting the assignment group from a catalog item to set it as the assignment group for an SCTask?

 

Once a user selects the assignment group, this information should be captured from the RITM and assigned to the SCTask assignment group.

 

 

The General Service Request is an SCTask selected from the Select Request Template.

 

The Assignment Group is a reference field that obtains its information from the sys_user_group table and is named

assignment_group.

 

Sid2024_0-1720384959000.png

 

 

SCtask assignment group

Sid2024_1-1720385539713.png

 

 

2 ACCEPTED SOLUTIONS

Hi @Sid2024 

 

Let me know if you face any difficulties. 

 

Please mark the solution as correct if it works for you.

 

Thanks!

Ramkumar

View solution in original post

Hi @Sid2024 ,

 

You can write a before Business Rule on Catalog Task (sc_task) table.

Advanced: true

 

When to run:

before (insert)

Conditions: add if any

 

Advanced script:

(function executeRule(current, previous /*null when async*/) {

	current.assignment_group = current.request_item.assignment_group;

})(current, previous);

 

 Hope it works 😊.


Mark the response correct and helpful if the answer assisted your question.

View solution in original post

8 REPLIES 8

Ramkumar Thanga
Mega Sage

Hi @Sid2024 

 

Write a before business rule with the following script with appropriate conditions to make it run only for the specific catalog item(if needed).

 

Script:

var groupValue = '';
           var set = new GlideappVariablePoolQuestionSet();
           set.setRequestID(current.request_item);// requested item sys_id
           set.load();
           var vs = set.getFlatQuestions();
           for (var i=0; i < vs.size(); i++) {
               if(vs.get(i).getLabel() == 'Assignment group' &&  JSUtil.notNil(vs.get(i).getDisplayValue()) ) {
                           groupValue =vs.get(i).getValue();
               }
}
current.assignment_group = groupValue;
 
OR
 

In the catalog task activity of the workflow write down advanced script like

 

task.assignment_group =current.variables.AssignmentGroupVariableName;

 

Use the variable names in place of bold text as per your need.

Please give a try and let me know if you face any challenges.

 

Thanks!

Ram

Sid2024
Tera Contributor

Hi Ram

 

Thanks for the reply...

 

I created a business rule and added your script , still no joy 

 

Thanks

 

Sid

Sid2024
Tera Contributor

Sid2024_0-1720410247823.png

 

Hi @Sid2024 

 

Let me know if you face any difficulties. 

 

Please mark the solution as correct if it works for you.

 

Thanks!

Ramkumar