How do you clear a reference fields value for current.fieldname?

DrewW
Mega Sage
Mega Sage

How do you clear a reference fields value for current.fieldname? I found some docs to indicate that I should do the below but it does not work. Can anyone offer any help?

var clearValue;
current.u_affected_item = clearValue;
current.update();

Docs I am refering to.
http://wiki.service-now.com/index.php?title=Resetting_Reference_Fields

9 REPLIES 9

Mark Stanger
Giga Sage

I think that method is for client scripts. You can try 'current.fieldname = '';' or 'current.fieldname = null;'.


I tryed both of those and they did not appear to work either. I am doing this when the user is hitting the submit button to enter a new incident in the system if that matters.


So is this in an 'onSubmit' client script or in a business rule? Can you post a screenshot of your entire script?


It is an edit of the "Submit" global UI Action. Action name is "sysverb_insert"

answer = current.insert();
if(current.u_affected_item){
var clearValue;
var tci = new GlideRecord('task_ci');
tci.initialize();
tci.ci_item = current.u_affected_item;
tci.task = answer;
tci.insert();
current.u_affected_item = clearValue;
current.update();
}

gs.include('ActionUtils');
var au = new ActionUtils();
au.postInsert(current);