I have built a rule that creates a work item when an asset is older than 3.9 years. Every time the asset is updated, a new work item is created. And I would like to have a query that first checks if there is already a work itemwith the same name, if yes then no new work item should be created.
HI @Antonia
Use a Lookup Work Item action to find an issue with the same name.
The based on IF/ELSE, if already found add for example a comment to the issue ELSE create a new issue.
See this community post for more information; Jira-Automation-Look-for-existing-issue-and-comment
thanks for your help.
The based on IF/ELSE, if already found add for example a comment to the issue ELSE create a new issue.
What do you mean by that? Do I usually have to create a new component for this or can I enter it in the field for the JQL? I've also looked at the other post, but I don't quite understand it, I can't really get any further. I would prefer it if the action simply checked whether the summary/title already exists.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Antonia
You need to add a JQL in the lookup issues, the will find information based on the object updated.
So you JQL in the lookup should be something like;
type = "hardware change" and summary ~ "printer xyz"
What is set in the created issue that identifies this relates to the specfic asset object that triggered this rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Marc - Devoteam ,
thank you for your help!
Well, unfortunately that makes less sense, because the title always changes.
For example, when I create a ticket using the rule, it says “PC 1” (this PC1 comes from the asset name), so I would always have to filter by the asset name, but it always changes in the title, so I can't specify anything fixed in the JQL.
Example of a duplication
1. title for {{object.Hardware Device}}
2. Title for {{object.Hardware Device}}
--> Title for PC1
--> Title for PC1
type = “Hardware Change” AND summary ~ “PC” would therefore be incorrect.
Do you have another idea? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I tried:
type = "Hardware Change" AND summary ~ "{{object.Hardware Device}}"
But it still created a new work item with the same name:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Antonia
What does the log provide if you make a log action {{object.Hardware Device}}
Other option on creating the new issue, can you set the asset field in the issue based on the object that is changing?
Then in the lookup you could JQL on: type = "Hardware Change" and <assets-customfield> = <object-set-in the-field>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you for your time!
Log:
Then in the lookup you could JQL on: type = "Hardware Change" and <assets-customfield> = <object-set-in the-field>
So, the Asset Custom field is called "Asset2" :
type = "Hardware Change" AND asset2 = "{{object.Hardware Device}}"
Do you mean like that?
Object.hardware Device is the asset label
I tried it, but it doesn't work.
So, here is the updated rule, maybe the order of the actions is wrong:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Antonia
What kind of information is in the newly created issue.
Is the field asset2 on the new issue, is this an asset field and if so what is the value of that field in the new issue?
The JQL we need is to find details on the new issue, so it will determine if this is already there, so no new issue will be created.
What does the log say on using "{{object.Hardware Device.label}}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now the rule doesn't work at all anymore, and I have no idea why. Not even when I undo the changes. There's nothing showing up in the logs either—only that I made some changes. But at least now you can see what kind of custom asset field it is. And that could also be used to identify the tickets
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI @Antonia
Then can sometime happen on rules by asset triggers, you will have to wait some time.
I think I was wrong on the smart label, I think it should be {{object.Hardware Device.Label}}
And add a Re-Fetch action after the creation of the new issue and before the lookup.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Log says:
Can't run component as it requires work item(s) in the context. More than likely you have a trigger that doesn't insert work items into the rule chain. e.g. Scheduled rule not running a JQL query. Creating a work item does not put a work item into the context, you have to branch on it to update it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Antonia
Then use a branch, based on most recent created issue and do the lookup in the branch, also the log action for the time being
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I made it! I done it a bit different like you said, but it works:
I have moved the lookup function up one and then a smart value is added and only then is the ticket created.
Thank you @Marc - Devoteam for your 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.