Create Custom Actions

How to create Custom Action

To create extension-specific actions, you need to provide the corresponding code structure in the given format in the resources.json file, based on your requirements. The code structure includes two groups: Custom Actions and Targets.
The sample code given below is developed for the case of moving a ticket from one department to another within a team. Similarly, you can create your own custom actions, which can be accessed in the event of extension installation.

  • Navigate to the Sigma website.
  • Open resources.json file of corresponding extension, and enter JSON for the Custom Actions and Targets respectively as given.
  • Click Save.

Sample Custom Actions and Targets

Copied {
     "customActions" : [{
        "inputFields": [
            {
                "mappingTargetTemplateName": "ticketId",
                "displayName": "Record ID",
                "length": 200,
                "context": "tickets",
                "type": "LOOKUP",
                "isMandatory": true,
                "isPlaceHolderNeeded": true
            },
            {
                "mappingTargetTemplateName": "departmentId",
                "displayName": "Department Name",
                "values": [
                    {
                        "prompt": "Development",
                        "value": "31138090000107405"
                    },
                    {
                        "prompt": "Testing",
                        "value": "31138090000114085"
                    },
                    {
                        "prompt": "Released",
                        "value": "31138090000578044"
                    }
                    ],
        "valueUrl" : "https://www.example.com/api/v1/valueUrl?orgId={{DESK.CURRENT_ORG}}&customActionId=$/{CUSTOM_ACTION_ID}&event=$/{EVENT}&fieldValue=$/{FIELD_VALUE}&mappingTargetTemplateName=$/{MAPPING_TARGET_TEMPLATE_NAME}&mappingId=$/{MAPPING_ID}&page=$/{PAGE}&limit=$/{LIMIT}&departmentId=$/{DEPARTMENT_ID}&searchValue=$/{SEARCH_VALUE}"
                length": 200,
                type": "PICKLIST",
                hooks": [],
                isMandatory": true,
                isPlaceHolderNeeded": false
            }],
        "outputFields": [
            {
                displayName": "Ticket Id",
                type": "LOOKUP",
                jsonPointerPath": "/id",
                length": 30,
                context": "tickets"
            },
           {
                "displayName": "Department Name",
                "type": "PICKLIST",
                "jsonPointerPath": "/name",
                "length": 30,
                "context": "departments"
          }],
                "targetId": "{{RESOURCE.moveTicketAPI}}",
                "secondaryTargetIds": [],
                "customActionName": "Move Ticket",
                "resourceName": "moveTicket"
            }],
        "targets" : [
            {
                "headers": "{"orgId":"{{DESK.CURRENT_ORG}}"}",
                "targetName": "Move a ticket to another department",
                "resourceName": "moveTicketAPI",
                "connectionName": "",
                "httpMethod": "POST",
                "url": "{{DESK.CURRENT_DOMAIN_URL}}/api/v1/tickets/$/{ticketId}/move",
                "targetTemplate": "{\"departmentId\":\"${departmentId\"}}"            
            }]
        }