Check mandatory fields when comment is posted in CSM workspace

Luke James
Tera Contributor

Hi All, 

 

I have a requirement where within the ServiceNow CSM workspace, anytime a user clicks the "post comment" button it checks any mandatory fields and throws an error if those mandatory fields are not filled in. Anybody know how to do this? 

 

Many Thanks, 

 

Luke

4 REPLIES 4

Runjay Patel
Giga Sage

Hi @Luke James ,

 

I dont think so you can achieve it as POST is not a button, also posting comment will not save the enire record it just get saved in table called "sys_journal_field".

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Ankur Bawiskar
Tera Patron
Tera Patron

@Luke James 

but why would someone fill mandatory field when they click Post button.

Post button is meant to add comments to record and has no direct relationship with user filling in mandatory fields.

Can you explain what's your business requirement here?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar. Basically the customer has a requirement that for each time any case is updated, with a change of field, or a new work note or additional comments, that a time entry is recorded for this piece of work on the case. We created 3 custom fields to record this time and then this would create a time worked entry each time the record is saved. This generally works, apart from posting a comment or work note at the moment. Essentially any time a user clicks post comments it needs to check these 3 fields, to check if they have been filled in. If they have not then it should not allow the comment to be posted. 

@Luke James 

then you will have to check when User clicks Post button i.e. when comment is added check these 3 mandatory fields.

You can use before update BR on your table

Condition: Comments Changes or Work Notes Changs

Script: check if all 3 fields are populated or not and if not then abort the submission

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader