RE: How to add column in one entity and that column also auto add in multiple table
Hi Ravan,
The only way to automatically create columns would be to write custom code in order to utilize the CreateAttributeRequest in the SDK (docs.microsoft.com/.../microsoft.xrm.sdk.messages.createattributerequest
Unfortunately, there's no trigger in a plugin or workflow for "When a new field is added to a table", and so you may have to get creative in how you want to build this.
If I were to try to accomplish this, I would:
1. Create a table called "New Attribute Request" that would have columns in line with the data you need to create a new attribute using the SDK message above (ie. Table Name, Field Name, Field Type, etc.)
2. Create a plugin that runs on the Create message of the "New Attribute Request" table, retrieves the field information, and calls the "CreateAttributeRequest" message from the SDK, using the fields as the input parameters for the message. In here you would also call the "CreateAttributeRequest" for any other table you want that field to automatically be created on.
3. If you wanted it to be a little more dynamic, I would have a field on the "New Attribute Request" that can be used to identify what table(s) you would like the new field to automatically be created on. For example, a multi-select option set that could have Contact and Account selected, which would then tell the process to automatically create the field on those 2 tables.
Essentially what this process would be doing is allowing the user to create a record in the New Attribute Request table that would automatically create the column on the identified table, as well as create the same column on any other identified tables on that record.
I hope this sort of makes sense and gives you a starting point.
Thanks!
Matt Bayes