Saturday, 18 May 2013

Associating the Sales Literature to Product in CRM

We can associate the Sales Literature to the Product using the below code.

var xrm = new XrmServiceContext("Xrm");

Guid salesLiteratureIdnew Guid();

EntityReferenceCollection relatedEntitiesSalesLiterature = new EntityReferenceCollection();
relatedEntitiesSalesLiterature.Add(new EntityReference(CompetitorProduct.EntityLogicalName, salesLiteratureId));
Relationship relationshipSalesLiterature = new Relationship("productsalesliterature_association");
xrm.Associate("product", newProduct.Id, relationshipSalesLiterature, 

Here the productsalesliterature_association is the relationship between the Price List and the Product. We can see the relationship in the CRM portal. The steps are
Settings->Customizations->Customize the System->Entities->Select the Entity ->Click on Relationship.

No comments:

Post a Comment