Unable to Update Additional Comments field on a form using UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 09:37 PM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 10:20 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 10:32 PM
Hi
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:
Please check if this is working.
Thanks and regards,
Kartik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 10:37 PM
I am checking in activity formatter only. Its not updating
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 10:20 PM
I tried with "var comments = current.u_additional_comments.getJournalEntry(1)"
this also. Still unable to update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 10:20 PM
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
