Skip to main content
Skip table of contents

zAgileConnect API Reference (Operations)

ZC Classes

ZC.IssueApi Class


global with sharing class IssueApi extends ZC

Methods


global List<ZCBeans.IssueUpsertResult> bulkCreateIssues(List<ZCBeans.IssueTemplate> lstIssues)

Creates multiple issues from a list of templates.

Parameters

List<ZCBeans.IssueTemplate> lstIssues List of templates representing the issues to be created.

Return Value

A list of results corresponding to each template in the input.

Example

CODE
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = new List<zsfjira.ZCBeans.IssueTemplate>();
...
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate(Id.valueOf('500i000000weOJe'));
...
lstIssues.add(issue);
...
zsfjira.ZCBeans.IssueTemplate issue2 = new zsfjira.ZCBeans.IssueTemplate(Id.valueOf('500i000000weAjo'));
...
lstIssues.add(issue);
...
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.bulkCreateIssues(lstIssues);

global List<ZCBeans.IssueUpsertResult> bulkUpdateIssues(List<ZCBeans.IssueTemplate> lstIssues)

Updates multiple JIRA issues from a list of templates.

Parameters

List<ZCBeans.IssueTemplate> lstIssues List of templates representing the issues to be updated.

Return Value

A list of results corresponding to each template of the input.

Example

CODE
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = new List<zsfjira.ZCBeans.IssueTemplate>();
...
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate('SEL-100');
...
lstIssues.add(issue);
...
zsfjira.ZCBeans.IssueTemplate issue2 = new zsfjira.ZCBeans.IssueTemplate('SEL-101');
...
lstIssues.add(issue);
...
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.bulkUpdateIssues(lstIssues);

global ZCBeans.IssueUpsertResult createIssue(ZCBeans.IssueTemplate issue)

Creates an issue from a template. This method must only be used for creating a single issue. For creating multiple issues, please refer to bulkCreateIssues.

Parameters

ZCBeans.IssueTemplate issue Issue template representing the issue to be created.

Return Value

An object containing Issue key on successful execution or errors

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate(Id.valueOf('500i000000wg9bS'));
...
zsfjira.ZCBeans.IssueUpsertResult iresult = zsfjira.ZC.Issues.createIssue(issue);
if(iresult.hasError()){
	for(String errorMessage:iresult.getErrorMessages()){
		System.debug(System.LoggingLevel.ERROR,errorMessage);
	}
}else{
	System.debug(System.LoggingLevel.INFO,iresult.getIssueKey());
}

global ZCBeans.IssueCommentResult createJIRAIssueComment(String issueKeyOrId, String comment)

Create comment in JIRA issue.

Parameters

String issueKeyOrId The JIRA Issue key or Id
String comment Comment body.

Return Value

The result of the operation.

Example

CODE
ZCBeans.IssueCommentResult result = zsfjira.Issues.createJIRAIssueComment('SEL-118','Comment test');

global ZCBeans.IssueDeleteResult deleteIssue(String issueKey, Id entityId)

Delete a JIRA Issue created from a Salesforce entity.

Parameters

String issueKey The JIRA issue key.
Id entityId The Salesforce entity Id

Return Value

Result of the Delete operation.

Example

CODE
zsfjira.ZC.Issues.deleteIssue('TP-1',Id.valueOf('5000H00000xLWAd'));

global List<ZCBeans.IssueDeleteResult> deleteIssues(Set<String> selectedIssueKeys, Id entityId)

Delete a list of JIRA Issues created from a Salesforce entity.

Parameters

Set<String> selectedIssueKeys The JIRA issues to be deleted.
Id entityId The Salesforce entity Id.

Return Value

List of results of the Delete operation.

Example

CODE
Set<String> issueKeys=new Set<String>();
issueKeys.add('TP-1');
issueKeys.add('TP-6');
issueKeys.add('TP-7');
List<zsfjira.ZCBeans.IssueLinkUnlinkResult> results = zsfjira.ZC.Issues.deleteIssues(issueKeys,Id.valueOf('5000H00000xLWAd'));

global ZCBeans.AvailableTransitionsResult getAvailableTransitions(String issueKey)

Retrieves available Issue Transitions

Parameters

IssueKey Issue Key

