Hello,
I have an object with the following attributes:
- Manufacturer: text
- Model: text
I am trying to create a loop to iterate through a lookup table containing brand names in order to set a "Manufacturer" attribute on an object when created. On the .csv to import into Jira Assets, the Manufacturer and Model of an asset are combined and imported under just "Model". I would like to use a loop and an if statement to check if the imported "Model' attribute contains a brand name listed in my lookup table, and edit the 'Manufacturer" attribute to reflect that brand.
I am not able to edit the .csv to not combine the make and model, this needs to be done on import with Jira.
Here's what I have so far:
Test object being created:
Manufacturer:
Model: HP LaserJet 1234
TRIGGER: Object Creation
This automation rule edits "Manufacturer" attribute of the created object to be blank on all three loops.
If I change the assetManufacturer smart value to be
{{assetManufacturers.get(1)}} instead, it sets Manufacturer to HP as it should, but I need it to check all three in the lookup table based on which loop iteration it is at to check each value.
I have tried the following as the smart value and have either gotten errors or Manufacturer set to empty:
-- {{assetManufacturers.get(loop.count)}} -> empty value
-- {{assetManufacturers.get({{loop.count}})}} -> error: Unable to render smart values when executing this rule:
Failed to get value for assetManufacturers.get({{loop.count
If this is the complete wrong way to go about this, please let me know, I am willing to change this entire rule in order to get the functionality of iterating through the lookup table, checking the values, and editing the attribute if a match is found with that match.
Adding to the suggestions from @Trudy Claspill ...
If you still want to use the lookup table as the source of matches, you could try:
Kind regards,
Bill
Hello @Kyrah Johnson
Welcome to the Atlassian community.
It does not appear that {{loop.count}} is a smart value you can use within the loop to determine which iteration of the loop is running, as per the documentation
These values are stored in the loop’s internal state and updates only when the loop completes execution.
Is there a specific reason you are trying to implement this with a Loop and Lookup Table?
An alternate method would be to use and IF/ELSE structure. Here is the basic structure. Where I inserted a Log action you would insert your Edit Object action. You don't need to use all the Create Variable actions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was hoping to use the lookup table and loop to make it easier to add more brands in the future if necessary, but I may be over-complicating it. Thank you for the information!
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.