cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Control visibility of a button (hide /show)

anassNasser
8-Gravel

Control visibility of a button (hide /show)

hi community, 

how can I Control  visibility (hide /show) a button in a mashup depending on a members of a userGroup ?

 

userGroup Admin : show a button 

userGroup Operators : hide this  button 

thank you in advance

 

Anass

 

ACCEPTED SOLUTION

Accepted Solutions

Create a service where you can call 

 

var result = Resources["CurrentSessionInfo"].GetCurrentUserGroups();

 

It returns an infotable :

 

2020-03-04 17_02_22-Services _ OfeService.png

 

Code for your service ( it returns a boolean ). the "userAdmin" string may be passed as a parameter, 

 

var resultGrp = Resources["CurrentSessionInfo"].GetCurrentUserGroups();
var tableLength = resultGrp.rows.length;

var result = false;
for (var x=0; x < tableLength; x++) {
var row = resultGrp.rows[x];
if("userAdmin" == row.name){
result=true;
break;
}
}

 

Next, some bindings :

2020-03-04 17_09_28-Design _ TestUser.png

 

And it works

View solution in original post

2 REPLIES 2

Create a service where you can call 

 

var result = Resources["CurrentSessionInfo"].GetCurrentUserGroups();

 

It returns an infotable :

 

2020-03-04 17_02_22-Services _ OfeService.png

 

Code for your service ( it returns a boolean ). the "userAdmin" string may be passed as a parameter, 

 

var resultGrp = Resources["CurrentSessionInfo"].GetCurrentUserGroups();
var tableLength = resultGrp.rows.length;

var result = false;
for (var x=0; x < tableLength; x++) {
var row = resultGrp.rows[x];
if("userAdmin" == row.name){
result=true;
break;
}
}

 

Next, some bindings :

2020-03-04 17_09_28-Design _ TestUser.png

 

And it works

Hi @olivierfresse

Thank you for your detailed response, now its clear for me. I accept it as a solution .

 

Anass

Announcements


Top Tags