Return Value

ZCBeans.AvailableTransitionsResult

Example

CODE
ZCBeans.AvailableTransitionsResult availableTransitionsResult =  ZC.Issues.getAvailableTransitions('SEL-1019');

global ZCBeans.IssueLinkUnlinkResult linkIssue(String issueKey, Id entityId)

Links an issue to a specified Salesforce entity.

Parameters

String issueKey The JIRA issue key.
Id entityId The Salesforce entity Id.

Return Value

Result of the Link operation

Example

CODE
zsfjira.ZC.Issues.linkIssue('TP-1',Id.valueOf('5000H00000xLWAd'));

global List<ZCBeans.IssueLinkUnlinkResult> linkIssues(Set<String> selectedIssueKeys, Id entityId)

Links a list of JIRA Issues to a Salesforce entity.

Parameters

Set<String> selectedIssueKeys The JIRA issues to be linked.
Id entityId The Salesforce entity Id.

Return Value

List of results of the Link operation.

Example

CODE
Set<String> issueKeys=new Set<String>();
issueKeys.add('TP-1');
issueKeys.add('TP-6');
issueKeys.add('TP-7');
List<zsfjira.ZCBeans.IssueLinkUnlinkResult> results = zsfjira.ZC.Issues.linkIssues(issueKeys,Id.valueOf('5000H00000xLWAd'));

global void postCreateIssueErrorMessage(String errorMessage, ZCBeans.IssueUpsertResult issue)

Post errors of a single issue creation event to its related Salesforce entity.

Parameters

String errorMessage A prefix concatenated with the error messages.
ZCBeans.IssueUpsertResult issue The result from a create or validate operation (only error messages will be posted)

Example

CODE
zsfjira.ZCBeans.IssueUpsertResult iresult = zsfjira.ZC.Issues.createIssue(issue);
zsfjira.ZC.Issues.postCreateIssueErrorMessage('Invalid Input',iresult);

global void postCreateIssueErrorMessage(ZCBeans.IssueUpsertResult issue)

Post errors of a single issue create to its related Salesforce object.

Parameters

ZCBeans.IssueUpsertResult issue The result from a create or validate operation (only error messages will be posted)

Example

CODE
zsfjira.ZCBeans.IssueUpsertResult iresult = zsfjira.ZC.Issues.createIssue(issue);
zsfjira.ZC.Issues.postCreateIssueErrorMessage(iresult);

global void postCreateIssueErrorMessages(String errorMessage, List<ZCBeans.IssueUpsertResult> lstIssues)

Post errors of multiple issue creation events to their relates Salesforce entities.

Parameters

String errorMessage A prefix concatenated with the error messages.
List<ZCBeans.IssueUpsertResult> lstIssues The results from a bulk create or validate operation (only error messages will be posted)

Example

CODE
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.bulkCreateIssues(lstIssues);
zsfjira.ZC.Issues.postCreateIssueErrorMessages('Invalid Input',iresults);

global void postCreateIssueErrorMessages(List<ZCBeans.IssueUpsertResult> lstIssues)

Post errors of multiple issue creation events to their relates Salesforce entities.

Parameters

List<ZCBeans.IssueUpsertResult> lstIssues The results from a bulk create or validate operation (only error messages will be posted)

Example

CODE
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.bulkCreateIssues(lstIssues);
zsfjira.ZC.Issues.postCreateIssueErrorMessages(iresults);

global void postErrorMessage(Id entityId, ZCBeans.IssueLinkUnlinkDeleteResult iresults)

Post errors from the result of single link, unlink or delete operation to a target Salesforce entity.

Parameters

Id entityId The entity where the errors are going to be posted.
ZCBeans.IssueLinkUnlinkDeleteResult iresult Result from link, unlink or delete operation (only error messages will be posted)

Example

CODE
Id caseId = Id.valueOf('5000H00000zdi30');
zsfjira.ZCBeans.IssueLinkUnlinkResult result = zsfjira.ZC.Issues.linkIssue('JP-1',caseId);
zsfjira.ZC.Issues.postErrorMessages(caseId,result);

global void postErrorMessages(Id entityId, List<ZCBeans.IssueLinkUnlinkDeleteResult> iresults)

Post errors from results of link, unlink or delete operations to a target Salesforce entity.

