Hello community,
I want to create an automation in Assets, specifically: I have two date fields (Last Check and Next Check), and I want that if a date is entered in the Last Check field, the Next Check field automatically updates to +90 days based on the date in Last Check.
The problem is that the automation step "Then and Attribute Value and Value:" does not work with ${Last Check.plusDays(90)}
.
But with a fixed date like 2025-10-15
or just ${Last Check}
, it works fine.
As I understand it, my Assets instance does not support plusDays(90)
.
In the logs, it shows the error:rlabs-insight-attribute-3401: At least one value must be set;
Is there an alternative to ${Last Check.plusDays(90)}
?
P.S. My instance is Data Center.
Can you give some mote information, are the data fields mentioned attributes on an object or custom fields.
My assumption is that they are attributes, as you mention an automation in assets.
But as this is on server/DC, you probably need to execute a groovy script, as smart values like plusDays don't work in assets automation
This might give you some more informartion/guidance https://docs.adaptavist.com/sr4js/9.9.0/hapi/work-with-assets-insight#updating-attributes
Hi @Marc - Devoteam ,
Thank you for your message.
Yes, these fields are Attributes. At the moment, I am looking for a solution without ScriptRunner or plugins. If automation does not allow it, I will resort to Groovy script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Petru Negrusa
Can you share a screen image of your entire rule, please?
I believe you are encountering a problem because in Data Center asset object dates are stored as the number of seconds since the start of Unix time: the start of day on 1 January 1970. Since they are not stored as dates comparable to how dates are stored in issues, the date/time smart value functions don't work.
There are some discussions of working with Asset dates in this Question, though it was not specifically about how to add a period of time to a date from one Asset field an put it into another Asset Date field. You might find it helpful.
https://community.atlassian.com/forums/Jira-Service-Management/Asset-Date-Format/qaq-p/2982600
I don't have a Data Center environment where I can validate a solution for this, but I'm still looking to see if I can find a documented solution to share with you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Trudy Claspill
Thank you for your message.
I attached 3 attachments where you can see the fields and the automation.
I would like to add that I also added other values in the automation (${Last Check.plusDays(90).format("yyyy-MM-dd")}) and ${Last Check.parseDate("dd/MM/yyyy").plusDays(90).format("yyyy-MM-dd")}
But without any result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see you are attempting to use the Automation feature within Assets.
Are you aware that with ScriptRunner you also get some functions for accessing Asset objects in Jira's Automation for Jira feature?
https://docs.adaptavist.com/sr4js/9.7.0/integrations/automation-for-jira
What version of Jira Data Center are you using, and what version of ScriptRunner?
I don't believe it is possible to use date functions with the Date or Date/Time attributes in Assets because the date in DC Assets are stored a epoch dates.
I believe you will have to use groovy scripting to calculate a new date with that in mind, either
1. converting the stored date to a date/time variable, using date functions, and then converting it back to an epoch date to set the attribute, or
2. doing the calculation without converting the epoch date and without using date functions.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.