Is there a way how to recreate a field for a Dynamics CRM entity? - dynamics-crm

Our particular situation is that we have a DateOnly field and would like to change it to DateTime field supporting also the time portion. The operation is not allowed in UI and it's also stated in the documentation. Hence, I excepted deleting the field and recreating it with the new setting would work.
However when I try to create the field with the same name the Duplicate Field Name error is thrown. I've read the column actually still exists behind in the DB.
Of course, I could create a field with a new name but it would require changing all related workflows and code customizations.
Is there a way how to overcome this issue?

Deleting and recreating an attribute with the same name but different type should work - of course with the caveat that you have to remove all dependencies before deleting the attribute and recreate them with the new attribute.
The Duplicate Field Name error seems to indicate that the field still exists - perhaps the entity needs to be published after deleting.
You may also find the XrmToolbox tool Attribute Manager helpful.
It allows you to migrate an attribute and its data to a new attribute.

Related

How to undelete a field in MSCRM entities

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.

Change length of name fields

We are using Dynamics CRM 2016 on-premise. When you create a custom entity, you get a default "name" field which is a string with 100 characters. You can change that datatype during entity creation but we didn't do that.
Now we learned that 100 chars are not enough in our usecase, we would need 120 or 150.
The solution designer allows changing the string length but when we save the changes we get a generic database error.
Question: Is there a known workaround to change the string length of the main field?
Obviously, it is possible to create a new entity and copy the data from the old to the new entity. Since we have many views, forms and references between entities, this is not really feasible.
This is not possible using any conventional solutions (i.e. through the UI) due to constraints in the Database. The default name field is the primary key of the table. I encourage you to remake the entity and migrate existing data to the new entity.
If this is really not feasible then you can try to change the length of the column directly in the SQL DB, but that is unsupported so it might break the environment. If you want to try this be sure that you test this in an disposable environment.
I have never done it so I don't know the outcome but that is something that I would try.

Is it possible to change primary field of custom entity after it has been created in dynamics 365?

I have many custom entities for that I need to change primary field, I already know creating workflow that will update values of primary field by coping it from different field. But I don't want to do that.
Is there any way to change primary field of custom entity after it has been created?
The primary field of an Entity (as well other custom fields) cannot be changed after the creation. If you must change the primary field name, you need to delete and recreate the Entity.
You said change, what kind of change you need. Pick your answer from below.
On Create of new entity: changes in primary field (new_name)
Display name change - possible.
Data type change - impossible.
Schema name change - possible.
Requirement level change - possible.
On Update of entity: changes in primary field (new_lookupdisplaytext)
Display name change - possible.
Data type change - impossible.
Schema name change - impossible.
Requirement level change - impossible.

Encounter code 106 error, when parse class column name is changed

During development stage, sometimes I changed the column name of a parse class and my Query.find() is returning the following error
{"code":106,"message":"key objectId not present"}
The parse help says, I am tinkering with the internals of parse. Certainly no.... Is this a known issue? Do i need to clear the session or something like clear the schema cache?
Please help.
Changing a column name in a class on parse server is not (yet) available as of parse server 2.2.9.
I assume you are changing its name directly in the mongoDB so it is clearly tinkering with the internals of parse server.
However you could technically change a column name if you know which data to adapt, e.g. the _SCHEMA collection (only visible in the database, not in the dashboard) has to account for the new name as has the field name of every document in the collection.
The easier way to do it is deleting the column you don't need and creating a new one with the desired name in parse dashboard. And maybe planning a bit further ahead so you don't have to change column names so often ;)

Show Order ID in Dynamics CRM Order Look up instead of Order Name

In Dynamics CRM 2016 (on-prem), I've custom child entity Partiesthat have a look of type order. Currently it is working properly and it is showing order name but I want it to show Order ID.
I tried to resolve by creating my own view, adding order id field only and making it default view for the look up but it don't meet my requirements.
This is controlled by the lookup view for Orders. The first three fields in the lookup view are shown when selecting records from the lookup field.
You cannot change the position of (or remove) the Name field from the lookup view. That still leaves you with two additional fields to be shown, one of which could be the Order ID.
I know no supported ways around this (except creating a workflow to copy the Order ID to the Name field and adding a custom name field instead, if you really insist).
Changing what appears on the form after you make a selection in a lookup field is not possible, unfortunately. The primary attribute is always what gets displayed after a user specifies a lookup value (which, for the Order entity, is the Name attribute). As Henrik's answer mentions, people commonly get around this by copying the value they want to see into the primary attribute using a workflow or a plugin.

Resources