Retrieving customize value of Record Class using GetProperty method


We are using HPRM SDK in that we have BaseObjectTypes.Record and there are some custom properties created by the team which are not provided by HPRM. I want to access them I dont know ho to get the value of custom properties of BaseObjectTypes.Record.




  • Here is one way to do it...

    var fieldDefinition = new FieldDefinition(db, fieldDefinitionUri);
    if (fieldDefinition.IsUsedFor(record))
        value = record.GetFieldValueAsString(fieldDefinition, StringDisplayType.TreeColumn, useHTMLEscapeChars: false);

    If you search the doco for user defined fields (or "udf") you should be able to find some more information.

    Note in the example above that FieldDefinition is the object associated with custom properties. It is easy to get the value if you know their URIs ahead of time, otherwise you can iterate over FieldDefinitions in a similar way to Records.

  • var fieldDefinition = new FieldDefinition(hpConnect, "CourtDocumentType");

    if (fieldDefinition.IsUsedFor(record)) --> What should I specify here
         value = record.GetFieldValueAsString(fieldDefinition, StringDisplayType.TreeColumn, useHTMLEscapeChars: false);

    Here is my code:

    TrimMainObjectSearch objTrimSearch = new TrimMainObjectSearch(hpConnect, BaseObjectTypes.Record);
    TrimSearchClause objTrimClause = new TrimSearchClause(hpConnect, BaseObjectTypes.Record, SearchClauseIds.RecordType);


    foreach (Record item in objTrimSearch)


  • I am getting below error after trying your code snippet:

    HP.HPTRIM.SDK.TrimException: Could not find the Custom Property matching the value 'CourtDocumentType'. Either no such object exists or the Custom Property has recently been deleted.

Reply Children