Info message on the form

Amit160
ServiceNow Employee
ServiceNow Employee

Hi,

We have a form backed by a table. One of the field in this form, 'Meeting link' is being populated by consuming a third party REST APIs which is written in an 'asyc' Business Rule. Now, our objective is to populate an informative message on the platform to let user's know that 'meeting link' will be available in some time or something like that. Once meeting link is generated and saved the messages should be disappeared.

Please let us know how to achieve that ? So far we have used following approaches

  • gs.addInfoMessage() in the 'async' BR where REST Apis is being used to create. Didn't work. No messages are shown.
  • onSumbit(), onChange() and onLoad() Client Script which has g_form.showFieldMsg() for that particular field. Message stays on the field in onChange() Client script but disappears when submit is hit. onLoad() message disappears when change and submit happens. onSubmit() Client script messages stays for very short time.
  • Display BR, but message stays always. To counter that, we created another BR on condition that when 'meeting_link' field changes call - gs.flushMessage()/gs.clearmessage() to remove all the gs messages. But in case of flushMessage() didn't work put as it is avaialble only in global context not in the scoped context and gs.clearMessage() didn't work out at all

 

We need any pointers, help or guidance to do that.

 

Thanks,

Amit

 

1 ACCEPTED SOLUTION

Amit160
ServiceNow Employee
ServiceNow Employee

Thank you Everyone,

I tried Asif's idea but it gets repetitive calls to the stack and doesn't work properly. We just simplified the requirement as - once the form is submitted, the Meeting Link field is shown with a message. It keeps showing until the field is being updated. 

The code is as follows 

 

function onLoad() {
if (g_form.getValue('meeting_link_of_case') == '') {
g_form.showFieldMsg('meeting_link_of_case', 'The meeting link is being generated. Please wait ...');
}
}

 

This doesn't match what we thought but works fine as far now.

 

Thanks,

Amit

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Amit,

On the page load you can check whether value present in that field or not and show info message using g_form.addInfoMessage();

or same can be done in display business rule

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Hi Ankur,

Thank you for your guidance. We need little more help from you. Please see the following query.

Actually, the initial display is not a problem. We can display but once the field is populated (thru async Business Rule) we need to remove the already displayed message. 

Now, how to remove the already displayed messages thru BR. As gs.flushMessage() doesn't work in scoped app. Even though, we placed it in an Script Include(in scoped app) and called that Script include in BR. gs.clearMessage() also didn't work.

and How to do the similar step in Client script ?

 

Thanks,

Amit

Hi Amit,

In that case then why not use client side to show info message and clear those using g_form.clearMessages()

Regards

Ankur

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

Sharique Azim
Mega Sage

as per my experience  ,since the form is being updated/redirected directly, any kind of show messages would not  show up. Even script action wont help you.

What you can do is a super high order  after BR to help your case.