1 Reply · Latest reply on Nov 30, 2017 10:41 PM by Gaurav Bajaj

    Dynamic Role creation?

      Hi All,

       

      i have a level field, depends on level is it possible to allocate the role dynamically without creating the group??

       

      i dont want to create a group and assign the role to group, i need to allocate the role depends upon level is it possible?

      please help me in this scenario.

       

      Regards

      Venkat.

        • Re: Dynamic Role creation?
          Gaurav Bajaj

          Hi Venkat,

           

          You can try adding a business rule on sys_user table.

          As soon as a record is set and level is added there, you can pick the level value and decide which roles you need to add to the user,

           

          Just Query down sys_user_has_role table and try below script in the BR.

           

           

          var gr = new GlideRecord('sys_user_has_role');

          gr.initialize();

          gr.user=current.sys_id; //sys_id of the user

          gr.role="add sys_id of the role";

          gr.state='active';

          gr.insert();

           

           

           

          Please mark the response correct/helpful based on the impact.

           

           

          Thanks

          Gaurav