- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2023 08:53 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2023 04:41 AM - edited ‎08-20-2023 05:12 AM
@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.
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();
I tested this and it working
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 !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2023 04:08 AM
Hi @SHWA , the below community article will help you achieve it
Cheers, hope that helps
Eswar Chappa
*** Please mark as "Correct" or "Helpful" as appropriate ***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2023 04:41 AM - edited ‎08-20-2023 05:12 AM
@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.
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();
I tested this and it working
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 !!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2023 05:01 AM
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.