How to use Run actions for both Jira and Service Desk
Description
From an application perspective, Service Desk is really an extension of core Jira capabilities. The Service Desk CLI provides unique Service Desk specific actions based on REST APIs provided by Service Desk. Neither the REST APIs nor the Service Desk CLI replicate the full Jira capabilities available on the platform. To get the full power of capabilities of both, the Jira CLI has the ability to delegate actions to the Service Desk CLI where appropriate. This is important when combining operations as part of run and runFrom actions. This is easily accomplished by just using the Jira run actions as normal even if they include Service Desk actions.
The following example uses the run action, but similar things can be done using various runFrom actions.
This example requires CLI Release 6.4 or higher.
Example
Command line action
--action run --file "create-request-with-attachment.txt" --common "--project ZSDCLI" --findReplace "#attachment#:myAttachment.txt,#type#:Get IT help" create-request-with-attachment.txt
--action createRequest --summary "my request with attachment" --type "#type#"
--action addAttachment --issue @request@ --file "#attachment#"Notes
We use findReplace to make the script more general.
The createRequest will add replacement variables related to the newly created request. Specifically, the request variable representing the request (issue) key.
The addAttachment action references the request replacement variable.