Zoho BugTracker Integration

Zoho BugTracker is an online bug tracking tool that helps you record, track and fix bugs identified in your software. It allows you to automate the bug fixing process with custom workflows, business rules, and SLAs, track critical bugs with custom views and dashboards, use interactive modules for collaboration, log timesheets, set up automated notifications, analyze your team performance with reports, and more.

You can integrate Zoho BugTracker with ServiceDesk Plus Cloud to implement software projects in Zoho BugTracker via the change module in ServiceDesk Plus Cloud. You can also raise bugs in Zoho BugTracker based on the incident requests in ServiceDesk Plus Cloud.

Integrate Zoho BugTracker with ServiceDesk Plus Cloud 

The integration between Zoho BugTracker and ServiceDesk Plus Cloud enables the following functionalities:


To set up the integration, Zoho BugTracker APIs are used to create scripts that can be used to configure and enable the required functionalities by creating necessary custom functions, triggers, custom module, change templates, and a custom menu.

 Step 1: Set up a Connection to Zoho BugTracker 

  1. Go to Setup > Developer Space > Connections > Default Services.

  2. Locate and click Zoho Oauth and then click Create Connection.

  3. Provide a connection name and link name.

  4. Select the ZohoBugTracker.projects.ALL and ZohoBugTracker.bugs.ALL scopes.

  5. Finally, click Create and Connect.

 

 

 Step 2: Create a Global Variable Using the Portal Name

To use the personal access token obtained from Zoho BugTracker in custom scripts, a global variable must be created as described below:

  1. Go to Setup > Developer Space > Global Variables.

  2. Click New Group.

  3. Provide a name and description.

  4. Create the following variables and add the respective values.

Variable

Value

PortalName

Provide the Zoho BugTracker portal name.

  1. Finally, click Save.

 

 

Note: The variable names used here should match the names used in the custom functions. If you are using the default custom function scripts, use the names mentioned in the above table.

 Step 3: Build a Functionality to Create Projects in Zoho BugTracker 

To automate project creation in Zoho BugTracker via ServiceDesk Plus Cloud, create a custom function with Zoho BugTracker APIs and invoke it in the appropriate change requests via triggers.

  1. Go to Setup > Developer Space > Custom Functions.

  2. Click New custom function.

  3. Provide a name and description for the custom function and copy the script below to the code editor. 

    Create a Project in Zoho BugTracker from Change Request

    try 
    {
        sdp_portal_name = context.get("instance");
        input_data = {"input_data":{"list_info":{"search_criteria":{"field":"name","condition":"is","value":"ZohoBugTracker"}}}};
        response = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/global_variable_groups"
            type :GET
            parameters:input_data
        ];
        global_variable_id = response.get("global_variable_groups").get(0).get("id");
        get_global_variable_group = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/global_variable_groups/" + global_variable_id
            type :GET
        ];
        variables = get_global_variable_group.get("global_variable_group").get("variables");
        portal_name = null;
        personal_access_token = null;
        for each  variable in variables
        {
            if(variable.get("name") == "PortalName")
            {
                portal_name = variable.get("value");
                break;
            }
        }
        change_id = changeObj.get("id");
        change_desc = changeObj.get("description");
        input_data = {"name":changeObj.get("title")};
        if(change_desc != null)
        {
            input_data.put("description",change_desc);
        }
        response = invokeurl
        [
            url :"https://bugtracker.localzoho.com/restapi/portal/" + portal_name + "/projects/"
            type :POST
            parameters:input_data
            connection:"zohobugtracker"
        ];
        project_id = response.get("projects").get(0).get("id");
        params = {"input_data":{"cm_zoho_bugtracker":{"cm_attributes":{"txt_name":toString(project_id),"txt_change_id":change_id}}}};
        store_project_id = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/cm_zoho_bugtracker"
            type :POST
            parameters:params
        ];
        info store_project_id;
    }
    catch (e)
    {
        info e;
    }
    return;


  1. Click, Save.

  2. Go to Setup > Developer Space > Custom Modules.

  3. Click New.

  4. Under the Details tab, provide name and its plural form. A default API name will be generated. Click Save and go to the Fields tab.

  5. Now a single-line, mandatory, unique field with name "Change Id". By default, the Zoho BugTracker Project Name field is included in the custom module.

  6. Click Save.

 

  1. Go to Setup > Automation > Triggers > Triggers for Changes.

  2. Click New Trigger.

  3. Provide a name and description for the change trigger.

  4. Set Execute when a Change is to Edited.

  5. Set Execute during to Anytime.

  6. Configure the conditions when you want to create Zoho BugTracker Project automatically. For example, you can configure the trigger to be applied when the change request is moved to the Implementation stage for specific change templates.

  7. Select the custom function created the trigger action.

  8. Finally, click Save.
     


