User Criteria in Record Producer

SHWA
Tera Contributor

Hello,
I'm currently working on a customization that allows end-users to create announcement records on the portal. When creating an announcement record from a record producer, is it possible to customize the end-user to select the User Criteria to which the announcement can be viewed?
Thank you.

1 ACCEPTED SOLUTION

SANDEEP28
Mega Sage

@SHWA Yes It is possible.

 

To make User criteria available for announcement, you need to enable the "Service Portal User Criteria Support" plugin and enable the "glide.service_portal.user_criteria_enabled" system property. I hope you already did this.

 

For record producer, I am assuming you have already record producer created and its creating announcement record. For user criteria mapping, you need to create additional two variables as below

1) Reference variable -- lets say "Select audience" and refer it to "User criteria" table 

2) CheckBox variable - lets say "Public"  --> Map to field ---> Public -- (Hidden checkbox should be checked) --> we don't want to show this field to end user.

 

SANDEEP28_0-1692531375865.png

 

SANDEEP28_1-1692531401959.png

 

Add below script in record producer script section. This will create record in "Can view" related list record.

 

 

var userCriteria = new GlideRecord('m2m_announcement_uc_can_view');
userCriteria.initialize();
userCriteria.setValue('user_criteria', producer.select_audience); // map select audience variable input here
userCriteria.setValue('announcement', current.sys_id);
userCriteria.insert();

 

 

SANDEEP28_2-1692531527770.png

 

I tested this and it working

 

SANDEEP28_3-1692531583905.png

 

If user is not able to see user criteria's on form then alter the existing ACL's or create new one so that user can see it.

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !! 

 

 

View solution in original post

3 REPLIES 3

Eswar Chappa
Mega Sage
Mega Sage

Hi @SHWA , the below community article will help you achieve it

 

https://www.servicenow.com/community/now-platform-forum/service-portal-announcements-user-restrictio...

 

Cheers, hope that helps

Eswar Chappa

*** Please mark as "Correct" or "Helpful" as appropriate ***

SANDEEP28
Mega Sage

@SHWA Yes It is possible.

 

To make User criteria available for announcement, you need to enable the "Service Portal User Criteria Support" plugin and enable the "glide.service_portal.user_criteria_enabled" system property. I hope you already did this.

 

For record producer, I am assuming you have already record producer created and its creating announcement record. For user criteria mapping, you need to create additional two variables as below

1) Reference variable -- lets say "Select audience" and refer it to "User criteria" table 

2) CheckBox variable - lets say "Public"  --> Map to field ---> Public -- (Hidden checkbox should be checked) --> we don't want to show this field to end user.

 

SANDEEP28_0-1692531375865.png

 

SANDEEP28_1-1692531401959.png

 

Add below script in record producer script section. This will create record in "Can view" related list record.

 

 

var userCriteria = new GlideRecord('m2m_announcement_uc_can_view');
userCriteria.initialize();
userCriteria.setValue('user_criteria', producer.select_audience); // map select audience variable input here
userCriteria.setValue('announcement', current.sys_id);
userCriteria.insert();

 

 

SANDEEP28_2-1692531527770.png

 

I tested this and it working

 

SANDEEP28_3-1692531583905.png

 

If user is not able to see user criteria's on form then alter the existing ACL's or create new one so that user can see it.

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !! 

 

 

OlaN
Giga Sage
Giga Sage

Hi,

That should not be a big issue, in your record producer/catalog item, you can have a variable that points to user criteria records, and have the end user select which ones should be used.

But you will also need to allow end users to read user criteria records, that means changing the ACL, or create an additional one.