How do I create a record relationship?


There is a lot going on in HPRM and it is not always apparent where to go in the ServiceAPI to do what you want to do.  In this video I have brief look around as I work out how to add a record relationship.

C# Example

This example uses the c# libraries as documented at this path /help/dotnetclient in your ServiceAPI to add a new child relationship to the ChildRelationships collection.

TrimClient trimClient = new TrimClient("http://myserver/HPRMServiceAPI");
trimClient.Credentials = new NetworkCredential("david", "XXXXX");
trimClient.AlwaysSendBasicAuthHeader = true;

Record record = new Record();
record.Uri = 12;
record.ChildRelationships =
   new List<RecordRelationship>() {
       new RecordRelationship() {RelatedRecord = new RecordRef() { Uri = 13}, 
           RelationType = RecordRelationshipType.IsRelatedTo}


foreach (RecordRelationship relationship in record.ChildRelationships)