Skip to main content
Skip table of contents

Using custom buttons in Salesforce to interface with JIRA

There are three custom buttons you can add in Salesforce to make using the CRM plugin more convenient.  These buttons give you the following functionality from your Salesforce screen.

  • Create (or update) a JIRA issue from a CRM record.  This button is used along with or in place of the plugin's cron service to sync data from Salesforce to JIRA.
  • Link a CRM record to an existing JIRA issue allowing multiple CRM records to be linked to a single JIRA issue
  • Display a table showing issue data from JIRA for issues currently linked to a CRM record (for example: Account, Contact or Case)

Creating or updating a JIRA Issue from a Salesforce Case

You can place a button on your Salesforce Case screen to manually sync the current Case to JIRA.  The first time you use this button a new Issue will be created in JIRA and linked to your Case.  After the Case has been linked to JIRA, clicking the button will update the Issue with any new data from the Case.

The URLs shown below use the https protocol, if you need to use http then you have to turn off the CRM plugin setting "Require secure connections (HTTPS)". You can find this setting in JIRA on the "CRM Setup" -> "Advanced Settings" screen.

For Salesforce Classic

In Salesforce, go to "Setup" -> "Customize" -> "Cases" -> "Buttons, Links, and Actions".
In the "Custom Buttons and Links" section at the bottom of the page, add a new button, name it something like "Create/Update JIRA", use the following URL for the button's definition  (the large text area field of the screen).
I suggest setting the Behavior to "Display in new window" but you may set this however you prefer.
After you save the custom button you need to place the button on the screen layout for your Case screen.
You can do this by going to "Setup" -> "Customize" -> "Cases" -> "Page Layouts" and editing one or more of the Case Page Layouts.

For Salesforce Lightning

In Salesforce, go to "Setup" -> "Objects and Fields" -> "Object Manager" -> "Case" -> "Buttons, Links, and Actions".
Click the "New Button or Link" button in the upper right corner of the screen.
For the Label, use something like "Create/Update JIRA", and use the following URL for the button's definition (the large text area field of the screen).
I suggest setting the Behavior to "Display in new window" but you may set this however you prefer.
After you save the custom button you need to place the button on the screen layout for your Case screen.
You can do this by selecting the "Case Page Layouts" link on the left side of the screen and then editing one or more of the Case Page Layouts.

https://JIRA-HOST/plugins/servlet/create-issue?crmtoken=TOKEN&id={!Case.Id}

Replace JIRA-HOST with the value appropriate for your JIRA server.  The value for TOKEN can be found in JIRA on your "CRM Setup" screen.

If you are using an older version of the plugin (prior to v4.0) you will need to use this URL:

https://JIRA-HOST/plugins/servlet/create-issue?jira_user=JIRA-USERNAME&pwd=JIRA-PASSWORD&id={!Case.Id}

Replace JIRA-HOST, JIRA-USERNAME and JIRA-PASSWORD with values appropriate for your JIRA server.


Linking/Unlinking a Salesforce Case to an existing JIRA Issue

You can also create another custom button for your Case screen which will link or unlink a CRM record to or from an existing JIRA issue (allowing multiple Cases to be linked to one JIRA issue). The URL for this button definition should look like this:

https://JIRA-HOST/plugins/servlet/link-issue?crmtoken=TOKEN&id={!Case.Id}

OR

https://JIRA-HOST/plugins/servlet/link-issue?jira_user=JIRA-USERNAME&pwd=JIRA-PASSWORD&id={!Case.Id}

Additional Arguments

Normally the JIRA fields updated from CRM are controlled by the plugin's "JIRA/CRM Field Mappings" setup screen.  But you can override one or more field mappings by adding additional arguments to the URL query string.  For example, adding "&My+Field=sneeches" will set the JIRA field named "My Field" to the value "sneeches" in addition to the other JIRA fields mapped on the "JIRA/CRM Field Mappings" setup screen.

There are also other special arguments that let you adjust the behavior of the create-issue function.

URL ArgumentBehavior
_always_createAdding this argument to the URL will cause the plugin to create a new JIRA issue even if there is already a JIRA issue linked to the CRM record.  This will only work if the plugin is configured to allow linking multiple JIRA issues to the same CRM record.
_always_promptWhen creating new issues, show the prompt screen to the CRM user even when the JIRA project is specified.
_mode=update

The plugin will not create new JIRA issues.  Only updates to JIRA issues already linked to CRM are allowed.

_mode=create

The plugin will only create new JIRA issues.  CRM records already linked to JIRA will not be sync'ed to JIRA.

_redirect-to-jiraWhen this argument is added to the URL the plugin will redirect the user's browser directly to the JIRA screen of the issue just created or updated.  Note this normally requires the CRM user to have an account in JIRA.
_ignore

Some CRM systems add extra arguments to URLs that the CRM plugin doesn't recognize.  Use this option to tell the plugin to ignore these URL arguments.  The default for Salesforce is: "_ignore=isdtp,nonce,sfdcIFrameOrigin"

_close-window-on-successAny external window used to display the results of the sync from CRM to JIRA will automatically be closed unless there is an error message to display.
_suppress-return-to-linkNever show the "Return to Case" link at the bottom of the results window.

Using Salesforce objects other than Case

You can use custom buttons to copy data from Salesforce objects other than Cases.  Define the custom button as just described except place it on the view screen for that object and use the following URL as the button's definition.

https://JIRA-HOST/plugins/servlet/link-issue?crmtoken=TOKEN&id=OBJECT_NAME:{!OBJECT_NAME.Id}

For example, if your JIRA host name is "jira.acme.com", your URL Security Token from the plugin's "Initial Setup" screen is "e0E9eOmvId2H" and your CRM object is "my_custom_obj__c" the URL would be:
https://jira.acme.com/plugins/servlet/link-issue?crmtoken=e0E9eOmvId2H&id=my_custom_obj__c:{!my_custom_obj__c.Id}


Salesforce Account/Contact Screen buttons

On your Account and Contact screens in Salesforce you can create a custom button which will display all JIRA issues linked to that Account or Contact.

On your Account screen in Salesforce create a button with this URL as its definition

https://JIRA-HOST/plugins/servlet/crm-info?crmtoken=TOKEN&account={!Account.Id}

OR

https://JIRA-HOST/plugins/servlet/crm-info?jira_user=JIRA-USERNAME&pwd=JIRA-PASSWORD&account={!Account.Id}

and on your Contact screen create a button with this URL as its definition

https://JIRA-HOST/plugins/servlet/crm-info?crmtoken=TOKEN&contact={!Contact.Id}

OR

https://JIRA-HOST/plugins/servlet/lcrm-info?jira_user=JIRA-USERNAME&pwd=JIRA-PASSWORD&contact={!Contact.Id}

The crm-info screen can be customized. See Using the crm-info servlet for details.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.