Parameters

Id entityId The entity where the errors are going to be posted.
List<ZCBeans.IssueLinkUnlinkDeleteResult> iresults Results from link, unlink or delete operations (only error messages will be posted)

Example

CODE
List<zsfjira.ZCBeans.IssueLinkUnlinkResult> results = zsfjira.ZC.Issues.linkIssues(issueKeys,Id.valueOf('5000H00000xLWAd'));
zsfjira.ZC.Issues.postErrorMessages(Id.valueOf('5000H00000zdi30'),results);

global void postErrorMessages(List<ZCBeans.GenericErrorMessage> errorMessages)

Post errors from a List containing a list of ZCBeans.GenericErrorMessage built by the user.

Parameters

List<ZCBeans.GenericErrorMessage> errorMessages, the error messages, each element contains the error and the target(entity Id where it must be posted)

Example

CODE
List<ZCBeans.GenericErrorMessage> errorMessages = new List<ZCBeans.GenericErrorMessage>();
postErrorMessages

global void postErrorMessagesToEntity(Id entityId, String errorMessage, List<ZCBeans.IssueUpsertResult> lstIssues)

Post errors of multiple issue update events to a target entity Id.

Parameters

Id entityId The target entity.
String errorMessage A prefix concatenated with the error messages.
List<ZCBeans.IssueUpsertResult> lstIssues The results from a bulk update or validate operation (only error messages will be posted)

Example

CODE
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.bulkUpdateIssues(lstIssues);
zsfjira.ZC.Issues.postErrorMessagesToEntity(Id.valueOf('500i000000weOJe'),'Invalid Input',iresults);

global void postErrorMessagesToEntity(Id entityId, List<ZCBeans.IssueUpsertResult> lstIssues)

Post errors of multiple issue update events to a target entity Id.

Parameters

Id entityId The target entity.
List<ZCBeans.IssueUpsertResult> lstIssues The results from a bulk update or validate operation (only error messages will be posted)

Example

CODE
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.bulkUpdateIssues(lstIssues);
zsfjira.ZC.Issues.postErrorMessagesToEntity(Id.valueOf('500i000000weOJe'),iresults);

global void postErrorMessageToEntity(Id entityId, String errorMessage, ZCBeans.IssueUpsertResult issue)

Post errors of a single issue update

Parameters

Id entityId The target entity.
String errorMessage A prefix concatenated with the error messages.
ZCBeans.IssueUpsertResult issue The result from an update or validate operation (only error messages will be posted)

Example

CODE
zsfjira.ZCBeans.IssueUpsertResult iresult = zsfjira.ZC.Issues.updateIssues(issue);
zsfjira.ZC.Issues.postErrorMessageToEntity(Id.valueOf('500i000000weOJe'),'Invalid Input',iresult);

global void postErrorMessageToEntity(Id entityId, ZCBeans.IssueUpsertResult issue)

Post errors of a single issue update

Parameters

Id entityId: the target entity
ZCBeans.IssueUpsertResult issue The result from an update or validate operation (only error messages will be posted)

Example

CODE
zsfjira.ZCBeans.IssueUpsertResult iresult = zsfjira.ZC.Issues.updateIssues(issue);
zsfjira.ZC.Issues.postErrorMessageToEntity(Id.valueOf('500i000000weOJe'),iresult);

global ZCBeans.AttachmentRequestResult sendAttachments(Id onErrorEntityID, List<ZCBeans.SalesforceAttachment>attachments)

Perform a request to JIRA to download the given Salesforce file(s).

Parameters

Id onErrorEntityID The entity where the error messages will be posted.
List<ZCBeans.SalesforceAttachment> attachments A list of files.

Return Value

Result of the request (result of the download will be posted to the onErrorEntityID once the operation is completed)

Example

CODE
Id fileId = Id.valueOf('0690H00000392W8');
String issueKey = 'SEL-118';
zsfjira.ZCBeans.SalesforceAttachment attachment = new zsfjira.ZCBeans.SalesforceAttachment(fileId,issueKey);
...
zsfjira.ZCBeans.AttachmentRequestResult requestResult = zsfjira.ZC.Issues.sendAttachments(Id.valueOf('5000H00000xLWAd'), attachments);

