Null value is getting displayed in reference field

suuriya
Tera Contributor

HI Community,

 

I have a requirement; task needs to be assigned to requested for's hub.

Requester's hub assignment group can be found in the field called Hub on the Location form of the location the requester is assigned to. For example, if the requester's location (mentioned in the Location field of their user profile) is OH-Ohio-Work then the hub assignment group for this location mentioned in the Hub field of this location screen will be the one the above-mentioned task will be sent to.

 

For that i have created a catalog task and in advanced condition written this script

var names = current.variables.common_vars_requested_for;
var loc = names.location;
var hubs = loc.u_hub;
gs.addInfoMessage(hubs);
task.assignment_group = hubs.getDisplayValue();
Task is generated with an empty assignment group...it seems null value is getting displayed, but it is not completely empty...so to check added the info message there it is showing the correct name but in task assignment group it is showing null value 
Please let me know how we can fix this
suuriya_0-1715087672760.png

 

 

Thanks in Advance!

1 ACCEPTED SOLUTION

Oh well if its a group, you need to change cmn_location to sys_user_group

View solution in original post

13 REPLIES 13

Kieran Anson
Kilo Patron

Hi Suuriya,

You're setting the display value as the underlining value rather than the sys_id.

task.assignment_group = hubs.getDisplayValue(); // This is causing your issue

 

task.setValue('assignment_group' , hubs.getValue());

HI @Kieran Anson ,

 

Thanks for the reply

I tried task.setValue('assignment_group' , hubs.getValue());

and also tried task.setValue('assignment_group', hubs);

but still it is not working as expected showing null value in task

To debug, look at the XML of the record and see what value is in the field, is it a sysid? Is it the expected sysid?

HI @Kieran Anson 

I checked the xml of the task created it is showing like this

suuriya_0-1715093497888.png

Eit - myTechonology is the hub value.