Getting UIDs of newly created AttestationCases

Hello Community,

I'm using the method CreateAttestations in a script with an array of objectkeys as input:

..
Dim arrXObjKey As String() = colObjects.Select(Of String)(Function(t) t.GetValue(Of String)("XObjectKey")).ToArraySmart()
Dim policy As IEntity = Session.Source.Get("AttestationPolicy", uidAttestPolicy)

policy.CallMethod("CreateAttestations", arrXObjKey)
policy.Save(Session)
...

As I understand, the method CreateAttestations returns the objectkeys of the newly created AttestationCases. My question: what is the correct way to get these return values? I tried something like this, but i keep getting error messages:

Dim arrNewXObjKeys As String() = CStr(policy.CallMethod("CreateAttestations", arrXObjKey)).ToArraySmart

Thanks in advance!

Kind regards,

Rinay

Parents
  • If you look at the signature of the method you will see that it returns an array of type DBObjectKey. You can get the XML-XObjectKey from the DBObject with the ToXML method.

    And, you need to use the CallFunction method instead of CallMethod.

    Dim arrNewXObjKeys As DbObjectKey() = CType(policy.CallFunction("CreateAttestations", arrXObjKey), DbObjectKey())
    ...
    Dim xObjectKey As String = arrNewXObjKeys(0).ToXmlString()
    ...
    

Reply
  • If you look at the signature of the method you will see that it returns an array of type DBObjectKey. You can get the XML-XObjectKey from the DBObject with the ToXML method.

    And, you need to use the CallFunction method instead of CallMethod.

    Dim arrNewXObjKeys As DbObjectKey() = CType(policy.CallFunction("CreateAttestations", arrXObjKey), DbObjectKey())
    ...
    Dim xObjectKey As String = arrNewXObjKeys(0).ToXmlString()
    ...
    

Children