A project in Zoho BugTracker will be created automatically from a change request when the conditions configured in the trigger are met. The project name will be the same as the name of the change request from which it was created.

 Step 4: Build a Functionality to View Zoho BugTracker Projects in Change Requests 

You can view Zoho BugTracker project in the respective change request from which it is created, by building functionality using custom widgets.  

  1. Download the custom widget.

  2. Go to Setup > Developer Space > Custom Widgets.

  3. Click New Custom Widget.

  4. Provide name and description.

  5. Upload the custom widget file (.zip) downloaded from step 1.

  6. Set the Hosting to Sigma Server.

  7. Finally, click Save.

 

When a Zoho BugTracker project is automatically created from a change request, a sub-tab showing the project details will be added to the configured change stage. You can customize the stage in which the tab appears by selecting your preferred stages by expanding the widget details under Setup > Developer Space > Custom Widgets. 

 

Sample:
 


 

 

 Step 5: Build a Functionality to Raise a bug in Zoho BugTracker Projects from an Incident Requests 

By building a functionality with custom menu, you can use ServiceDesk Plus Cloud to raise bugs in Zoho BugTracker projects that were created from change requests. This functionality allows you to report bugs from incident requests that are associated with the change request used to create Zoho BugTracker DevOps project.

  1. Go to Setup > Developer Space > Custom Functions.

  2. Click New custom function.

  3. Provide a name and description for the custom function and copy the script below to the code editor. 

    Create a Bug in Zoho BugTracker from Incident Requests

    try 
    {
        sdp_portal_name = context.get("instance");
        input_data = {"input_data":{"list_info":{"search_criteria":{"field":"name","condition":"is","value":"ZohoBugTracker"}}}};
        response = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/global_variable_groups"
            type :GET
            parameters:input_data
        ];
        global_variable_id = response.get("global_variable_groups").get(0).get("id");
        get_global_variable_group = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/global_variable_groups/" + global_variable_id
            type :GET
        ];
        variables = get_global_variable_group.get("global_variable_group").get("variables");
        portal_name = null;
        personal_access_token = null;
        for each  variable in variables
        {
            if(variable.get("name") == "PortalName")
            {
                portal_name = variable.get("value");
                break;
            }
        }
        req_id = requestObj.get("id");
        req_desc = requestObj.get("description");
        get_change_details = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/requests/" + req_id + "/change_initiated_request"
            type :GET
        ];
        change = get_change_details.get("change_initiated_request");
        if(change == {})
        {
            return {"success":false,"message":"Please attach the change that initiated this request"};
        }
        get_project_id = zoho.sdp.invokeurl
        [
            url :"/app/" + sdp_portal_name + "/api/v3/cm_zoho_bugtracker"
            type :GET
            parameters:{"input_data":{"list_info":{"search_criteria":{"field":"cm_attributes.txt_change_id","value":change.get(0).get("change").get("id"),"condition":"is"},"fields_required":{"cm_attributes.txt_name"}}}}
        ];
        info get_project_id;
        bt_project_id = get_project_id.get("cm_zoho_bugtracker");
        if(bt_project_id == {})
        {
            return {"success":false,"message":"No Zoho Bug tracker project was created by the current associated change"};
        }
        bt_project_id = bt_project_id.get(0).get("cm_attributes").get("txt_name");
        input_data = {"title":requestObj.get("subject")};
        if(req_desc != null)
        {
            input_data.put("description",req_desc);
        }
        info bt_project_id;
        response = invokeurl
        [
            url :"https://bugtracker.localzoho.com/restapi/portal/" + portal_name + "/projects/" + bt_project_id.toString() + "/bugs/"
            type :POST
            parameters:input_data
            connection:"zohobugtracker"
        ];
        info response;
        return {"success":true,"message":"Issue created in Zoho Bug tracker Successfully"};
    }
    catch (e)
    {
        info e;
    }
    return Map();

  4. Click, Save.

 

  1. Go to Setup > Developer Space > Custom Menu > Custom Menu for Request.

  2. Click Add on the top-right and click New Menu Group.

  3. Provide a name and description for the menu group and set Status to Enable.

  4. Click Save.

 

  1. Click the name of the menu group created and click New Menu Item.

  2. Provide a name and description for the menu item, configure necessary conditions and status, and add the custom function configured in step 4 as the action.

  3. Finally, click Save.

 

 

With this configuration, an option to raise a bug in Zoho BugTracker project will be available under the Custom Actions drop-down on the request details page. If an incident request is associated with a change request that is tied to a Zoho BugTracker project, invoking this custom action will create a bug in the respective project; an error will be thrown in all other cases.