Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Using sysparm_fixed_query in URL

Karishma5
Tera Expert

Hello all, 

I have a requirement,  where we go to the user from > groups related list > edit button

In the edit member page I need to filter the groups with type - 'itil'. User should not be able to edit this filter, but can add more filter conditions if required. I tried using sysparm_query in URL but that is editable. 

find_real_file.png

I think it can be done with sysparm_fixed_query. But unfortunately not working. Am I using it in a wrong way?

Can anyone help me with this or provide me with suggestion on this.?

 

Thanks in advance,

Karishma

1 ACCEPTED SOLUTION

Shweta KHAJAPUR
Tera Guru

Try below code in before Query BR,

(function executeRule(current, previous /*null when async*/) {


	gs.addInfoMessage('test URL....   '+gs.action.getGlideURI());//.get('sysparm_collection')) ;//.toString().indexOf('Search String')
//	=
	if(gs.action.getGlideURI().get('sys_target')=='sys_user_grmember' && gs.action.getGlideURI().get('sysparm_type')=='M2MList' && gs.action.getGlideURI().get('sysparm_processor')== 'M2MList'){
		current.addEncodedQuery('typeLIKE1cb8ab9bff500200158bffffffffff62');
	   
	   }
})(current, previous);

View solution in original post

6 REPLIES 6

Alikutty A
Tera Sage

Hello,

Can you check this post: https://community.servicenow.com/community?id=community_question&sys_id=7358c3eddb1cdbc01dcaf3231f961909&view_source=searchResult

It is explaining the same requirement

Hello,

Has this answered your query? If yes please mark the correct answer.

Omkar Mone
Mega Sage

Hi 

Just add a reference qualifier condition on related list from where we add user. Add a condtion Roles is 'itil'.

 

find_real_file.png

Shweta KHAJAPUR
Tera Guru

Try below code in before Query BR,

(function executeRule(current, previous /*null when async*/) {

	


       


      try{ /

              if(
				   GlideTransaction.get() &&


                    GlideTransaction.get().URL == '/xmlhttp.do' &&


                    GlideTransaction.get().getRequestParameter('sysparm_processor') == 'M2MList' &&


                    GlideTransaction.get().getRequestParameter('sys_target') == 'sys_user_grmember'){
				

current.addEncodedQuery('typeLIKE1cb8ab9bff500200158bffffffffff62');
                    


              }


       


      }


       catch (error){


               gs.addErrorMessage(error, 'user query BR');


       }



})(current, previous);