global void setApiOptions(ZCBeans.ApiOptions options)

Defines the global options to be applied in subsequent zAgileConnect API calls in the current transaction

Parameters

ZCBeans.ApiOptions options, object that holds the options

Example

CODE
zsfjira.ZCBeans.ApiOptions options= new zsfjira.ZCBeans.ApiOptions();
options.userImpersonate = false;
zsfjira.ZC.Issues.setApiOptions(options);

global ZCBeans.TransitionIssueResult transitionIssue(String issueKey, ZCBeans.TransitionIssueBean transitionIssueBean)

Performs an Issue transition

Parameters

IssueKey Issue Key
transitionIssueBean Transition and its fields and comment data

Return Value

ZCBeans.TransitionIssueResult

Example

CODE
ZCBeans.AvailableTransitionsResult availableTransitionsResult =  ZC.Issues.getAvailableTransitions('SEL-1019');
ZCBeans.TransitionIssueBean transitionIssueBean = availableTransitionsResult.buildIssueTransitionFromName('Stop Progress');
ZCBeans.TransitionIssueResult transitionIssueResult = ZC.Issues.transitionIssue('SEL-1019', transitionIssueBean);

global ZCBeans.IssueLinkUnlinkResult unlinkIssue(String issueKey, Id entityId)

Unlink a JIRA Issue from a Salesforce entity.

Parameters

String issueKey The JIRA issue key.
Id entityId The Salesforce entity Id.

Return Value

The results of the Unlink operation.

Example

CODE
zsfjira.ZC.Issues.unlinkIssue('TP-1',Id.valueOf('5000H00000xLWAd'));

global List<ZCBeans.IssueLinkUnlinkResult> unlinkIssues(Set<String> selectedIssueKeys, Id entityId)

Unlink a list of JIRA Issues from a Salesforce entity.

Parameters

Set<String> selectedIssueKeys The JIRA issues to be unlinked.
Id entityId The Salesforce entity Id.

Return Value

List of results of the Unlink operation.

Example

CODE
Set<String> issueKeys=new Set<String>();
issueKeys.add('TP-1');
issueKeys.add('TP-6');
issueKeys.add('TP-7');
List<zsfjira.ZCBeans.IssueLinkUnlinkResult> results = zsfjira.ZC.Issues.unlinkIssues(issueKeys,Id.valueOf('5000H00000xLWAd'));

global ZCBeans.IssueUpsertResult updateIssue(ZCBeans.IssueTemplate issue)

Update an issue from a template. This method must only be used for updating a single issue. For updating multiple issues, please refer to bulkUpdateIssues.

Parameters

ZCBeans.IssueTemplate issue The issue template that represents the issue to be updated.

Return Value

An object containing success or error list.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate(Id.valueOf('500i000000wg9bS'));
...
zsfjira.ZCBeans.IssueUpsertResult iresult = zsfjira.ZC.Issues.updateIssue(issue);

global ZCBeans.IssueCommentResult updateJIRAIssueComment(String issueKeyOrId, String issueCommentId, String comment)

Update a JIRA Issue comment.

Parameters

String issueKeyOrId The JIRA Issue key or Id.
String issueCommentId The Comment Id.
String comment: Comment body.

Return Value

The result of the operation.

Example

CODE
ZCBeans.IssueCommentResult result = ZC.Issues.updateJIRAIssueComment('SEL-118','12693','Comment test(edited)');

global List<ZCBeans.IssueUpsertResult> validateAndSanitizeBulkCreateIssuesInput(List<ZCBeans.IssueTemplate> lstIssues)

Validates a list of issue templates to be created and sanitizes fields not referenced in the issue metadata.

Parameters

List<ZCBeans.IssueTemplate> lstIssues List of templates representing the issues to be created.

Return Value

A list of results for each template containing appropriate errors or warnings based on the validation.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate(Id.valueOf('500i000000weOJe'));
...
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = new List<zsfjira.ZCBeans.IssueTemplate>();
lstIssues.add(issue);
...
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.validateAndSanitizeBulkCreateIssuesInput(lstIssues);

global List<ZCBeans.IssueUpsertResult> validateAndSanitizeBulkUpdateIssuesInput(List<ZCBeans.IssueTemplate> lstIssues)

