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

Update of Entity Metadata in CRM Online (Price List Item)

$
0
0

Hi,

We have an on-premise solution with a custom attribute added to the Price List Item entity. 

Now we want to recreate this attribute in CRM Online and given that the Price List Item is not a customizable entity we wanted to set the properties "IsCustomizable" and "CanCreateAttributes" to true.

I've created a plugin that is executed on the creation of a Price List Item with the following code:

--------------------------------------------------------------------------

RetrieveEntityRequest retrieveProductPriceLevelEntityRequest = new RetrieveEntityRequest
{
LogicalName = "productpricelevel"
};


RetrieveEntityResponse retrievePriceListItemEntityResponse = (RetrieveEntityResponse)service.Execute(retrieveProductPriceLevelEntityRequest);
EntityMetadata priceListItemEntity = retrievePriceListItemEntityResponse.EntityMetadata;

//throw new InvalidPluginExecutionException("is customizable -> " + priceListItemEntity.IsCustomizable.Value);

priceListItemEntity.IsCustomizable = new BooleanManagedProperty(true);
priceListItemEntity.CanCreateAttributes = new BooleanManagedProperty(true);


UpdateEntityRequest updatePriceListItemRequest = new UpdateEntityRequest
{
Entity = priceListItemEntity
};

service.Execute(updatePriceListItemRequest);

PublishAllXmlRequest publishRequest = new PublishAllXmlRequest();
service.Execute(publishRequest);
--------------------------------------------------------------------------

While the plugin is executed successfully and when I debug it, I can see that the "IsCustomizable" and "CanCreateAttributes" fields are set to "true", I still can't add new fields to the Price List Item.

So I want to ask - are there any additional attributes that I need to set, and if not - what could be the problem?

Thanks.

Best regards,

Evgeni


Viewing all articles
Browse latest Browse all 55831

Trending Articles



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