1. you only need to include post body contents if the watcher you're setting is different from the executing user.
2. This is a different issue from your original question but when you submit a create request the call will return the issuekey. You cant run post functions on create transition reliably unfortunately, use a listener instead and there will be an issue binding available.
Thank you for your question.
I can confirm that as Randy has said that to add a watcher with ScriptRunner for Jira Cloud that you will need to make a rest API call to the watchers API.
I can confirm that we have an example code snippet located here which can be run in the Script Console and shows how you can set the watcher on an Issue and that you will be able to take this example and modify it to create the post function that you require.
I can confirm that inside the post function that there is a variable called issue which comes in the binding of the script and you can get the issue key to pass into the rest call by calling issue.key.
Finally, I can advise that if you are creating your post function on the Create transition that the post function should be ordered as the last post function in the list of post functions, so that the issue is created before the post function code is executed.
If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.
Learn how to use two new reports for next-gen projects in Jira Cloud: Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events