• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Edit
Show / Hide Table of Contents

Task menu - Mark request as spam

Audience:
settings
•
Version: 10.5.2
Some tooltip text!
• 5 minutes to read
 • 5 minutes to read

Managing support requests efficiently is crucial for maintaining smooth operations and delivering excellent customer support. In this tutorial, we'll explore how you can streamline your workflow by using a trigger or a Task menu item to automatically close a Request tab after certain action in your system.

With this automation, you can reduce manual steps, improve productivity, and enforce specific business rules. By the end, you'll be able to:

  • Automatically mark a request as closed.
  • Instantly close the Request tab after processing.
  • Improve efficiency for handling repetitive tasks, such as spam requests.
Note

This functionality requires SuperOffice version 10.5.2 or newer.

Scenario: Automating spam request handling

A company receives a high volume of spam requests and wants an automation that allows agents to close these requests with minimal manual effort.

Proposed solution

We will add a button to the Request screen that:

  1. Automatically sets the request status to "Closed".
  2. Closes the active Request tab in the SuperOffice interface.

Step 1: Creating the CRMScript

We start by creating a CRMScript, which will be triggered via a Task menu item in SuperOffice.

  1. Click on the top bar and select Settings and maintenance.

  2. In the navigator, click CRMScript and go to the Macros and scripts tab.

  3. Click the New script button.

  4. Fill in the following details in the Information tab:

    Field Value Description
    Name Mark as Spam Friendly name for the script
    Description Automatically closes a request and request tab What this script does
    Include name markAsSpam Unique single-word identifier for the script

    script-information -screenshot

  5. Go to the Script tab. This is where we will add our CRMScript code.

  6. Click OK or Apply to save.

Step 2: Adding CRMScript code

Copy and paste the following code into the Script tab:

#setLanguageLevel 4;

EventData ed = getEventData();
String ticketId = ed.getInputValue("ActiveTicketId");

//Find default closed status 
NSListAgent listAgent;
NSTicketStatusEntity[] statuses = listAgent.GetTicketStatuses();
NSTicketStatusEntity requestStatus;

for(Integer i = 0; i < statuses.length();i++)
{
    if(statuses[i].GetStatus() == 2 && statuses[i].GetIsDefault() == true)
    {
        requestStatus = statuses[i];
        break;
    }
}

NSTicketAgent agent;
NSTicketEntity request = agent.GetTicketEntity(ticketId.toInteger());
request.SetStatus(requestStatus);
agent.SaveTicketEntity(request);

ed.setStateValue("command:ticket.tab.close", ticketId);

Code explanation

  • Retrieve the active request ID.
  • Find the default "Closed" status in SuperOffice.
  • Update the request status to "Closed".
  • Close the Request tab in the user interface.

Click OK to save your script.

Step 3: Creating a Task menu item

Now that our script is ready, we need to add a Task menu item to trigger it.

  1. In Settings and maintenance, go to Lists.

  2. Find Task menu and click Add to create a new item.

  3. Fill in the following details:

    Field Value Description
    Name Mark as Spam Name of item in Task menu
    Task menu Request screen Where you want to show this item
    Type CRMScript
    Script Mark as Spam Choose the script created earlier
    Show in SuperOffice CRM (Checked)

    Task menu settings -screenshot

  4. Click Save to confirm.

Step 4: Activating the changes

To ensure the new menu item appears, refresh the SuperOffice client:

  1. Open SuperOffice CRM in a web browser.
  2. Append ?flush to the URL and press Enter.

Step 5: Testing the automation

  1. Open a Request in SuperOffice.
  2. Click the Task menu button () and select Mark as Spam.
  3. The request should:
    • Be marked as Closed.
    • The Request tab should close automatically.

Task menu item -screenshot

Summary

  • We created a CRMScript to automate request closures.
  • We added a Task menu item to trigger the script.
  • We refreshed the system and tested the automation.

Troubleshooting

  • If the option does not appear in the Task menu, ensure you performed a flush (?flush).
  • If the request does not close, verify the script is assigned correctly in the Task menu.

Now you can easily automate request management and enhance productivity!

In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top