Auto-Create Jira via Salesforce

  • Category : Automations
  • Article Number : 11
  • Publish Date: 22 Dec, 2023

Objective

  • To understand the importance of automation in Salesforce Jira integration such as one click escalation from Salesforce to the engineering team, or how to auto create Jira if needed.

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 the auto-creation of Jira issues. The Autolaunch Jira Creation Process can be done in three ways:

  1. Firing an auto-create process using the Process Builder.

  2. Automatic Jira issue creation using Apex Class/Trigger.

  3. Auto-launching Jira creation process using Flow Builder.

  • Firing an Auto-create Process Using the 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 the 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

  • “SobjectId” refers to the record Id through which a Jira issue should be created and linked.

  • “Project” refers to the key of the project for which a Jira issue needs to be created.

  • “Type” refers to the issue type.

  • “Instance” refers to the instance number.

Refer to the below example:5002w0000027IE8AAM_GC_Bug_1001

Note: Once you get all the needed information from the Salesforce record, you can build this using a formula in the Process Builder.

  • Automatic Jira Issue Creation Using the Apex Class or 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:

    // 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>

  1. Select the App Launcher

  2. Search for ”Admin Settings” to ring up the Admin Panel of “Sinergify”

  3. Select “Instances”, to see the Instance details and respective Instance numbers

Get Instance Number (Classic User)

  1. Click on Setup.

  2. In the search box, type “Custom Settings”.

  3. Look for JiraSalesforceDetails and click on “Manage” in front of it. This will list down all the configured Jira Instances.

  4. Click on the required Jira Instance and look for the Instance number. This will provide you with the correct Instance number. See the image given below for reference.

  • Autolaunching Jira creation process using Flow builder:

  1. Log in to your Salesforce Org as an Admin.

  2. From Setup, enter “Flows” into the Quick Find box, select Flows, and then click New Flow.

  3. Select “Record Triggered Flow” from the available options.

  4. Under select “Object” whose records trigger the flow when they’re created, updated, or deleted.

  5. Under Configure the flow select “A record is created”, Leave Set Entry conditions as “None”.

  6. Under option Optimize the flow select “Action and Related Records”.

  7. Click “Done”.

  8. Click (+) Icon to add the “Action”.

  9. Search for “Grz_Sf__AutoCreateJira”.

  10. Fill the “label” and “Set input values” and Click “Done”.

  11. The final flow will look like the below screenshot: