I have used the linked resource to set up my automation
My automation works well until it gets to reading the description and adding the necessary comment. I have 3 fields I would like to do this with, each its separate comment. Using the resource above I have extracted the item "ID" but I am struggling to get anything extracted of the "Date" and I only get 1 out of the 2 or in some cases more "Owner" names. I have also used regex101 to verify my expressions within the smart value string and there the results shown seem correct. Will appreciate any support, I am also able to change the sample email sent to make it easier, this will always be sent as an automated email as well, so their shouldn't be variations except in the actual values.
The smart value and regex expressions I have tried using:
{{issue.description.match(".*ID: (\S+).*")}}
{{issue.description.match(".*Owner: (\S+).* (\S+).*")}}
{{issue.description.match(".*Date: (\S+).*")}}
A sample of the email sent:
ID: 1
Owner: TEST Name
Date: 23/07/2024
The return comments I get
"1005"
"TEST"
-
Hi @Roland Kiss and welcome to the community!
Try the following:
Let me know if they worked out for you!
Hello @Alex Koxaras _Relational_
Thank you for your response, I tried what you have suggested but it seems to be including the "ID: as well as the "Owner:" portion which I do not need. I have found the below to work.
{{issue.Description.match("[\n\r].*ID:\s*([^\n\r]*)")}}
{{issue.Description.match("[\n\r].*Owner:\s*([^\n\r]*)")}}
{{issue.Description.match("[\n\r].*Date:\s*([^\n\r]*)")}}
Following the log action these return the exepected number, name and date that I would like. I have now found myself another problem and wanted to ask to see if you could provide guidance, here I want to create a SMART variable from these which I have done with the create variable, this works fine as if I test with the log action it is correct. What I have struggled with is to then use the SMART variable in an aql search with lookup objects. The ID essentially is a component of the "Name" attirbute I have in assets as well as its own "Ledger Number" attribute which expects an integer. I have tested the lookup objects with manually entering what I expect the output of the SMART variable to be ""Name" LIKE "TEST Stamp - 1005" which works but If I replace the "1005" with {{ID}} - my previous SMART variable - it no longer works and no objects can be found. Could you perhaps point me to some documentation or help me understand the interaction here with the AQL search that prevents me from getting my expected result?
Here is the automation flow I am using-
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Roland Kiss ! I thought that you needed the ID, Owner and Date :) That's why I included them within the regex. I'm glad you found out how to get the values however :)
When creating a smart variable, all the items within the array are considered to be text. Try to use the .asNumber smart function to use the number instead: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#asNumber
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alex Koxaras _Relational_
Thank you so much, for both the regex as well as the smart function help. It worked perfectly, I have 1 (probably final) question with regards to this automation. I am looking to update an asset field at the end with one of them being an object field "Owner" I am getting an error "Attribute value is not valid on Objects" I presume it is again a similar issue as earlier where the format of the input going in isn't correct but I have been unable to find what formatting I need to do extracted "Owner" variable to make it compatible with the object attribute type.
Thanks again in advance, your input has been very helpful!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nevermind I was able to figure out the issue, whitespaces - I was able to fix with the .trim() function from the previous resource you provided, again thank you so much for the help!
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.