Solved

Updating Item Relations

  • 18 January 2023
  • 8 replies
  • 154 views

Userlevel 1
Badge +4

Hello

 

I have been trying to create a relation between all Items to build the CMDB,  

although it is available in the Item form I haven’t found a way to do it in bulk 

 

what I need to update 

Relations

 

 

I generated DWM file but there was no file for the relation 

I have tried to do it through AssystETM with different channels but couldn’t find the fields for relation to link an item to another item

 

I see the relation through “Item Relation” but there is no source and destination on the assyst Resource “Item Relation”

AssystETM


any idea on how to link it,

Thank you in advance for your support

icon

Best answer by Steve Miller 24 January 2023, 11:31

View original

8 replies

Userlevel 4
Badge +12

Try an Item Relation mapper.

 

 

Userlevel 1
Badge +4

Thank you very much for your answer.

it helped a lot.

 

I have been trying to do it through the “Item Relation” as well

 

but unfortunately nothing being updated, it keep getting successful results but with “Record to update” value is not found

even though I can see it through the debug

 

I’m not sure how to combine the 
“Record to update” with Item “shortcode”

Error with Record to Update
Results = No Operation

 

 

Userlevel 1
Badge +4

This also not working for me 

 

 

Userlevel 4
Badge +12

This would likely be fixed by something like…. 

You are effectively narrowing the field for the search. The ‘Record to Update’ wants to return a single entity for you to update.

Userlevel 1
Badge +4

Thank you for your response, I’ve tried it but it seems like it matching the results with “item relation”

rather than “item”

 

If I change the “assyst Resource” to become “Item” then I will lose access to 

 

“Item Related” field as it appears only in “Item Relation” and it doesn’t appear on Assyst Variable Search

 

 

 

Userlevel 4
Badge +12

When searching for relationships, you will need to search for the item and relationship combination. Try using this +(plus) symbol for your additional criteria.

 

This should appear outside of your item search criteria.

This will enable you to search for a relation type of x on y item/ asset. So from your example, a relationship of ‘CONNECTED TO’ on item ‘IT-OP-016-L’

 

Userlevel 1
Badge +4

Thank you for your response,

 

after multiple tried I’ve found that I had the wrong configuration on the channel’s “Operation

it was “Update only” once I changed it to “Create and update” it worked and created all the relations without the need for “Record to Update”

 

 

 

Although it is creating duplicates on each import, I cannot spot where is the error on the following code 

I have created a variable

with the following code

// Find the relations for a given item & the relation types var existing = []; if(outbound.mainItem){     existing = outbound.mainItem.relations||[]; } var matched; var id; for(var i = 0; i<existing.length; i++ ){     var itemRel = existing[i];     var match = itemRel.mainItemId==1*outbound.mainItem.id          && itemRel.relatedItemId==1*outbound.relatedItem.id         && itemRel.relationTypeId==1*outbound.relationTypeId         && itemRel.mainDetailId==1*outbound.mainDetailId         && itemRel.relatedDetailId==1*outbound.relatedDetailId;     if(match){         matched = itemRel;         break;     }         

}

if(matched){     id = matched.id;     //Store the id of the matched relationship, so we don't remove it later     mapped[0].variables.initMatchedRelationshipIDs.push(id); }else{     // Do nothing }

id;
 

then added

 

No Value When…  
//So we set the no value flag if we find the same relation exists

 Boolean(variables.thevariableabove);

 

 

 

 

Badge +5

Hello,

i found this related Topic searching for Answers on how to UPDATE an item Relation.

Meanwhile i created a Solution on my own which can be found below:

Issue: On the assyst Ressource Item Relation there are Fields for Main Item and Related Item:

Unfortunatelly, there is only the Main item in Record to Update. The Combination without the Related Item seems not unique. As far as i understand, is this the reason why new Relations are created instead of updating an existing one:

What i did is to get an variable assyst Search for both items and an Item Relation regarding the accessable fields:

To get the correct ID for an Update from this list of entries, the found item relation is filtered for the relateditem:

variables.item_rel.filter(function(group){return group.relatedItemId==variables.relateditem[0].id}).map(function(group){return group.id})[0]

With the ID there is finally the posibility to do an update

Hope this helps anyone else.

 

Kind Regards,

Christian

Reply