Assigned to field validation based on role

abhaysingh98
Tera Contributor

Hello guys,

 

I have a requirement when a CIM task type is survey feedback and assigned to a any resolver group, then only users in that resolver group with the Survey Feedback role(resolver_group_manager) should show in assigned to field not all the users in that group should popup.

To Achieve this requirement I have created one script Include and used it in reference qualifier to filter the assigned to users based on the role but it is not working.

 

Script Include -

var CustomUserRoleFilter = Class.create();
CustomUserRoleFilter.prototype = {
    initialize: function() {},

    getFilteredUsers: function(taskType) {
        if (taskType == '3'){
            return 'sys_idIN' + gs.getRoledUsers('fmg_resolver_group_manager');
        }
    },

    type: 'CustomUserRoleFilter'
};
 
Reference qualifier - 
javascript: new CustomUserRoleFilter().getFilteredUsers(current.getValue('cim_task_type'));
15 REPLIES 15

Made all the required changes in the script and reference qualifier still it's not working

Did u put logs?? Can you share screenshot of it

Also check in user roles table how many records available with required role and what is the count from logs also ?

 

Please check encodedQuery() in script include it should be "user.active=true^role.name=fmg_resolver_group_manager"

Hi @Mani A , The script is working fine when I run it in background script but when I used it in reference qualifier its not working maybe it is due to the application scope my current table is sn_cim_task so I created script include for the same table amd also added dictionary override reference qualifier for the same table but still its not working.

This is the exact requirement when CIM task type is survey feedback then only pop up assigned to user who have survey feedback role for particular assignment group if assignment group changes then user will also change(Attached screenshot)

If assigned to user having survey feedback role then that script should work..

Now you are again changing requirement that if assignment group changes user will also change.

I also provided changing of assignment group logic then based on assigned to users will be prefilled if they having survey feedback role. But you said later only requirement was only assigned to user with one role

 

Please accept my solution and helpful if it works for initial requirement.  Then we can work on Second use case