Skip to main content
Skip table of contents

zAgileConnect API – Sending Attachments to JIRA Issues from Salesforce – Usage & Examples

Available with zAgileConnect v1.9

Requires the user executing the API to have a valid zAgileConnect license

Build attachments reference array.

zAgileConnect supports three types of files for sending to Jira Issue:

  • ContentDocument,
  • Document, and
  • Attachment.

To send files to Jira Issue, create an array of the class ZCBeans.SalesforceAttachment as follows:

CODE
List<zsfjira.ZCBeans.SalesforceAttachment> attachments = new List<zsfjira.ZCBeans.SalesforceAttachment>();

The instance of ZCBeans.SalesforceAttachment contains the File ID and the Issue Key (or issue keys) where you want to send the file.

To send to a single Issue:

CODE
Id fileId = ...;
String issueKey = ...;
zsfjira.ZCBeans.SalesforceAttachment attachment = new zsfjira.ZCBeans.SalesforceAttachment(fileId,issueKey);

To send to multiple Issues:

CODE
Id fileId = ...;
Set<String> issueKeys = ...;
zsfjira.ZCBeans.SalesforceAttachment attachment = new zsfjira.ZCBeans.SalesforceAttachment(fileId,issueKeys);

The ID should be of an object of type ContentDocument, Document or Attachment.

Sending Attachments to JIRA

The Send request is an asynchronous task and a response is posted following completion. You may specify an ID of the object where you want any errors to be posted.

CODE
Id onErrorEntityID = ...; 
List<zsfjira.ZCBeans.SalesforceAttachment> attachments = ...;
zsfjira.ZC.Issues.sendAttachments(onErrorEntityID, attachments);

Validate Successful Request:

The method ZC.Issues.sendAttachments returns the result of the operation

CODE
...
zsfjira.ZCBeans.AttachmentRequestResult requestResult = zsfjira.ZC.Issues.sendAttachments(onErrorEntityID, attachments);
if(requestResult.hasError()){
	System.debug(System.LoggingLevel.ERROR,requestResult.getErrorMessage());
}
JavaScript errors detected

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

If this problem persists, please contact our support.