Forums

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

A manufactured date from Best Before date on field

Hanna Voutilainen February 26, 2022

Hi!

I'm figuring out a consumer service solution for a client with with Jira Service Management. 

Now they are looking for a solution to get the Manufactured date being calculated automatically based on the given Best Before date + a certain amount of dates given. 

For example, the Best Before date was 2.3.2021 and the Manufactured Date was 2.3.2021 x 50 days.  

They would like to have both these fields visible on a ticket and be able to view and filter reports based on those.

How would this be possible to execute?

Thank you for the support!

1 answer

0 votes
Patrick Ricciardi
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.
February 26, 2022

Have you tried doing this with an automation?

 

Create an automation that triggers when the ticket is created.

Create a variable taking the value of the date field adding 50 days. (This is what it would if you used the created date of the issue.

{{issue.created.plusDays(50)}}

Set the date you want with this new value?

I think this would work.

pat

Hanna Voutilainen February 27, 2022

Hi!

Thank you for the comment. 

The issue create date isn't the same as Best Before date.

We have a form that creates a new ticket. On that form is a field, where a client sets a Best Before date on a date field.

From that Best Before date field the Manufactured Date would need to be calculated.

The date also needs to show somehow on the ticket on a field next to the Best Before date field. It also needs to be on a format we can show in the reports and compare it next to products etc.

Hanna Voutilainen February 27, 2022

So the automation should

  1. Take the value from the "Best Before Date" field
  2. Minus lets say 50 days from that date
  3. Add that information into the ticket to a Manufactured Date field

 

I can get the automation components correct, but not the variables. :/

Patrick Ricciardi
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.
March 4, 2022

OH, I realized the createddate wouldn't be the same, that's just what I used to test my theory, I figured (perhaps mistakenly) it would work on a custom field.

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

This page lists the functions you can use with Date/Time

I haven't had a chance to test this out, but what if you have your automation that runs on Creation.

You call "Create variable"

Set variable name to ManufactureDateVar

Set value of variable to BestBeforeDate.minusDays(50)

Call "Edit Issue Field"

Set Manufactured Date field to your new variable {{ManufactureDateVar}}

Patrick Ricciardi
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.
March 6, 2022 edited

@Hanna Voutilainen 

I just tested it out and it worked as I suspected it would, the one hairy part I kind of had to fiddle with was how to access a custom field's smart value.

There are instructions here:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Basically, I looked at the JSON and found the value for the custom field and entered it in as the variable value.

newDate

{{issue.customfield_130232.minusDays(50)}}

And then I added newDate to the field I needed to have it in,

{{newDate}}

 

So, my theory was correct and it should work for you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events