locked
relationship - type of behavior RRS feed

  • Question

  • hi, anyone know how to get the name of "type of behavior of relationships" (system, parental, referential restrict delete, and configurable cascading) by accessing metadata?

    thanks in advance

    Monday, March 7, 2011 2:59 AM

Answers

  • hey melvin.. here is the code to retrieve the relationship information.. go through OneToManyMetadata and ManyToManyMetadata class properties in SDK, will help you more in this.

    MetadataService metadataService = GetMetadataService("ABC_ORG");

     

    RetrieveRelationshipRequest request = new RetrieveRelationshipRequest();

    request.Name = "xyz_accounts";

    request.RetrieveAsIfPublished = true;

    RetrieveRelationshipResponse response = (RetrieveRelationshipResponse)metadataService.Execute(request);

     

    if (response.RelationshipMetadata is OneToManyMetadata)

    {

        OneToManyMetadata xyzAccounts = (OneToManyMetadata)response.RelationshipMetadata;

     

        Console.WriteLine(xyzAccounts.CascadeAssign.ToString());

        Console.WriteLine(xyzAccountss.CascadeDelete.ToString());

        Console.WriteLine(xyzAccounts.CascadeMerge.ToString());

        Console.WriteLine(xyzAccounts.ReferencedEntity);

        Console.WriteLine(xyzAccounts.ReferencingEntity);

    }

    Monday, March 7, 2011 6:53 AM