I am trying to set default price list for a product bundle that i am trying to create using Microsoft.CrmSdk.CoreAssemblies
. I have written the working code that successfully creates the product bundle with all the configurations that I specify in the code but default price list is never set. Following is the code snippet:
Entity ProductBundleEntity = new Entity("product");
ProductBundleEntity.Attributes["name"] = Name;
ProductBundleEntity.Attributes["productstructure"] = new OptionSetValue(3);
ProductBundleEntity.Attributes["productnumber"] = Guid.NewGuid().ToString();
///// setting defult price list here
ProductBundleEntity.Attributes["pricelevelid"] = new EntityReference("pricelevel", PriceListID);
ProductBundleEntity.Attributes["defaultuomscheduleid"] = new EntityReference("uomschedule", UOMScheduleID);
ProductBundleEntity.Attributes["defaultuomid"] = new EntityReference("uom", UOMID);
Please suggest if i am missing anything.
Did you receive any error? When is your plugin running, create/update? Is it synchronous? – is it pre operation or post?
If post you might have to use service.update(Entity object) Better try with pre operation so that same object/ can be used.