MS CRM 2015 allows you to specify an attribute mapping on a relationship between entities.
E.g. for the "contact_customer_accounts" relation shown below, it defines which attributes from Account should be copied over to the Contact when adding a new Contact via the Account's "related contacts" view.
However, when I change such a mapping (and publish all customizations), it doesn't get exported as part of my solution (or the default solution, for that matter).
When I compare the customizations.xml files before and after such a change in mapping, they are (for the relevant parts) exactly the same - this information just doesn't seem part of the export?
I also found the Customization solutions file schema, and it doesn't seem to mention anything about the attribute mappings either.
I'd think that this information should be part of a solution export - does anybody know why it's not?
Update: I imported my solution (with both Account and Contact) in my organization and published. Then removed half of the mappings from the "contact_customer_accounts" relation and published again. Finally imported the same solution and published again: the removed mappings did not return.
So I think it's safe to say that the solution doesn't contain the mapping information.
I have also seen where you have to have both the relationship, and both fields defined the mapping in the solution in order for the mappings to be exported... So if I have Entity A that has a Mapping to B, for fields A.1 to B.1 and A.2 to B.2, I have to make sure that the relationship, and fields A.1, A.2, B.1 and B.2 have been added to the solution as well, or else they don't get exported.
Update
After some further testing, in order for Lookup Attributes to be included in the Export of a Mapping, the Target Attribute field MUST BE included in the solution!
As Joseph Duty pointed out, the attribute mappings are stored in the customizations.xml file under ImportExportXml/EntityMaps (see the Customization solutions file schema on how to use them).
However, when the solution is exported, they don't seem to contain any "system" relations, only relations in which at least one entity is a custom entity. So that's probably why my mapping changes didn't end up in the solution export.
The good news is that you can add such a mapping by hand to the customizations.xml file, and when imported, you'll see the mapping appear in all relationships between these entities:
<EntityMaps>
<EntityMap>
<EntitySource>account</EntitySource>
<EntityTarget>contact</EntityTarget>
<AttributeMaps>
<AttributeMap>
<AttributeSource>telephone1</AttributeSource>
<AttributeTarget>telephone2</AttributeTarget>
</AttributeMap>
<AttributeMap>
<AttributeSource>telephone1</AttributeSource>
<AttributeTarget>telephone3</AttributeTarget>
</AttributeMap>
</AttributeMaps>
</EntityMap>
Removing one or more AttributeMap elements from the customizations.xml doesn't cause the corresponding mappings to be removed, but this is regular behavior when working with solutions.
Related
I'll have some items in a model's database table that I more often that not won't want to include in queries for that model. So, rather than querying to exclude these items everywhere I call for the model, either directly or via a relationship, it would be nice to tell Laravel 'in one place' to exclude these items from all collections. The criteria for excluding will be a column value.
Perhaps somewhere in the model I can put this criteria?
Ideally the solution will also provide a way to easily explicitly re-include those excluded items in collections, at the point of querying.
Laravel's model scopes are almost there, but I need it the over way around. Perhaps scopes will solve the second part of my quest (in the paragraph above this one).
I found the answer: Global Scopes. https://laravel.com/docs/8.x/eloquent#global-scopes
I was previously looking at an older Laravel version's doc, which didn't have Global Scopes.
I am trying to add a field to my entity call abc_salespersonname when I try to add it I am presented with duplicate field name.
The field does not show in the solutions entity field list but I can see it in the database.
I do know that when you delete a field from an entity, it does not actually delete from the database.
So my question is, how can I bring this field in the database back onto the entity.
You cannot Undelete any field in a supported way. Once deleted is deleted, gone forever.
Not sure, if you are mixed up with “Remove” & “Delete” options within solution sub-components. Atleast “Publish All Customizations” will make all the database schema, Metadata & UI in sync. Verify the default solution by going to Settings->Customizations->Customize the system to double check.
If you are seeing duplicate field name alert, then you cannot bypass it. Create a new field with different name & move forward.
I want to know if there is any way to change the attribute state from managed to unmanaged in crm 2015
There is no supported way of changing an attribute from managed to unmanaged. However it certainly is possible and I have done quite a bit of this sort of work over the last half year. This involves directly changing the ismanaged property of selected records in the attribute and related metadata tables.
The primary reason you would want to make a component managed is so that you can remove it. So far I have been able to remove the following managed components by first setting underlying ismanaged values to false and then deleting normally through the CRM customizations page:
Text fields
Decimal fields
Yes/No values and Option Sets
1:N and N:N Relationships
I have not worked out removing the following components
Money Fields - conceptually no harder than option sets
Entities - Much more complicated
Entity Properties such as notes and activities - Very complicated
No, there is not. You'd have to uninstall the managed solution, create the attribute in the environment (which would be created as unmanaged), remove the attribute from your managed solution, then reimport your managed solution.
You also need to change the base column for money fields to IsManaged false
I am working on a MVC3 code first web application and after I showed the first version to my bosses, they suggested they will need a 'spare' (spare like in something that's not yet defined and we will use it just in case we will need it) attribute in the Employee model.
My intention is to find a way to give them the ability to add as many attributes to the models as they will need. Obviously I don't want them to get their hands on the code and modify it, then deploy it again (I know I didn't mention about the database, that will be another problem). I want a solution that has the ability to add new attributes 'on the fly'.
Do any of you had similar requests and if you had what solution did you find/implement?
I haven't had such a request, but I can imagine a way to get what you want.
I assume you use the Entity Framework, because of your tag.
Let's say we have a class Employee that we want to be extendable. We can give this class a dictionary of strings where the key-type is string, too. Then you can easily add more properties to every employee.
For saving this structure to the database you would need two tables. One that holds the employees and one that holds the properties. Where the properties-table has a foreign-key targeting the employee-table.
Or as suggested in this Q&A (EF Code First - Map Dictionary or custom type as an nvarchar): you can save the contents of the dictionary as XML in one column of the employee table.
This is only one suggestion and it would be nice to know how you solved this.
I've made a custom entity that will work as an data modification audit (any entity modified will trigger creating an instance of this entity). So far I have the plugin working fine (tracking old and new versions of properties changed).
I'd like to also keep track of what entity this is related to. At first I added a N:1 from DataHistory to Task (eg.) and I can indeed link back to the original task (via a "new_tasksid" attribute I added to DataHistory).
The problem is every entity I want to log will need a separate attribute id (and an additional entry in the form!)
Looking at how phone, task, etc utilize a "regardingobjectid", this is what I should do. Unfortunately, when I try to add a "dataobjectid" and map it to eg Task and PhoneCall, it complains (on the second save), that the reference needs to be unique. How does the CRM get around this and can I emulate it?
You could create your generic "dataobjectid" field, but make it a text field and store the guid of the object there. You would lose the native grids for looking at the audit records, and you wouldn't be able to join these entities through advanced find, fetch or query expressions, but if that's not important, then you can whip up an ASPX page that displays the audit logs for that record in whatever format you choose and avoid making new relationships for every entity you want to audit.
CRM has a special lookup type that can lookup to many entity types. That functionality isn't available to us customizers, unfortunately. Your best bet is to add each relationship that could be regarding and hide the lookups that aren't in use for this particular entity.