Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner Listener Condition - Comment Author

Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2023

I'm trying to create a validation that will check if the last comment was created by the user or by the Script runner but can't find a way for it. Anyone did it recently?

1 answer

1 vote
Mohamed Benziane
Community Champion
December 7, 2023

Hi,

you could use this

issue.getComments().last().getAuthorApplicationUser()
Then check the value returned
Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2023

Nope, 

["Evaluation failed: \"issue.getComments\" - Unrecognized property of `issue`: \"getComments\" ('getComments'). Available properties of type 'Issue' are: '61de211f-8732-44ee-ace2-490fbca80575__PRODUCTION__compass-jira-integration-custom-field', 'assignee', 'attachments', 'changelogs', 'closedSprints', 'color', 'com.atlassian.atlas.jira__project-key', 'com.atlassian.atlas.jira__project-status', 'com.herocoders.plugins.jira.issuechecklist-free__checklist-text-view-only', 'com.herocoders.plugins.jira.issuechecklist-free__issue-checklist-progress-field', 'com.herocoders.plugins.jira.issuechecklist-free__issue-checklist-progress-percent-field', 'com.herocoders.plugins.jira.issuechecklist-free__issue-checklist-templates', 'com.projectbalm.riskregister.riskregister-jira__inherent-impact', 'com.projectbalm.riskregister.riskregister-jira__inherent-probab', 'com.projectbalm.riskregister.riskregister-jira__inherent-risk', 'com.projectbalm.riskregister.riskregister-jira__realization', 'com.projectbalm.riskregister.riskregister-jira__residual-impact', 'com.projectbalm.riskregister.riskregister-jira__residual-probab', 'com.projectbalm.riskregister.riskregister-jira__residual-risk', 'com.projectbalm.riskregister.riskregister-jira__risk-assessment-version', 'com.projectbalm.riskregister.riskregister-jira__treatment', 'comments', 'components', 'created', 'creator', 'customfield_10000', 'customfield_10001', 'customfield_10002', 'customfield_10003', 'customfield_10004', 'customfield_10005', 'customfield_10006', 'customfield_10007', 'customfield_10008', 'customfield_10009', 'customfield_10010', 'customfield_10014', 'customfield_10015', 'customfield_10016', 'customfield_10017', 'customfield_10018', 'customfield_10019', 'customfield_10020', 'customfield_10021', 'customfield_10022', 'customfield_10023', 'customfield_10024', 'customfield_10025', 'customfield_10029', 'customfield_10030', 'customfield_10031', 'customfield_10032', 'customfield_10033', 'customfield_10034', 'customfield_10035', 'customfield_10036', 'customfield_10037', 'customfield_10038', 'customfield_10039', 'customfield_10040', 'customfield_10041', 'customfield_10042', 'customfield_10043', 'customfield_10044', 'customfield_10045', 'customfield_10046', 'customfield_10047', 'customfield_10048', 'customfield_10049', 'customfield_10050', 'customfield_10051', 'customfield_10052', 'customfield_10053', 'customfield_10056', 'customfield_10057', 'customfield_10059', 'customfield_10062', 'customfield_10063', 'customfield_10068', 'customfield_10069', 'customfield_10070', 'customfield_10072', 'customfield_10073', 'customfield_10074', 'customfield_10075', 'customfield_10076', 'customfield_10077', 'customfield_10078', 'customfield_10079', 'customfield_10080', 'customfield_10082', 'customfield_10083', 'customfield_10090', 'customfield_10091', 'customfield_10092', 'customfield_10093', 'customfield_10094', 'customfield_10095', 'customfield_10096', 'customfield_10097', 'customfield_10098', 'customfield_10100', 'customfield_10101', 'customfield_10103', 'customfield_10104', 'customfield_10105', 'customfield_10106', 'customfield_10110', 'customfield_10114', 'customfield_10115', 'customfield_10116', 'customfield_10117', 'customfield_10118', 'customfield_10119', 'customfield_10120', 'customfield_10121', 'customfield_10122', 'customfield_10145', 'customfield_10146', 'customfield_10147', 'customfield_10148', 'customfield_10149', 'customfield_10150', 'customfield_10151', 'customfield_10152', 'customfield_10153', 'customfield_10154', 'customfield_10155', 'customfield_10156', 'customfield_10157', 'customfield_10158', 'customfield_10159', 'customfield_10160', 'customfield_10161', 'customfield_10162', 'customfield_10163', 'customfield_10164', 'customfield_10165', 'customfield_10166', 'customfield_10167', 'customfield_10168', 'customfield_10169', 'customfield_10170', 'customfield_10171', 'customfield_10172', 'customfield_10173', 'customfield_10174', 'customfield_10175', 'customfield_10176', 'customfield_10177', 'customfield_10178', 'customfield_10179', 'customfield_10180', 'customfield_10181', 'customfield_10182', 'customfield_10183', 'customfield_10184', 'customfield_10185', 'customfield_10186', 'customfield_10187', 'customfield_10188', 'customfield_10189', 'customfield_10190', 'customfield_10191', 'customfield_10192', 'customfield_10193', 'customfield_10195', 'customfield_10196', 'customfield_10197', 'customfield_10198', 'customfield_10199', 'description', 'done', 'dueDate', 'environment', 'epic', 'fixVersions', 'flagged', 'getNewestChangelog', 'id', 'isEpic', 'issueType', 'key', 'labels', 'links', 'name', 'originalEstimate', 'parent', 'priority', 'project', 'properties', 'remainingEstimate', 'reporter', 'resolution', 'resolutionDate', 'securityLevel', 'sprint', 'status', 'stories', 'subtasks', 'summary', 'timeSpent', 'updated', 'versions', 'voters', 'votes', 'watchers', 'watches', 'worklogs'"]

but issue.comments is accepted. But then, last() is not.  

Mohamed Benziane
Community Champion
December 7, 2023

can you share you code please

Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 2023

There isn't any. This is just a condition part. Screenshot 2023-12-07 at 18.19.09.png

Mohamed Benziane
Community Champion
December 8, 2023
Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 8, 2023

found it:

!issue.comments[issue.comments.length - 1].author.displayName.includes("ScriptRunner for Jira")

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events