Need to set Assignement group of a contract renewal task in the Flow designer

hema sundar
Tera Contributor

we have a requirement to set Assignment group of a contract renewal task table . there is field "Category Manager(back end value: contract_administrator)" on the contract table. If the cateogory manager is selected particular user in the Contract table then the particule assignment group should be filled in the Contract renewal task table.

If there is any error in this script please let me know

Here is the scrtipt

 

function checkCategoryManager(){

var crT = new GlideRecord("sn_contract_renewal_task");
var gt = crT.addQuery("contract",current.sys_id); //contract is a field on contract renewal task table
var usr = gt.contract_administrator; //contract_administrator is back end value of a Category Manager


if( usr == '2945e479db60b340659cff621f9619b9' || usr == 'b48c430e1b1cc1103008ea41f54bcb4e' || usr == '6b1d55fadba86e009d6dfb37bf9619af' || usr == '60cddce91b96c950a39e859ce54bcb8f' || usr == '3226f9161b42b8503bcbeb5ce54bcbce' || usr == '453d0cb81b13cd14bb3843bae54bcb39' || usr == '460eff59dbec3340659cff621f9619b1' || usr == 'dea5683ddb60b340659cff621f9619ae' || usr == '34252968db109854ab3072c08c9619b3'){
return '84c8b68c4721e1141ebaf13a536d4347'; // Group sys_id
}
else if( usr == '2f35f29c1b545d103579657ce54bcbda' || usr == '336338db1bf1a5943008ea41f54bcb51' || usr == 'f5a6e035dba0b340659cff621f961913' || usr == '4e9f987ddbec7340659cff621f961946' || usr == 'e317fdd61bbf8114a39e859ce54bcb9a' || usr == 'b5546c5b1b653450a39e859ce54bcbff' || usr == 'a63d913edba86e009d6dfb37bf961994' || usr == '617db90bdb9f40d0d0887e721f96199c'|| usr == '58b08df5dba82a009d6dfb37bf96195b' ){
return '3bf0282d971d25102722938ef053af9d'; // Group sys_id
}}
checkCategoryManager();

hemasundar_0-1704456524195.pnghemasundar_1-1704456549565.png

 

2 REPLIES 2

CezaryBasta
Tera Guru

It seems that you forgot to add .query() and .next() to your initial GlideRecord calls. Read more in the documentation.

--
See more of my content here.

Siddhesh Gawade
Mega Sage
Mega Sage

try below script: 

function checkCategoryManager(){

var crT = new GlideRecord("sn_contract_renewal_task");
var gt = crT.addQuery("contract",current.sys_id); //contract is a field on contract renewal task table
crT.query()
if(crT.next()){

var usr = crT.contract_administrator; //contract_administrator is back end value of a Category Manager


if( usr == '2945e479db60b340659cff621f9619b9' || usr == 'b48c430e1b1cc1103008ea41f54bcb4e' || usr == '6b1d55fadba86e009d6dfb37bf9619af' || usr == '60cddce91b96c950a39e859ce54bcb8f' || usr == '3226f9161b42b8503bcbeb5ce54bcbce' || usr == '453d0cb81b13cd14bb3843bae54bcb39' || usr == '460eff59dbec3340659cff621f9619b1' || usr == 'dea5683ddb60b340659cff621f9619ae' || usr == '34252968db109854ab3072c08c9619b3'){
return '84c8b68c4721e1141ebaf13a536d4347'; // Group sys_id
}
else if( usr == '2f35f29c1b545d103579657ce54bcbda' || usr == '336338db1bf1a5943008ea41f54bcb51' || usr == 'f5a6e035dba0b340659cff621f961913' || usr == '4e9f987ddbec7340659cff621f961946' || usr == 'e317fdd61bbf8114a39e859ce54bcb9a' || usr == 'b5546c5b1b653450a39e859ce54bcbff' || usr == 'a63d913edba86e009d6dfb37bf961994' || usr == '617db90bdb9f40d0d0887e721f96199c'|| usr == '58b08df5dba82a009d6dfb37bf96195b' ){
return '3bf0282d971d25102722938ef053af9d'; // Group sys_id
}}
}
checkCategoryManager();

 

Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern.


Regards,

Siddhesh