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
  • Attachment

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

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

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:

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

To send to multiple Issues:

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

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.

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

Validate Successful Request:

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

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