how to change field label and name through business rule

dio
Kilo Contributor

Hi all,

I want to change the field name and label through business rule.

Thanks in advance

9 REPLIES 9

Kieran Anson
Kilo Patron

Business Rules are scripts that run on the insertion of a record into the database. To manipulate the page UI you're gonna need a client script.

Is this a field label on the classic UI / workspace / service catalog. Can you provide an image of what you're wanting to change? Is this a permanent change or based on a condition when the form is loaded?

Suseela Peddise
Kilo Sage

Hi,

Why do you want to change field name?

After creation of field, you cannot change the field name on table.

 

If I have answered your question, please mark my response as correct and/or helpful.

 

Thanks,

Suseela P.

Community Alums
Not applicable

You can't change the name. 

You can change the label using a script similar to this: 

changeRecord("task", "short_description", "New Short Description Label");

function changeRecord(tableName, fieldName, newLabel){
  var gr = new GlideRecord("sys_dictionary");
  gr.addQuery('table',tableName);
  gr.addQuery('element',fieldName);
  gr.query();
  while(gr.next()){
    gr.setValue('column_label',newLabel);
    gr.update();
  }
}

 

As Kieran says above, this doesn't seem like a logical thing to do. If you can explain the outcome you're looking for, rather than asking for a solution, the community may be able to advise you better. 

thanks for the reply. let me modify, I want to change the label field in a incident once i submit the record.