Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
garvit96
Partner - Contributor II
Partner - Contributor II

Locking field selection using JS in Mashup

Hi All,

I am trying to pass a field value using app.field and selectvalues method and it also appears in the selection pane. What I want to do is lock that selection or hide that selection so that no user can change the values of that particular dimension. Does anyone have any method or a way to solve this issue preferably using JS.  

1 Solution

Accepted Solutions
garvit96
Partner - Contributor II
Partner - Contributor II
Author

Hey @Aiham_Azmeh ,

Thanks for the solution. Had to make some amendments to it as 'await' did not work properly in the mashup. Here I am also pasting my code for further reference. 

var app = qlik.openApp('app id');
app.field('field').selectValues([{qText: "value"}], false, false);
app.field('field').lock();

Let me know if this doesn't work properly for anyone. 

Thanks.

View solution in original post

2 Replies
Aiham_Azmeh
Employee
Employee

Hi @garvit96 ,

You should be able to do:

const field = await app.field('your_field');
await field.selectValues(...);
await field.lock();

https://help.qlik.com/en-US/sense-developer/September2019/Subsystems/APIs/Content/Sense_ClientAPIs/C...

I hope this helps 

garvit96
Partner - Contributor II
Partner - Contributor II
Author

Hey @Aiham_Azmeh ,

Thanks for the solution. Had to make some amendments to it as 'await' did not work properly in the mashup. Here I am also pasting my code for further reference. 

var app = qlik.openApp('app id');
app.field('field').selectValues([{qText: "value"}], false, false);
app.field('field').lock();

Let me know if this doesn't work properly for anyone. 

Thanks.