reference field value is populating undefined via field script of transform map after upgrade to SanDiego
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:49 AM
Hello Expertise,
We have a reference field 'Opened for' and we are setting this field value as null when one other field's value (field name XYZ) is null using field script of transform map. before upgrade this was working fine but our instance is upgraded from Quebec to San Diego version we are facing the below issue.
Undefined value is auto populating for the reference field 'Opened for' instead of null when we import the data using the transform map. Even after updating and saving the value of reference field 'Opened for' with the correct user, later when we import the data again the reference field 'Opened for' showing undefined value again on the case.
Did any one faced this type of issue earlier? If any body knows about this issue then please let us know.
Thanks,
Ulka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 12:55 AM
Hi Ulka
Can you share the field map details for opened for from your transform map.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 02:41 AM
Thanks Rohila for the response!
In the field script of 'Opened For' : there is a HRDP field, we put the condition like if the HRDP field is blank then set the 'Opened For' field to null. Hope now you will get an idea about the issue.
Thanks,
Ulka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2022 03:12 AM
Can you share the field script
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2022 02:58 AM
Hi Rohila,
Sorry for responding late.
Below is the field script for the 'Opened for' field in the transform map.
answer = (function transformEntry(source) {
var lineofbusiness = source.u_line_of_business;
//updated code
if(source.u_hr_business_partner){
var userName = '';
var gr = new GlideRecord('sys_user');
gr.addQuery('email', source.u_hr_business_partner);
gr.query();
if(gr.next()){
userName = gr.sys_id;
}
if((lineofbusiness == 'A') || (lineofbusiness == 'B')){
if(source.u_hr_business_partner == ''){
if (action == 'insert') {
target.opened_for = '';
target.assignment_group.setDisplayValue('HR_Group1');
target.assigned_to = '';
}
return target.opened_for = '';
}
else {
if(source.u_hr_business_partner != ''){
if (action == 'insert') {
target.opened_for = source.u_hr_business_partner;
target.assignment_group.setDisplayValue('HR_Group2');
target.assigned_to = '';
}
return target.opened_for = source.u_hr_business_partner;
}
}
}
else {
if(source.u_hr_business_partner == ''){
if (action == 'insert') {
target.opened_for = '';
target.assignment_group.setDisplayValue('HR_Group3');
target.assigned_to = '';
}
return target.opened_for = '';
}
else {
if(source.u_hr_business_partner != ''){
if (action == 'insert') {
target.assignment_group.setDisplayValue('HR_Group4');
target.assigned_to = userName;
}
}
}
return target.opened_for = source.u_hr_business_partner;
}
target.assigned_to = userName;
}
})(source);
Note: we have a issue when HRBP is blank in excel sheet (Which we are using for load) then it will set Opened for as undefined, assignment group & assigned to as blank. If assigned to person will save/update the opened for field , assignment group and assigned to then in next load system will override those values and opened for field will be set as undefined again
Please let us know if have any solution to this issue.
Thanks,
Ulka