Jump to content

Service Manager - linkAsset - Duplicate Links

Recommended Posts

I've just noticed the linkAsset API operation will still create a link to a request even if it's already linked. This is despite it returning the error message "entitiesAlreadyLinked", which I would have assumed meant "I tried to link this, but it is already linked so I didn't do it".

I've got a process that uses the API to create the asset, and then later on in the process assign it to a user. Both of these scripts link the asset to the request. This has now caused situations like the attached example image where a count of the linked assets is greater than the number of actually linked assets (I've been rerunning scripts against this one to try test avoiding creating duplicate links by using "loadLinkedEntities" to check for links first, but to no avail so far, hence 6 duplicates). I see in the "h_cmdb_links" table that there are indeed individual rows equal to the number shown in Service Manager for the link between the asset and request.

When I try removing the linked asset in Service Manager, it posts to the timeline that it was removed, but doesn't actually remove it (even when I click to remove it a number of times equal to the number of links shown). I also tried using the "RelationshipLinks/deleteRelationshipLink" operation (giving it the ID shown in the "h_cmdb_links" table) but it returned "the specified relationship link does not exist". So I'm not sure what other ID I can use?

Are there any foreseeable issues that could be caused by this down the line? I know you can't delete assets that are linked to requests for example.

Is this a bug with the linkAsset command?


Link to comment
Share on other sites

  • 1 month later...

Hi @CraigP

can I please have more details about where in the process the duplicate is created ?  A screenshot of the relevant nodes or a simplified process that we can use as an example might help us replicating the issue.
From what I can see, the nodes that link an asset to a request are 'Requests->Assets->Create ... Asset' (in which case the system create a new asset and link to the requests) and 'Requests->Assets->Add ... Asset', but none of these operations should create duplicates, and we cannot replicate the issue you mention.



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...