Custom Object Where used not working

Custom Object Where used not working

J_Dumont
Advocate Advocate
1,165 Views
3 Replies
Message 1 of 4

Custom Object Where used not working

J_Dumont
Advocate
Advocate

Hello,

I created a Custom Object, and I can Link Files, Folders, and Items without issue.

If I go to a file, the Custom Object is shown in the Where Used.

However, this does not work for Items and Folders.

It's possible for an Item or Folder to be linked to multiple Custom Objects, and it would be nice to see where they were used.

 

 

 

0 Likes
Accepted solutions (1)
1,166 Views
3 Replies
Replies (3)
Message 2 of 4

Markus.Koechl
Autodesk
Autodesk
Accepted solution

You can link Items and Folders to Custom Objects. Unfortunately, the "Where Used" information is not directly accessible. To workaround, you need to evaluate the custom objects' content. I have an implementation sample as part of the extended Data Standard sample: the selected ECO is linked to multiple tasks: 

MarkusKoechl_0-1714461021798.png

The code to list these "Where Used" links is the variable _allCustents, a search result that returns all tasks. The loop iterates these and checks for active links. This approach is highly risky in impacting performance; the code snippet below is for "demo purposes" only, as the search may return thousands of custom objects. But, if you create links programmatically, the code can add more properties to the link target, optimizing the search. My implementation limits the search result leveraging the names of the tasks including the ECO number.

 

$_allCustents = mgetCustomEntityList $_CoName
		$_LinkedCustentIDs = @()
		Foreach ($_Custent in $_allCustents)
		{
			$_AllLinks1 = $vault.DocumentService.GetLinksByParentIds(@($_Custent.Id),@("CO"))
			If($_AllLinks1) #the current custent has links; check that the current ECO is one of these link's target
			{
				$_match = $_AllLinks1 | Where { $_.ToEntId -eq $mCoId }
				If($_match){ $_LinkedCustentIDs += $_Custent.Id}
			}		
		}

 

 



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes
Message 3 of 4

J_Dumont
Advocate
Advocate

Hi Markus,

 

Thank you for the reply.

I think this strategy will work.

To make sure I understand, I can create a separate tab on Files, Folders, and Items similar to VDS with Datasheet.

Let's call it "Job Numbers," and when the user selects the tab, this is when the code should run and collect the parentIDs and display them in the custom tab.

Is this correct?

 

 

0 Likes
Message 4 of 4

Markus.Koechl
Autodesk
Autodesk

Yes, I confirm.



Markus Koechl

Solutions Engineer PDM, Autodesk Central Europe
0 Likes