Creation of "Mark as Spam" button with the help of UI action

Kumar_a43
Tera Contributor

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

3 REPLIES 3

Trupti94
Tera Guru

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())

HIROSHI SATOH
Mega Sage

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.');
}

 

DonaldSlack
Tera Contributor

Here's an alternative approach, Kumar:

  1. Create a workflow that runs when the form is submitted.
  2. 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