Show Error/Info message on Configurable workspace

Ranjane_Omkar
Kilo Sage

We want to display error/info messages in the Workspace. We tried using addInfoMessage/addErrorMessage, but they only work on one form.

Is there any other functionality that lets us show validation errors—e.g., date validation—in the Workspace, and that can also be dismissed?

7 REPLIES 7

@Ranjane_Omkar 

will have to check on that part then.

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

Voona Rohila
Kilo Patron
Kilo Patron

Hi @Ranjane_Omkar 

Do you mean field messages? You can use the same way we use for native UI but make sure your client script UI Type is set to 'All'.

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

IronPotato
Mega Sage

Hi @Ranjane_Omkar ,

 

on success event for your DR that is returning the validation add client script. In that client script grab the result of the validation and decide which type of alert you trigger from that script. 

 

const result = api.data.<yourDR>.result

 

if(result.validation) {

api.emit('NOW_UXF_PAGE#ADD_NOTIFICATIONS', {
id: 'alert_1', => ID OF ANY OF YOUR MODAL OR ALERT COMPONENT
status: 'high', => HERE YOU CAN DYNAMICALLY DECIDE WHICH TYPE OF ALERT YOU NEED INFO, CRITICAL etc.
icon: 'info-circle-outline',
content: message, => PLEASE HERE YOUR MESSAGE TO USER
action: { type: 'dismiss' } = > THIS WILL ADD ABILITY FOR USER TO DISMISS THE MESSAGE
});

}