Validates a list of issues templates to be updated. Sanitizes fields not referenced in the issue metadata.

Parameters

List<ZCBeans.IssueTemplate> lstIssues List of templates representing the issues to be updated

Return Value

A list of results for each template; each result may contain errors or warnings as a result of the validation.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate('SEL-120');
...
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = new List<zsfjira.ZCBeans.IssueTemplate>();
lstIssues.add(issue);
...
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.validateAndSanitizeBulkCreateIssuesInput(lstIssues);

global List<ZCBeans.IssueUpsertResult> validateBulkCreateIssuesInput(List<ZCBeans.IssueTemplate> lstIssues)

Validates a list of issues templates to be created.

Parameters

List<ZCBeans.IssueTemplate> lstIssues List of templates representing the issues to be created.

Return Value

A list of results for each template containing errors based on the validation.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate(Id.valueOf('500i000000weOJe'));
...
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = new List<zsfjira.ZCBeans.IssueTemplate>();
lstIssues.add(issue);
...
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.validateBulkCreateIssuesInput(lstIssues);

global List<ZCBeans.IssueUpsertResult> validateBulkUpdateIssuesInput(List<ZCBeans.IssueTemplate> lstIssues)

Validates a list of issue templates to be updated.

Parameters

List<ZCBeans.IssueTemplate> lstIssues List of templates representing the issues to be updated.

Return Value

A list of results for each template, each result may contain errors as a result of the validation.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = new zsfjira.ZCBeans.IssueTemplate('SEL-123');
...
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = new List<zsfjira.ZCBeans.IssueTemplate>();
lstIssues.add(issue);
...
List<zsfjira.ZCBeans.IssueUpsertResult> iresults = zsfjira.ZC.Issues.validateBulkUpdateIssuesInput(lstIssues);

ZC.IssueFactory Class

global with sharing class IssueFactory extends ZC

Methods


global ZCBeans.IssueTemplate buildCreateTemplateFromMapping(Id entityId)

Builds an Issue template from an entity Id. The resulting template is populated based on the mapped fields.

Parameters

Id entityId Entity from where it will extract the fields for building the issue template.

Return Value

The template populated with the entity fields.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = zsfjira.ZC.IssueFactory.buildCreateTemplateFromMapping(Id.valueOf('500i000000weOJe'));

global List<ZCBeans.IssueTemplate> buildCreateTemplateFromMapping(List<Id> entityIds)

Builds a list of templates from a list of entities. The returned list comprises of templates populated from their corresponding entities with the mapped fields.

Parameters

List<Id> entityIds The list of entities from where it will extract fields for building the templates.

Return Value

List of templates.

Example

CODE
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = zsfjira.ZC.IssueFactory.buildCreateTemplateFromMapping(new List<Id>{Id.valueOf('500i000000weOJe'),Id.valueOf('500i000000x8OJx')});

global ZCBeans.IssueTemplate buildUpdateTemplateFromMapping(String issueKey)

Builds a template from an existent issue using fields from its related Salesforce parent object based on the configured field mapping.

Parameters

String issueKey The JIRA issue that the method will use for building the template based on its related Salesforce parent object.

Return Value

A template containing issue fields populated from the corresponding Salesforce parent object. The method returns null if the issue was not created from Salesforce.

Example

CODE
zsfjira.ZCBeans.IssueTemplate issue = zsfjira.ZC.IssueFactory.buildUpdateTemplateFromMapping('SEL-102');

global List<ZCBeans.IssueTemplate> buildUpdateTemplateFromMapping(Set<String> issueKeys)

Builds a list of templates from a list of issues. The returned list comprises of templates populated with the mapped fields from the parent Salesforce objects.

Parameters

Set<String> issueKeys Issue keys that the method will use for building the templates based on their corresponding Salesforce entities.

Return Value

A list of templates containing issues populated with fields from the parent Salesforce objects. The method will not return templates for issues not created from Salesforce.

Example

CODE
List<zsfjira.ZCBeans.IssueTemplate>lstIssues = zsfjira.ZC.IssueFactory.buildUpdateTemplateFromMapping(new Set<String> {'SEL-102','SEL-103'});
JavaScript errors detected

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

If this problem persists, please contact our support.