Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Unable to Update Additional Comments field on a form using UI action

Abhilash Janga1
ServiceNow Employee
ServiceNow Employee

I have created a UI action, through that only the "Status" & "Additional comments" field should get updated. if i click the button without entering any "Additional comments" , error message should display. I have written below script in that UI action, its purely server side. Please if u can help me how can i update these two fields only. Rest all fields shouldn’t get updated even i select any value from them.

Script:

if (current.u_additional_comments == '') {
gs.addInfoMessage(current.u_additional_comments);
gs.addErrorMessage("Add Additional comments for Funds Released");
} else {
var comments = current.u_additional_comments;
var irt = new GlideRecord('u_money_request');
irt.addQuery('sys_id', current.sys_id);
irt.query();
while (irt.next()) {
irt.setValue('u_status', 'Money Released');
irt.setValue('u_additional_comments', comments);
irt.update();
gs.addInfoMessage("Status updated for approved Investment to Money Released Successfully");

}
}
action.setRedirectURL(current);

 

14 REPLIES 14

Hi,

 

Can you confirm the back end name for additional comments is this not child for any task table right ??

irt.setValue('u_additional_comments', comments);

 

Check the below link it may help you

https://community.servicenow.com/community?id=community_question&sys_id=057cadb71b8218503222ea89bd4bcb47

 

Thanks

Chandu Telu

Hi @Abhilash Jangam 

Since it is a journal field, you will not see the content in the field itself but in the Activity you will see the comments.

To have comments showing in Activity you need to click on the funnel beside the activity formatter:

find_real_file.png

 

Please check if this is working.

 

Thanks and regards,

Kartik

I am checking in activity formatter only. Its not updating

I tried with "var comments = current.u_additional_comments.getJournalEntry(1)"

this also. Still unable to update

Hi,

 

Can you confirm the back end name for additional comments is this not child for any task table right ??

irt.setValue('u_additional_comments', comments);

 

Check the below link it may help you

https://community.servicenow.com/community?id=community_question&sys_id=057cadb71b8218503222ea89bd4bcb47

 

Thanks

Chandu Telu