Can we add URL in showfieldmessage

abirakundu23
Mega Sage

Hi All,

Can we add url in showfield message in servicenow ? Please find my attachment.

If possible ,then let me know the correct point.

If not possible could you please tell me how to show the field message contents including url on the form ?

 

1 ACCEPTED SOLUTION

A/C SN docs:

addInfoMessage(String message)

Adds the specified informational message to the top of the form.

This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.

 

Checkout below link for more details for other message functions:
https://developer.servicenow.com/dev.do#!/reference/api/sandiego/client/c_GlideFormAPI#r_GlideFormAd...

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

View solution in original post

4 REPLIES 4

Aman Kumar S
Kilo Patron

Hi,

showFieldMessage() function doesn't support HTML. If you want to add link, you have to go ahead with addInfoMessage().

Alternatively, you can follow below link:
To Create hyperlink in Client scripts, showFieldMsg

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

 

Best Regards
Aman Kumar

Hi Aman,

Could you please tell me how to keep info message 2 minutes  using script ? I want to keep few minutes afterthat it will gone.

can we achieve ?If possible please let me update in here.

A/C SN docs:

addInfoMessage(String message)

Adds the specified informational message to the top of the form.

This message appears for approximately four seconds and then disappears. This timeout is not configurable at this time.

 

Checkout below link for more details for other message functions:
https://developer.servicenow.com/dev.do#!/reference/api/sandiego/client/c_GlideFormAPI#r_GlideFormAd...

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Ian Mildon
Tera Guru

It is possible to add a clickable link into an InfoMessage using the "RecordToHTML" function.

Here is a Display Business Rule I am using to provide a clickable link:

var getSdesc = current.short_description;

 if (getSdesc.indexOf("created against Integration server" > -1)) {
     var ogChg = [];
     ogChg = getSdesc.toString().split('Change Request ');
     var spl = ogChg[1].split(' has been');
     var chgNum = spl[0];
 
     var chgRec = new GlideRecord ('change_request');
     chgRec.addQuery('number', chgNum);
     chgRec.query();
     if (chgRec.next()) {
         var getChgSysId = chgRec.sys_id;
         var chg2html = new RecordToHTML("change_request", getChgSysId, "${number}", true);
         gs.addInfoMessage("Click here to view the Change Request: " +chg2html.toString());
     }
 }