Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

how to add multiple relationship in single entity

$
0
0

Hi,

I want to create lookup field with one to many relationship..How can i achieve this using c#?

for example ..

In invoice  table i need to add 2 fields.

like- 1.) p/o_id(purchase order Id ) 2.) supplier

 

I have done like this for p/o id..it works perfact..but when i add same code for supplier(with supplier fields),It doesnot allow multiple ralation.

CreateOneToManyRequest reqpoid = new CreateOneToManyRequest()
{
Lookup = new LookupAttributeMetadata()
{
Description = new Label("Purchase order id", 1033),
DisplayName = new Label("Purchase Order Id", 1033),
LogicalName = "new_parent_poid",
SchemaName = "new_parent_poid",
RequiredLevel = new AttributeRequiredLevelManagedProperty(AttributeRequiredLevel.None)
},
OneToManyRelationship = new OneToManyRelationshipMetadata()
{
AssociatedMenuConfiguration = new AssociatedMenuConfiguration()
{
Behavior = AssociatedMenuBehavior.UseCollectionName,
Group = AssociatedMenuGroup.Details,
Label = new Label("Purchase Order Id", 1033),
Order = 10000
},
CascadeConfiguration = new CascadeConfiguration()
{
Assign = CascadeType.Cascade,
Delete = CascadeType.Cascade,
Merge = CascadeType.Cascade,
Reparent = CascadeType.Cascade,
Share = CascadeType.Cascade,
Unshare = CascadeType.Cascade
},
ReferencedEntity = "new_purchaseorder",
ReferencedAttribute = "new_purchaseorderid",
ReferencingEntity = _customEntityName,
SchemaName = "new_invoice_new_purchaseorder"
}
};
_serviceProxy.Execute(reqpoid);


Viewing all articles
Browse latest Browse all 79901

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>