Auto Launch Jira Creation Process

Published Date: 05-08-2024

Read Time:

Jira issues can be created automatically with the help of Process builder or Apex code/Triggers. We use the ‘Jira Field-Salesforce Field mapping’ and ‘Default values’—configured in Admin Settings (Field Configuration)—for auto-creation of Jira issues. The process picks the field values in the following ways:

  1. If the Jira field is mapped with the Salesforce object field, the field value of Salesforce record is pulled.
  2. If the Jira field is not mapped with Salesforce object field but default values are provided, the process pulls the value from the given default value in the configuration.
  3. If the Jira field is neither mapped with Salesforce object field and nor has a default value, the value will be left blank. In case if any of such fields are mandatory, the process would not be able to create Jira. Therefore, make sure the accurate data is available before the Jira creation process fires.

1. Firing an auto-create process using process builder

  1. Create a process builder using the appropriate object and launching criteria
  2. Add criteria for when Jira should be created.
  3. Under immediate actions for your criteria, Click ‘Add Actions’.
  4. Select ‘Apex’ from the dropdown list.
  5. Name the action.
  6. Enter ‘Grz_Sf__AutoCreateJira’ in Apex class.
  7. Set the Apex variables.
  8. Select ‘SobjectId_Project_Type_instance’ .
  9. Select the formula type.
  10. Build a formula to get the outcome value in the following manner
    Formula Outcome: SobjectId_Project_Type_instance

    Here:

    1. ‘SobjectId’ refers to the record Id through which a Jira issue should be created and linked.
    2. ‘Project’ refers to the key of the project for which a Jira issue needs to be created.
    3. ‘Type’ refers to the issue type.
    4. ‘instance’ refers to the instance number.

      Get Instance Number (Lightning User)

      • Select App Launcher.
      • Search for Admin Setting to bring the Admin Panel of Sinergify

      • Select Instances, to see the Instance details and respective Instance Number

      Get Instance Number (Classic User)

      • Click on Setup.
      • In the Search Box, type Custom Settings.
      • Look for JiraSalesforceDetails and Click on Manage in front of it. This will list down all the configured Jira Instances.
      • Click on the required Jira Instance and look for the InstanceNumber. This will provide you with the correct Instance number. See the below image for reference.

    Refer to the below example:

    5002w0000027IE8AAM_GC_Bug_1001

  11. Assuming you can get all needed information from the Salesforce record itself, you can build this using a formula in process builder.

2. Automatic Jira issue creation using apex class/trigger

In your apex class/trigger, use the Sinergify method to create Jira automatically. We have to pass specific parameters in the following method in order to create Jira successfully.

Find the details below:

Copy
// Method Name 
                    Grz_Sf.AutoCreateJira.AutoCreateJira(List<String> SobjectDetail);
                

‘SobjectDetail’ will be the list of strings. Each element of the string should be in the following structure:

List<SobjectId_Project_Type_instance>

Here:

  1. ‘SobjectId’ refers to the record Id through which a Jira issue should be created and linked.
  2. ‘Project’ refers to the key of the project for which a Jira issue needs to be created.
  3. ‘Type’ refers to the issue type.
  4. ‘instance’ refers to the instance number.

    Get Instance Number (Lightning User)

    • Select App Launcher.
    • Search for Admin Setting to bring the Admin Panel of Sinergify

    • Select Instances, to see the Instance details and respective Instance Number

    Get Instance Number (Classic User)

    • Click on Setup.
    • In the Search Box, type Custom Settings.
    • Look for JiraSalesforceDetails and Click on Manage in front of it. This will list down all the configured Jira Instances.
    • Click on the required Jira Instance and look for the InstanceNumber. This will provide you with the correct Instance number. See the below image for reference.

Refer to the below-given examples:

List<String> SobjectDetail =new List<String>();
SobjectDetail.add(‘500003132100001_GC_Bug_1001’);
SobjectDetail.add(‘500003132100002_GC_Bug_1001’);
SobjectDetail.add(‘500003132100003_GC_Task_1001’);
SobjectDetail.add(‘500003132100004_GC_Bug_1001’);