This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VBScript Calculated Value - Retrieve properties of related Object

I've been using the VBScript Calculated Value a bit retrieving values of properties on an object

For example on an Invoice object, (commented out) retrieving the value of an Invoice # property searching by alias, and (not commented out) searching for a Line Item property value by ID

Dim szDisplayPropertyValue
Dim szOutString



'szDisplayPropertyValue = PropertyValues.SearchForPropertyByAlias( Vault,"PD.InvoiceNumber",False).Value
'szOutstring = " Invoice # " + DisplayPropertyValue

szDisplayPropertyValue = PropertyValues.SearchForProperty(1049).TypedValue.DisplayValue
szOutstring = " LineItemName " + szDisplayPropertyValue


Output = szOutString

In the second example the property is actually the display name of an object that is on the metadata card as a value list of Line Item objects.

How do I retrieve a property of that object? For example if that Line Item object has a property of Line Item Total (alias PD.LineItemTotal)

In general I'm interested in how to retrieve the properties of related objects, whether related via object value list like this example, or maybe the properties of an Owner object.

Thanks

  • Once you have identified the related object you need to get the propertyvalues from that object. When that is in place you can get values from individual properties from that collection.

  • Makes sense. Since this is an autofill script,  by default SearchForPropertyByAlias only allows you to view property values from the current object. What code is used to allow that method against properties on other objects?

  • Something like this should get you started.

    Dim iOtherObjectPropertyDef : iOtherObjectPropertyDef = Vault.PropertyDefOperations.GetPropertyDefIDByAlias("<YourAlias>")
    Dim oOtherObjectObjVer
    	[some code to get the ObjVer of the other object]
    Dim oOtherObjectProps : set oOtherObjectProps = Vault.ObjectPropertyOperations.GetProperties(oOtherObjectObjVer, False)
    Output = oOtherObjectProps.SearchForProperty(iOtherObjectPropertyDef).TypedValue.GetLookupID()