How do I maintain the fixed query while using the list of records' filter condition in a module?

ChuanYanF
Tera Guru

Dear experts,

 

I have two separate forms in the risk record, where if technology risk is true, then the form fields will be different, but I wanted to create a module where it is technology risk created by me, but when I try and use the sysparm_fixed_query argument, it works where user cannot remove the breadcrumbs but when i click new from the form itself, the form creation will not be tech risk is true because it is not defaulted as so, but when I try to use the list of record to define technology is true as below, it will work the form creation while create new will be under tech risk, how can I maintain this feature while also not let user to be able to remove or edit the breadcrumbs?

ChuanYanF_0-1750296149102.png

ChuanYanF_2-1750296215809.png

 

 

1 ACCEPTED SOLUTION

ChuanYanF
Tera Guru

I found a way which is adding ^EQ at the back will fix my problem

/sn_risk_risk_list.do?sysparm_fixed_query=sys_created_by=javascript:gs.getUserName()^u_technology_risk=true^EQ

View solution in original post

5 REPLIES 5

Kamal17
Kilo Sage

@ChuanYanF  You can try following approach to handle your scenario. It has two steps.

Step 1: Pass an argument in the URL

Pass an argument in the URL as part of your fixed query parameter to indicate technology risk is true E.g., risk_flag=true.

Make sure it doesn't match the exact field name.

By doing this you can avoid setting the static filter while retaining the identifier parameter in the URL.

 

Step 2: Use an onload client script to parse the URL argument value and take desired action

Write an onload client script on the specific table and set 'isolate script' field to 'false' in the script. Code the logic to parse the URL & retrieve the argument which we sent E.g., risk_flag=true.

var url = new GlideURL(window.location.href);
var myParam = url.getParam('sysparm_fixed_query');

 

Once the argument is parsed and its value is identified, write necessary logic to take desired action.

Note: Make sure your client script runs only in new record form and not for existing records.

 

Hit "Correct", "Helpful" or "Like" depending on the impact of the response.
Regards,
Kamal S

But I have two modules, which is one is risks created by me where tech risk is false and the other one is true, I dont think this is the step that is doable. I just want to know how to make the filters not editable where no sysparm_fixed_query is defined

@ChuanYanF 

"I just want to know how to make the filters not editable where no sysparm_fixed_query is defined"

As far as I'm aware, without using "sysparm_fixed_query", there is no other OOTB way to make the filters non-editable.

 

Hit "Correct", "Helpful" or "Like" depending on the impact of the response.
Regards,
Kamal S

Ankur Bawiskar
Tera Patron
Tera Patron

@ChuanYanF 

sorry your requirement is not clear.

Can you explain in detail with form screenshots?

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