The CreatorCon Call for Content is officially open! Get started here.

Service Portal Submission Messages

arabeau
Kilo Contributor

Hey All,

looking for some help on how to remove the "Created REQ" message for certain catalog items

We have a requirement to not display this message when a certain catalog item is submitted - I've messed around with a modified SC CATALOG ITEM widget but I just keep breaking it

find_real_file.png

Any help greatly appreciated!

 

1 ACCEPTED SOLUTION

nathanfirth
Tera Guru

I would add a field to the catalog item record, include it in the catalog item object in the server script of the widget. And then in the controller where it calls spUtil.addInfoMessage(), wrap it in an IF condition to determine whether to trigger the notification or not.

Should be pretty straightforward to implement.

Hope that helps.

-----------------
Nathan Firth
Founder and ServiceNow Architect
NewRocket, Inc.
nathan.firth@newrocket.com
http://serviceportal.io
http://newrocket.com

View solution in original post

6 REPLIES 6

nathanfirth
Tera Guru

I would add a field to the catalog item record, include it in the catalog item object in the server script of the widget. And then in the controller where it calls spUtil.addInfoMessage(), wrap it in an IF condition to determine whether to trigger the notification or not.

Should be pretty straightforward to implement.

Hope that helps.

-----------------
Nathan Firth
Founder and ServiceNow Architect
NewRocket, Inc.
nathan.firth@newrocket.com
http://serviceportal.io
http://newrocket.com

Dylan Mann1
Giga Guru

I've been looking at the code for this widget, and I see how the message is created in the server script (image attached), but I don't see where this message is being triggered. There's no spUtil.addInfoMessage() displaying the message in this widget. My guess is they're somehow broadcasting an event to the rootScope and the message is being triggered somewhere else... 

I'll keep looking but let me know if this helps.

- Dylan

find_real_file.png

I was looking at the sc catalog item v2 widget, which is why I couldn't see the addInfoMessage() method. Sorry about that! 

arabeau
Kilo Contributor

thanks for the responses

 

I've added attempted Nathan's suggestion - I've added a true/false field on the sc_cat_item table called "u_show_message"

 

I've adjusted this section of the server script of the widget but I think I'm "including it in the catalog item object" incorrectly...

 

 data.sc_cat_item = $sp.getCatalogItem(data.sys_id, true);
 if (data.sc_cat_item.category) {
  var categoryGR = new GlideRecord('sc_category');
  categoryGR.get(data.sc_cat_item.category);
  data.category = {
   name: categoryGR.getDisplayValue('title'),
   url: '?id=sc_category&sys_id=' + categoryGR.sys_id
  }
 }
 
 data.hideMessages = data.sc_cat_item.u_show_message;

 

and in the client controller I've wrapped the sp_util like so

 if (data.hideMessages == false) {
   spUtil.addInfoMessage(t);
  }

 

I've tried === and == just in case (I know elsewhere on the platform true/false evaluate unexpectedly...

 

submissions submit and generate REQ/RITMS properly but the "submitting" never resolves

 find_real_file.png