How to access url parameters inside a Business Rule

harinalamalapu
Giga Expert

Hello Community,

Is there a way I can query the URL parameters from a Business Rule?

I see that the 'Copy Change' UI Action is framing an URL which will contain parameters 'sys_id', 'sysparm_query' and 'sysparm_goto_url', I am interested in capturing these URL parameters in a before query business rule. This business rule runs before a new record is created (where sys_id = -1).

Thanks,

Hari

1 ACCEPTED SOLUTION

harinalamalapu
Giga Expert

I was able to get along by using 'gs.action.getGlideURI()' to retrieve URL parameters in a Business Rule.



I used the following approach to check if the URL contains a certain look up string:


gs.action.getGlideURI().toString().indexOf('Search String')



I used the following to get the value of URL Parameters:


gs.action.getGlideURI().getMap().get('URL Parameter Name')


View solution in original post

7 REPLIES 7

gs.action.getGlideURI().getMap().get('') it is giving me null value for me .. can you please tell me what might be the reason 

 

This code was deprecated as of the Helsinki release.

I'm still using it in Kingston and it works. The reason behind it returning null might be that the parameter entered didn't exist there. Like if I'm using it on change Requests and go with 

gs.action.getGlideURI().getMap().get('sysparm_catalog')

it will return null unless it triggers from a standard change since that parameter is passed from the standard change template wizard, normal and emergency ones are never passed that parameter.

 

Now, Ravi wrote that passing gs.action.getGlideURI().getMap().get('') returned a null value... well, he didn't enter the parameter he's requesting, just ' '.