Survey NOT to be sent to users belonging to a particular group.

mankare_smita
Giga Contributor

I have a requirement where in i have created a Survey with required questions and also i have configured the trigger condition(condition - 'state' is closed) to send the survey.I need to give a condition to send this survey to users not belonging to a particular group.Need suggestions to achieve this.

3 REPLIES 3

shloke04
Kilo Patron

Hi,



You can mention in your trigger conditions itself stating Assignment Group is Not "group Name" as shown below:



find_real_file.png



So this won't allow the Survey to be trigger to the above mentioned group in the screenshot highlighted.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

This is for a custom table.There is a custom field "Requestor" which is user reference.The trigger condition is configured in such a way that the surveys will be sent to the users in this field "Requestor".


The requirement here is - the surveys should only be sent to the Requestors who are not part of a "xyz" group ,in other words it should not send survey requests to the users who are part of "xyz" group.


mankare_smita
Giga Contributor

I achieved this,posting the steps below so that someone will be helpful from this.



The steps are as follows:



1. Whenever we create a trigger condition for a survey ,for that particular trigger condition a business rule "Auto assessment business rule" is created automatically .So, if there are 3 trigger conditions for same/different surveys ,3 business rules with the same name "Auto assessment business rule" are created.



2. For my survey,i created a trigger condition,i went to that trigger condition's business rule (automatically created) i.e. "Auto assessment business rule" and have updated the script as below:



function onAfter(){      



var name=current.name_of_the_requestor_field_to_whom_mail_should_be_triggered;


var getSysid;


var gr1=new GlideRecord('sys_user_group');


gr1.addQuery('name',group_name); //give your group name in group_name


gr1.query();


if(gr1.next()){


getSysid=gr1.sys_id;


}


var gr=new GlideRecord('sys_user_grmember');


gr.addQuery('group',getSysid);


gr.addQuery('user',name);


gr.query();


if(!gr.next()){



(new sn_assessment_core.AssessmentCreation()).conditionTrigger(current, 'sys_id);


}


}