I am writing a plugin for dynamics to store some records in a custom entity/table. Now the problem is every custom entity/table you create in the dynamics environment is assigned a publisher prefix in its LogicalName and schema name even its attributes have the prefix. Now when a certain event is triggered in the system the plugin stores some information in this table but i don't know what the prefix is.
PROBLEM:
How can I fetch the publisher prefix inside the plugin dynamically?
I can hardcode the name of the table in the plugin but the prefix needs to be fetched dynamically.
I can just fetch all entities and then filter out the table I created, but I believe that will be heavily taxing on the dynamics system.
Well I do have oauth access to the dynamics CRM. Can I store the prefix in the dynamics system somewhere probably as a name of the entity then dynamically fetch it in the plugin?
So, I managed to finally figure out how to fetch the prefix and this is how, I am assuming the plugin was registered in the active solutions.
pluginassemblytable usingQueryExpression.solutionIdfrom the plugin info.solutionIdand that's how you get thepublisherIdassociated with the solution and then use that to fetch the prefix. The property is calledcustomizationprefix.The sample code is as follows,
I understand that the code is poorly written because I am not a .Net dev but it does the job ;).