OnSubmit Client script to set value of assignment group

Deepika Mishra
Mega Guru

I am trying to set value of assignment group using client script on onSubmit functionality, but the below code is not working. Please help :
find_real_file.png

1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

You should use an Assignment rule. All that script is doing is setting an assignment group variable, not the assignment group on the record.

View solution in original post

25 REPLIES 25

It is not working 😞

RaghavSh
Kilo Patron

Are you trying to set assignment group on task based on some variable value?

It can be achieved by task activity in workflow:

 

if(current.variables.authority=='tax')

{

task.assignment_group='sys_id';

}


Raghav
MVP 2023

current can't be read in catalog client script

This code is for workflow task activity not for client script.

You can achieve this through workflow easily


Raghav
MVP 2023

akashvarma85310
Tera Contributor

Without client script, we can achieve this;  you can add the script in record producer

 

(function producerScript(current, producer) {


var inc = new GlideRecord('sys_user_group');
inc.addQuery('name', 'ABC');
inc.query();
if (inc.next()) {
current.assignment_group = inc.sys_id;
} else {
gs.error('Assignment group "ABC" not found');
}
})(current, producer);

 

Thanks,

Akash