Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Not updating the worknotes label in the updated records in the incident form

chandan86patra
Tera Contributor

Hi ,

On load client script not working in updated records but it is working in new records

function onLoad() {
   //Type appropriate comment here, and begin script below
       //Show a Placeholder in a worknotes field
   let workNotes = g_form.getControl("work_notes");
   if (workNotes) {
       workNotes.placeholder = 'Work notes are visible for operators in SM.now and connected ticket tools, but not in the ESC portal';
   }
    //Show a Placeholder in a comments field
   let comments = g_form.getControl("comments");
   if (comments) {
       comments.placeholder = 'Comments are visible for users in the ESC portal and operators in SM.now, but not in connected ticket tools';
   }
   let labelText = g_form.getLabelOf('comments');
   if (labelText.substring(labelText.length - 1) == ':')
       labelText = labelText.substring(0, labelText.length - 1);
   labelText += new GwtMessage().getMessage('  (ESC portal visible)');
   g_form.setLabelOf('comments', labelText);
}
 
for  new  Record 
chandan86patra_0-1732251033283.png

 for old Record 

chandan86patra_1-1732251054394.png

 

 

Can anyone help me 

 

Thanks 

2 REPLIES 2

raj chavan
Tera Guru
Tera Guru

Try to use this just to debug the issue and see if it work on old existing records by this

if(!g_form.isNewRecord()){
}

If my answer helped you in any way, then mark it as helpful or correct. This will help others finding a solution.

 

Kindly mark it correct and helpful if it is applicable.

Thanks,

Raj

@raj chavan : it is not working