While Case Comments may be sent to related Issue(s) in JIRA at any time using #JIRA hashtag, you can also optionally auto push Salesforce Case comments to related Issue(s), as shown below.
In order to send Case Comments Automatically, you will need a custom trigger on Case Comment before insert. This trigger will check if the Parent Case of the Case Comment has at least one related JIRA issue and does not include hashtag JIRA in the comment body.
Please note that while we offer this as a guide, customizations based on zAgileConnect objects and resources are not supported by zAgile unless performed directly by zAgile.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
trigger CCommentTrigger on CaseComment (before insert) { Set<Id>caseIds = new Set<Id>(); for (CaseComment cc:trigger. new ){ caseIds.add(cc.ParentId); } Map<Id,Case>mapCases = new Map<Id,Case>( [SELECT Id,(SELECT Id FROM zsfjira__ZIssue_SF__r) FROM Case WHERE Id IN :caseIds]); for (CaseComment cc:trigger. new ){ Case current = mapCases.get(cc.ParentId); if (current.zsfjira__ZIssue_SF__r.size()> 0 && !cc.CommentBody.toLowerCase().contains( '#jira' )){ cc.CommentBody = '#JIRA ' +cc.CommentBody; } } } |