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
- -- BEGIN LOOP: No conditions, 3 loops are set
- -- Then: Create Variable
- Variable Name: assetModel
- Smart Value: {{object.Model}}
- -- And: Create Lookup Table:
- Lookup Table Name: assetManufacturers
- Key: 1 | Value: HP
- Key: 2 | Value: CANON
- Key 3 | Value: BROTHER
- -- And: Create Variable:
- Variable Name: assetManufacturer
- Smart Value: {{assetManufacturers.get(loop.count)}}
- -- IF: {{assetModel}} contains {{assetManufacturer}}
- Then: Create Variable
- Variable Name: assetMake
- Smart Value: {{assetManufacturer}}
- Then: Edit Object
- Attribute: Manufacturer
- Value: {{assetMake}}
- -- END LOOP
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.