Hello,
I will explain what I want to do through a scenario. This scenario takes place on the Jira Service Management product.
Company A is a consulting firm and sells packages to its customers over the hour. For example, it sells a 20-hour consulting package in May and the customer can get 20 hours of support from company A in May. Company A wants to keep the 20 hours of support on Jira, and when a request is received from each customer, it wants to enter the number of hours it solved these requests -time tracking- on Jira, subtract this from the total package received (20 hours) and send this information via an automatic mail when the job is "Done".
How can I set up this process on Jira Service Management? I am waiting for your advice.
Hello @Berat Altunhan ,
You can use Clockwork API to automate this process using an automation rule.
First, I would advice a scenario where every customer is assigned a project.
The trigger for the automation should be when Work is logged. After this, a Web request is sent using Clockwork API that allows you to specify the ProjectKEY and the start time, as below:
https://api.clockwork.report/v1/worklogs?starting_at={{now.startOfMonth.jiraDate}}&project_key=HELP##)}}
the starttime specifies the beginning of each month so you can get the totaltimespent in seconds for that month
The webrequest should be as below:
Next, add an if/else condition. In the If condition, check that the webresponse status category is a success. Next, create a variable to save the sum on the webresponse.timepsent, as shown:
Next, create another variable to save time in hours as shown:
Next, create a variable to save the time left, this is in your case 20h-timespentHours, as below:
After identifying your variable, you can then add an action to send an email to a desired email address as below:
To use this rule for more than one project, first, you can replace the web request as below:
https://api.clockwork.report/v1/worklogs?starting_at={{now.startOfMonth.jiraDate}}&project_key={{triggerIssue.key.substringBefore("-")}}
then for the email to be sent to different email addresses, create a custom field to store the email address of every customer on their respective issue and you can dynamically reference that email with {{triggerissue.[Custom Field].id}}.
Also, to avoid the rule from running every time a user logs time, you can change the trigger for this issue to be scheduled.
I will be happy to work with you on this, please reach out to us here if you have further questions.
@Adaeze_Jude_HEROCODERS @Berat Altunhan
let's just add that to use our API you'd need to install either Clockwork Free or Clockwork Pro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.