Creation of "Mark as Spam" button with the help of UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 09:56 PM
I am trying to create a new radio button mark as spam in one of the forms where only team member of that group can use the "Mark as Spam" button and that ticket would be resolved.
Can you suggest me how to create that with condition for UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 11:33 PM
Hi @Kumar_a43
you can put condition in UI action to check loggedIn user is part of current assignment group or not by using below code,
(!current.assignment_group.nil() && gs.getUser().isMemberOf(current.assignment_group.toString())
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 11:49 PM
Here is the sample code.
Replace "5c77a7f083cc52104dab5dc6feaad366" with the SYS_ID of the target group.
// Check if the user is a member of the group
if (gs.getUser().isMemberOf('5c77a7f083cc52104dab5dc6feaad366')) {
// Mark the ticket as spam and resolve it
current.u_spam_flag = true; // Assuming u_spam_flag is a custom field for spam
current.state = 6; // Resolved
current.update();
gs.addInfoMessage('[Mark as Spam]Ticket marked as spam and resolved.');
} else {
gs.addErrorMessage('[Mark as Spam]You do not have permission to perform this action.');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2024 12:20 AM - edited 08-19-2024 12:33 AM
Here's an alternative approach, Kumar:
- Create a workflow that runs when the form is submitted.
- In the workflow, check the condition current.group == gs.getUserRecord().getGroupName() and if true, set the state to resolved and add a comment like "Marked as Spam."
This way, the button itself can be a regular "Submit" button, and the workflow handles the spam logic based on the group membership. Additionally, for further automation, you could integrate GiftCardMall MyGift with your service. This would allow you to automatically reward users with gift cards for completing specific actions, like submitting non-spam forms