Auto-populate Assignment Group on Record Producer

michaelcory
Giga Expert

Hi,

I have a record producer form that feeds the Change Request table. On the form there is a Lookup Select Box variable that references a custom "Keyword" table and an Assignment Group field that references the sys_user_group table.   I named the Assignment Group variable the same as what it's named in the Change Request form, in order to use the Record Producer functionality and carry over the value to the Change Request form.   I will eventually add a UI Policy to "hide" the Assignment Group field, as the requester doesn't need to see it.  

My issue is I can't figure out a way to set the Assignment Group if the requester selects "Keyword Not Listed" from the Lookup Select Box "Keyword" Variable.   I have attached a screen shot of the form.   Any assistance would be greatly appreciated.  

1 ACCEPTED SOLUTION

I am not seeing any attachment with your last post, however, I have update my code


getDisplayValue is corrected to getDisplayValue()



if(producer.'name of your drop down variabve'.getDisplayValue() == 'Keyword Not Listed')


{


        current.assignment_group = 'sys_id of the group';


}


else if // do here for other conditons simirlay.


{




}



I posted the corrected code, can you try with this and check?


View solution in original post

12 REPLIES 12

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Could you post the code you're using to set the assignment group on the other selections?


Hi Brad,


The assignment group for the other keywords is set differently.   The requester is presented with the Configuration Item reference field if they select any other Keywords.   The CI record includes the Support Group, which sets the Assignment Group when it's pushed to the Change Request.   I only need to set the Assignment Group on the Record Producer for a "Keyword Not Listed" selection.   I have a UI Policy that "hides" the CI field if "Keyword Not Listed" is selected.


Deepak Ingale1
Mega Sage

Hello Mike,



You can do this with 'Producer' object available for you with record producers.



Go to maintain items


Select the record producer from the list.


Go to script section


and try with below code



if(producer.'name of your drop down variabve'.getDisplayValue == 'Keyword Not Listed')


{


        current.assignment_group = 'sys_id of the group';


}


else if // do here for other conditons simirlay.


{




}



You can take a look at 'Create Incident' record producer script section and check how it works


Kindly let me know if you require any assisstnce in configuring code.


Hi Deepak,


Thanks for the quick reply.   I applied the script to the Record Producer but it still doesn't populate the Assignment Group field.   The Record Producer already included a script to set a message on the Homepage re-direct.   I added your script below that.   I attached a screen shot of the Record Producer script window.   Is there another way perhaps?