Hi,
I defined a custom field called Week-of-the-Year which has 53 values to select one from ranging between 01 and 53.
I would like automation to set it based on the number of the current week: "{{now.format("w")}}"
How do I make that happen? How can I use smart values to set my Week-of-the-Year single select based on the actual week?
If I need to change the 01,02... to 1,2 - that can be done but I cannot use text field since it won't work for my dashboard.
Thanks
Hi @Dd ,
Yeah this is certainly possible, however, your select field values need to reflect exactly what the format(w) returns for this to work.
To set your select field using automation with a variable, you will need to use the advanced field editting.
{ "fields": {
"customfield_123456": { "value": "{{now.format("w")}}" }
}
}
You get the customfield_id by going to the custom field configuration and checking the URL.
You can find some documentation about this here.
Cheers!
- Tessa
And if you don't want to change your select list from "02" -> "2", you could use a leftPad function, then it would look something like this:
{ "fields": {
"customfield_123456": { "value": "{{now.format("w").LeftPad(2,"0")}}" }
}
}
Test it out!
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.
Hello @Dd
You could use weekofyear to get the week #. like below...
{{now.weekofyear}} OR
{{updated.weekofyear}} etc.
Hope it helps. Thanks.
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.