Calculated field value is showing empty in list view servicenow

Sneha Anil2
Tera Contributor

I'm using calculate from dictionary in one field that I have created in incident form where it will take value from incident metric table, but it's showing empty in list view even if there is value in form.

this is code I'm using in calculate script

(function calculatedFieldValue(current) {

    // Add your code here
{
var gar = new GlideRecord('incident_metric');
gar.addQuery('inc_number',current.number);
gar.addQuery('mi_definition','35f0791ac0a808ae008f0a2b1dc1030c');
gar.addEncodedQuery('mi_valueISNOTEMPTY');
gar.query();
if(gar.next())
{
 //var gat = gar.getValue('mi_sys_created_on');
 var gat = gar.mi_sys_created_on;
 return gar.mi_sys_created_on;
}
}
 // return the calculated value

})(current);
 
Thanks in advance for you help.
1 REPLY 1

Sumanth16
Kilo Patron

Hi @Sneha Anil2 ,

 

there is onChange client script [Set Calculated Template] on the Calculated field. When calculated field value changes to true it generates a default template and put that in the calculation field. It is consistent throughout the platform regardless of field type. 

You can empty calculation field only by clearing value of calculation field in the form view and then uncheck the calculated checkbox and now save the form. From the List view we cannot empty the calculation cell value, I am not able to find any BR, ACL or onCellEdit client scripts that is restricting to empty the cell may be some internal functionality controlled by Servicenow.  

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda