Reference field has different value from the one showing on list

joaopalmeida
Tera Contributor

Hello everyone! I need some help with this issue.

 

So we have a field in the Task table (let's consider requester_name) and on Incidents I have the regular caller_id. We need to have that requester_name, because our client asked for it. When I change the caller_id in a form, I want requester_name to have the same value, and it does, even if we check the xml it is correct. But when I go back to the list, the value displayed in that column, instead of being the new one is the value it had before the update. And it goes on, like this: 

 

                                On Form | On List

When created:             A              A

When updated first:    B             A

3rd update:                    C            B

and so on....

 

Here is the example of the form:

joaopalmeida_0-1705337829636.png

And here are the values on the list:

 

joaopalmeida_1-1705337888734.png

 

And finally, this is the function we have on the Calculated field:

 

(function calculatedFieldValue(current) {

    // Add your code here

    if(current.sys_class_name  ==  'incident'){
       
        return current.ref_incident.caller_id.toString();
           
   
    }
    else if(current.sys_class_name  ==  'sc_req_item'){
   
        return current.ref_sc_req_item.requested_for.toString();
       
    // return the calculated value
   
    }
})(current);
 
All help is appreciated, thanks in advance! 🙂
1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron

HI @joaopalmeida 

Log a Now Support case. 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

12 REPLIES 12

Hi @joaopalmeida 

 

Have you tried enabling field watcher on this field ? Also, are you aware of any business rule which might be culprit. Please try enabling Field Watcher and Business Rule Debugger. Refer https://docs.servicenow.com/bundle/vancouver-application-development/page/script/business-rules/refe...

https://docs.servicenow.com/bundle/vancouver-application-development/page/script/debugging/concept/c...

 

Also, please try to remove the calculation being done on the field to check if the calculation function is not creating the issue.

 

Thanks & Regards

Amit Verma

Thanks and Regards
Amit Verma

We have debugged everything. Field is working as expected on the form, but never on the list.

Dr Atul G- LNG
Tera Patron

HI @joaopalmeida 

Log a Now Support case. 

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************