How to add different message on the catalog item for portal view and self service view

nayanmule
Tera Expert

Hi All,

I have a requirement, where would like to show some message with different links on a catalog item.

 

For eg. If I am ordering catalog item from selfservice view, I need to have a different message.

nayanmule_0-1741091766673.png

and when it is ordered from portal, it should be a different message.

 

Thanks 

Nayan

 

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @nayanmule,

 

When you mention you'd like to display a different 'message'. Can you expand a little on. what you mean by 'message' please?

Are you referring to a subset of text within the Description for example? Or are you referring to a popup message which displays after an activity such as a change of value?

 

Don't forget you have UI Policies and Catalog Client Scripts at your disposal whereby you can show and hide fields and display messages based on the 'UI type'. When you select 'Desktop, this refers to the native and backed Self Service view, where as 'Mobile / Service Portal' refers to the front end 'Portal' view.

See below screen shot for guidance.

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

 

Screenshot 2025-03-04 at 12.48.42.png

View solution in original post

5 REPLIES 5

Brad Bowman
Kilo Patron
Kilo Patron

You could create two onLoad or onChange Catalog Client Scripts, one with the UI Type set to Desktop (for the native UI / self-service view), the other Mobile / Service Portal.  If using a one script approach, there are a few different ways to identify Service Portal vs native UI

if (this) { //Service Portal method
    //portal message
} else {
    //self-service message
}
if(window == null){//Service Portal
    //portal message
} else {
    //self-service message
}

 

Robbie
Kilo Patron
Kilo Patron

Hi @nayanmule,

 

When you mention you'd like to display a different 'message'. Can you expand a little on. what you mean by 'message' please?

Are you referring to a subset of text within the Description for example? Or are you referring to a popup message which displays after an activity such as a change of value?

 

Don't forget you have UI Policies and Catalog Client Scripts at your disposal whereby you can show and hide fields and display messages based on the 'UI type'. When you select 'Desktop, this refers to the native and backed Self Service view, where as 'Mobile / Service Portal' refers to the front end 'Portal' view.

See below screen shot for guidance.

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.




Thanks, Robbie

 

Screenshot 2025-03-04 at 12.48.42.png

Juhi Poddar
Kilo Patron

Hello @nayanmule 

For this requirement, you can use an if-else block to display different messages based on where the catalog item is being ordered from:

 

  if (window === null) {
      // For portal

  } else {
      // For Native UI

  }

 

Catalog Client Script Configuration:

  • UI Type = All
  • Isolate Script = False

Execution:

  • The if block will be executed in the Service Portal.
  • The else block will be executed in the Native UI.

For more details, refer to Top Window Document Objects in Native UI and Service Portal 

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

Ankur Bawiskar
Tera Patron
Tera Patron

@nayanmule 

you can have 2 Rich Text variables and then hide 1 for portal and 1 for native

If my response helped please mark it correct and close the thread so that it benefits future readers.

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