How to add "Error message " in API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2025 01:00 AM - edited 11-05-2025 08:06 AM
Here is the requirement to add error message for "Change Registration" Modal. (which is used by API users) alone
Example:
Close code: Successful
State: Cancel (4 )----error message should be shown in API users alone not in UI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2025 07:42 AM
Hi @Sruthi_2511 ,
Can you tell me how are you calling this?
gs.addErrorMessage will display error in UI and gs.error will add to the log.
If you want this to be returned to API, then this should be stored in a field so that API can return error message.
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2025 07:48 AM
seems a duplicate question you already raised where I responded
How to add "Error message " in API Call
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader