Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

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

Ken_Michelson
Kilo Guru

I don't quite get the scenario you are going for, but regardless... you need a way to take information from the client (URL parameters) and access them from Server Side.



The only things I can think of is trying to use GlideAjax to store the parameters somewhere, or Session Client Data (or a combination):


putClientData(name, value);


getClientData(name);


clearClientData(name);



-Ken Michelson


acirovic1
Giga Expert

You can use current.operation() == 'insert' instead. No need to "capture" URI.


Anthony_vickery
Tera Expert

I'm not sure if the Business Rule can access them, but you can get parameters and values using:


RP.getParameterValue('sysparm_whatever');


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')