How to make a business rule run ONLY on service portal?

Smith Johnson
Tera Guru

Hello,

 

I have a before query business rule on incident table.

I want the script to run ONLY when the user sees the incidents on a table on service portal.

The script of the business rule SHOULD NOT run when the user sees incidents on backend.

How can I make this?

 

Thank you.

1 ACCEPTED SOLUTION

Hi,

Can you add that in the script section?

if that doesn't work then use this

gs.action.getGlideURI().toString().indexOf('csm') > -1

Regards
Ankur

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

View solution in original post

7 REPLIES 7

@Ankur Bawiskar @Michael Jones - CloudPires 

I get the following error and I can not understandy why. Can you help me on that??

find_real_file.png

Hi,

Can you add that in the script section?

if that doesn't work then use this

gs.action.getGlideURI().toString().indexOf('csm') > -1

Regards
Ankur

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

I suggest this condition

if(GlideTransaction.get().getRequest().getHeader("referer").indexOf('/sp?') > -1)

Because in back office the URI contains sparam which also contains sp.