We can associate the Default Price List to the Product using
the below code.
var xrm = new XrmServiceContext("Xrm");
Guid priceLevelId = new Guid();
EntityReferenceCollection relatedEntities = new EntityReferenceCollection();
relatedEntities.Add(new EntityReference(PriceLevel.EntityLogicalName, priceLevelId));
Relationship relationship = new Relationship("price_level_products");
xrm.Associate("product", newProduct.Id, relationship,
relatedEntities);
Here the price_level_products 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