Create Custom Actions

How to create a 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 on the right demonstrates a use case where tags are added to a ticket. Similarly, you can create your own custom actions, which can be accessed in the event of extension installation.

To create a custom action,

  • Navigate to the Sigma website.
  • Open resources.json file of the corresponding extension, and add the JSON configuration for Custom Actions and Targets.
  • Click Save.
  • Publish and install the corresponding extension in your desk portal.

Sample Custom Actions and Targets

Copied{
    "customActions": [{
        "resourceName": "associateTagforTicket",
        "customActionName": "Add Tags via Extension",
        "targetId": "{{RESOURCE.TARGET.associateTagsToTicket.id}}",
        "inputFields": [{
                "displayName": "Ticket ID",
                "type": "TEXT",
                "mappingTargetTemplateName": "ticketId",
                "length": "50",
                "isMandatory": true,
                "isPlaceHolderNeeded": true
            },
            {
                "displayName": "Tag Name",
                "type": "TEXT",
                "mappingTargetTemplateName": "tagName",
                "length": "100",
                "isMandatory": true,
                "isPlaceHolderNeeded": true
            }
        ],
        "outputFields": [],
        "secondaryTargetIds": []
    }],
    "targets": [{
        "headers": "{\"orgId\":\"{{DESK.CURRENT_ORG}}\"}",
        "targetName": "Associate Tags for the Ticket",
        "resourceName": "associateTagsToTicket",
        "connectionName": "",
        "httpMethod": "POST",
        "url": "{{DESK.CURRENT_DOMAIN_URL}}/api/v1/tickets/${ticketId}/associateTag",
        "targetTemplate": "{\"tags\":[\"${tagName}\"]}"
    }]
}