Edit group members Catlog Item

abhiyadav2001
Giga Expert

Hi,

 

I have a requirement where Manager should be allowed to edit the group members ( add / remove ) of the groups that he / she is managing.

 

I have created below variables in Catalog item.

1. Reference : User Assignment group table (sys_user_group) : This displays the groups which are managed by 'logged   In' user. I put a reference qualifier here to display particular groups.

 

2. List Collector :

I am thinking to use 'Group Edit' form / page on the Catalog item ( I think this will make my work easier) , pls find the attached screenshot

This form displays the 'existing users' of the groups on the right side and Other users on the left.

 

Is it possible to have that complete page in the Catalog item ? Where to find that page ?

 

Is there any other approach you think will be easier ?

 

Thanks,

Abhijeet

1 ACCEPTED SOLUTION

Kalaiarasan Pus
Giga Sage

here is the code for changing the filter of slush bucket and preloading the selected options on the right side... make changes according to your requirement.. Hope this helps



onchange function()


{


      if(!isLoading)


              {


              //ci is the variable name of slush bucket. replace ci below lines with your variable name


              var query = "^u_active=" + newValue+"^name!=";


              cig_filter.reset();


              cig_filter.setQuery(query);


              ciacRequest(null);


             


              if(newValue=='true')


                      {


                      setTimeout("defaultSelectedOptions();", 5000);


              }


                     


      }


}




function defaultSelectedOptions()


{


      try


      {


              var loadInitialValues = '6fd6bc05871d10005ea5476dff434d69,bbd7bc45871d10005ea5476dff434dca'; //values to load


             


              var varName = 'ci'; //slush bucket variable name


              var leftBucket = gel(varName + '_select_0');


              var rightBucket = gel(varName + '_select_1');


              rightBucket.options.length = '0';


              var leftOptions = leftBucket.options;


              var selectedOptions = loadInitialValues.split(',');


              var selectedIDs = new Array();


              var index = 0;


              for(var i = 0; i < leftOptions.length; i++){


                     


                      for(var j = 0; j < selectedOptions.length; j++){


                             


                              if(leftOptions[i].value == selectedOptions[j]){


                                      selectedIDs[index]= i;


                                      index++;


                              }


                      }


              }


             


              moveSelectedOptions(selectedIDs,leftBucket, rightBucket, '');


             


      }


      catch(err)


      {


              alert(err);


      }


}


View solution in original post

22 REPLIES 22

onchange should do the job for you just try building the logic


Hi       kalai ,



Any idea on how same thing can be achieved on Helsinki ?


Tried your code snippet but doesn't work.


The need is basic, display in the right bucket, members of a group from a reference field on a catalog item.



Thanks


Right side bucket or left side?


I haven't tried it on newer version as this seems to be a very old code.


Hi kalai



thanks for your feedback.



The need is basic.


  • 2 variables on a Catalog item
    • a Lookup Select Box on the sys_user_group table to dispay the groups
    • a List collector on the sys_user table
  • When selecting a group on the first variable, I need to display on the list collector on the left non members and on the right group members.
  • Exactly like when you edit members of a group like below screenshot :
    list_collector.png

The code still does work. I guess the issue is with the list collector data.


Since the number of users are high, the list would not populate all the users initially on the UI and due to this the script might be failing. You will need to tweak your code and try setting the users using the normal g_form.setValue method on change of group field. Once the field is set, you can then use the first part of the script to change the filter of the list collector to exclude the users already added.