Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need help dot walking in assignment script for Assigned to.

taylor21
Mega Expert

Hi all,

I am attempting to create an assignment rule that sets the "Assigned to" field to the "Opened for's" Business Partner which is a value populated in their HR Profile. The Opened for field is a reference to the user table. I'm a beginner with scripting so I am looking for some assistance on how to populate the current record's "Assigned to" field with the Opened for's Business Partner using an Assignment rule or a Matching rule. Any assistance is greatly appreciated.

 

Taylor

16 REPLIES 16

Hi Brian, yes - the reference field [Business Partner] that exists on the HR Profile is a reference to the sys_user table. The opened_for field on the HR Case is also a reference to the sys_user table. 

 

taylor21
Mega Expert

Hi all,

This is what I have compiled with all of your answers (thank you so much for your help!!). I have populated the group with the potential business partners that could be selected for the assignment group that is applied to these cases. I am using a Matching Rule with a script for this... I am still unfortunately not having success.

 

find_real_file.png

Hi Taylor,

Excuse me if I have driven you the wrong way about using 'sys_id' instead of 'user'. If opened_for is referenced to user table, you should not use 'sys_id' in line3.

Instead, you have to use 'user' or whatever is the field on HR table that is storing the user info.

That's okay! Thank you Archana - I have made this edit and still no luck. 

bryan_strasburg
Mega Guru

Sorry that still isn't working.

A bit of debug:

1) Set your matching rule to a specific user to verify that the matching rule is executing.

or scripting debug:

2)

Add gs.addInfoMessage("I am here in code"); 

or 

Add gs.addInfoMessage("This is my HR Partner" + profileGR.u_hr_partner);  

 

That is probably as far as I can get you without digging in.