The Zurich release has arrived! Interested in new features and functionalities? Click here for more

ITSM

vikas48
Tera Contributor

Hi all,

 

I want to know how can I clear the value of a field which is a "List" type field. I'm writing a Business rule to inherit one field to other.

I am stuck at : how shall I clear the field values.

 

Please refer screenshot. The field function(type=list) is a read only field having some value..

 

 

Below is the code snippet: 

var existingvalue= current.isa_entity_site.u_function.toString().split(',');
gs.addInfoMessage("the iexisting value is " +existingvalue);
 
current.isa_entity_site.u_function.clear();
 
 
//I have used u_function.setvalue('');
//I have used u_function.clear();
//I have used u_function='';
//I have used u_function= [""];
//I have used u_function.setString("");

17044520887317334223790558637207.jpg

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

In the Business Rule script try:

current.u_function = '';

where u_function is the field name.

Hi Bowman Thanks for your response. I have already used it still it didn't work.
I have updated my question by the methods i have already tried.

It looks like you are trying to dot-walk to this field from the current record/table?  That's not going to work - you'll have to do a GlideRecord from the current record to lookup the record on the other table before updating that field.  What table is the Business Rule running on?  What table is the u_function field on?

Other things to consider - are you certain the Business Rule is getting triggered - are you getting the info message?  What are the When to run parameters - before or after, insert, update,...?  Any Filter conditions or Condition on the Advanced tab?

Chetan Mahajan
Kilo Sage
Kilo Sage

Hello @vikas48 ,

                                Refer below script just modify it as per your requirment.

 

var incidentGR = new GlideRecord('incident');
incidentGR.addQuery('sys_id','ed92e8d173d023002728660c4cf6a7bc');
incidentGR.query();

if(incidentGR.next()){
    incidentGR.watch_list="";
    incidentGR.update();
}

 

Kindly mark Correct and Helpful if applicable