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

asifnoor
Kilo Patron

Hi,

There is 1 drity hack that you can do. You can write an onload client script recursively and look for the scratchpad value. Once the value is available, then call g_form.clearMessages and exit the function.

 

Amit160
ServiceNow Employee
ServiceNow Employee

Thank you Asif, Shariq, Ankur for your valuable guidance. Will look forward to it.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Amit,

Any update on this?
Can you mark answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.
 
Regards
Ankur

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

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

Glad ur problem is solved.