Showing posts with label Associating the Sales Literature to Product in CRM. Show all posts
Showing posts with label Associating the Sales Literature to Product in CRM. Show all posts

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 salesLiteratureId= new Guid();

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

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.