Massively updating fields from Excel - dynamics-crm

A common way to massively update fields of entities is to use the export/import functionality of Dynamics CRM:
You can use the AdvancedFiend feature to select records of interest.
Export them via the Export feature to Excel (enabling the option "Make this data available for re-importing by including required column headings").
Update cells in the Excel sheet.
Import that sheet once again with the Import feature of Dynamics CRM.
Now I have an Excel sheet with columns (fields) and rows (records) which holds data of the entity "contact" - but this sheet does not come from Dynamics CRM, but was manually created. The header could look like:
| contactid | firstname | lastname | birthdate | fax |
As you can see I have the contactid (the primary key) of a contact and its related fields. All the contacts in the sheet already exist in the CRM and need to be updated.
QUESTION:
How can I update the CRM with the data of my Excel sheet WITHOUT writing an individual tool, but by using the standard functionality of CRM (Import, Workflows etc.)?
Once again: The sheet was not exported from the CRM before.
With best regards,
Michael

A very similar question was asked the other day in this thread on the Dynamics Community forums , and answered in some detail:
https://community.dynamics.com/crm/f/117/t/182988
tl;dr: Create a custom entity with a lookup to Contact, import your date to that and use a Workflow to copy the relevant fields to the Contact records.
Or export all Contacts for reimport (with the columns that you need to update), populate the data of the records you need to change and reimport. Any unchanged rows will be dropped by the import process.

Unfortunately, the import process in CRM requires you to meet the standard format specified by the process. So you can either manually transform the excel sheet to meet the standard, write a tool to do it, or search for a tool that had already been written.

Related

Loading records into Dynamics 365 through ADF

I'm using the Dynamics connector in Azure Data Factory.
TLDR
Does this connector support loading child records which need a parent record key passed in? For example if I want to create a contact and attach it to a parent account, I upsert a record with a null contactid, a valid parentcustomerid GUID and set parentcustomeridtype to 1 (or 2) but I get an error.
Long Story
I'm successfully connecting to Dynamics 365 and extracting data (for example, the lead table) into a SQL Server table
To test that I can transfer data the other way, I am simply loading the data back from the lead table into the lead entity in Dynamics.
I'm getting this error:
Failure happened on 'Sink' side. ErrorCode=DynamicsMissingTargetForMultiTargetLookupField,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=,Source=,''Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Cannot find the target column for multi-target lookup field: 'ownerid'.
As a test I removed ownerid from the list of source columns it loads OK.
This is obviously a foreign key value.
It raises two questions for me:
Specifically with regards to the error message: If I knew which lookup it needed to use, how can I specify which lookup table it should validate against? There's no settings in the ADF connector to allow me to do this.
This is obviously a foreign key value. If I only had the name (or business key) for this row, how can I easily lookup the foreign key value?
How is this normally done through other API's, i.e. the web API?
Is there an XRMToolbox addin that would help clarify?
I've also read some posts that imply that you can send pre-connected data in an XML document so perhaps that would help also.
EDIT 1
I realised that the lead.ownertypeid field in my source dataset is NULL (that's what was exported). It's also NULL if I browse it in various Xrmtoolbox tools. I tried hard coding it to systemuser (which is what it actually is in the owner table against the actual owner record) but I still get the same error.
I also notice there's a record with the same PK value in systemuser table
So the same record is in two tables, but how do I tell the dynamics connector which one to use? and why does it even care?
EDIT 2
I was getting a similar message for msauto_testdrive for customerid.
I excluded all records with customerid=null, and got the same error.
EDIT 2
This link appears to indicate that I need to set customeridtype to 1 (Account) or 2 (Contact). I did so, but still got the same error.
Also I believe I have the same issue as this guy.
Maybe the ADF connector suffers from the same problem.
At the time of writing, #Arun Vinoth was 100% correct. However shortly afterwards there was a documentation update (in response to a GitHub I raised) that explained how to do it.
I'll document how I did it here.
To populate a contact with against a parent account, you need the parent accounts GUID. Then you prepare a dataset like this:
SELECT
-- a NULL contactid means this is a new record
CAST(NULL as uniqueidentifier) as contactid,
-- the GUID of the parent account
CAST('A7070AE2-D7A6-EA11-A812-000D3A79983B' as uniqueidentifier) parentcustomerid,
-- customer id is an account
'account' [parentcustomerid#EntityReference],
'Joe' as firstname,
'Bloggs' lastname,
Now you can apply the normal automapping approach in ADF.
Now you can select from this dataset and load into contact. You can apply the usual automapping approach, this is: create datasets without schemas. Perform a copy activity without mapping columns
This is the ADF limitation with respect to CDS polymorphic lookups like Customer and Owner. Upvote this ADF idea
Workaround is to use two temporary source lookup fields (owner team and user in case of owner, account and contact in case of customer) and with parallel branch in a MS Flow to solve this issue. Read more, also you can download the Flow sample to use.
First, create two temporary lookup fields on the entity that you wish to import Customer lookup data into it, to both the Account and Contact entities respectively
Within your ADF pipeline flow, you will then need to map the GUID values for your Account and Contact fields to the respective lookup fields created above. The simplest way of doing this is to have two separate columns within your source dataset – one containing Account GUID’s to map and the other, Contact.
Then, finally, you can put together a Microsoft Flow that then performs the appropriate mapping from the temporary fields to the Customer lookup field. First, define the trigger point for when your affected Entity record is created (in this case, Contact) and add on some parallel branches to check for values in either of these two temporary lookup fields
Then, if either of these conditions is hit, set up an Update record task to perform a single field update, as indicated below if the ADF Account Lookup field has data within it

Generating unique IDs for new records and existing records

I'm basically trying to create a primary ID between CRM and QuickBooks. Figured I'd just use the existing PK in CRM for the lookup. I'd like the PK to visible to the user, but not editable in CRM.
This has presented several problems in that you can't do that out of the box. I thought I read somewhere you could either via business rule or calculated field, but I haven't had luck with that.
It sounds like it would require web resources if I were to go this route.
The other option would be to just generate unique values for every record in Accounts and Contacts.
Does this automatically populate existing records or just new records? How do I get it to populate existing records?
You can use Auto number manager for configuring an auto-number attribute in every entity. This seeds a number based on configured format for new records. Uniqueness assured by SQL sequence feature & no need of any extra plugin/workflow.
For existing records - you can design a workflow along with a temp entity to assign auto-number. Read more.
Otherwise you can use SSIS + Kingswaysoft package to generate auto-number & assign for existing records.
I am suggesting you to create a new text field on the entity and create a pre plugin that will get the record primary GUID id from context and will set this GUID into the newly added attribute. You can set this field as read-only of form as well.
OR you can generate new GUID as well into the plugin.

Dynamics 365 9.1 - Import data from excel for external entity

I'm trying to import data describing contacts from excel file.
Under my Contact entity Iv'e created a relationship to a new customized entity (Source).
How can I import data about my contacts from excel file including the Source which is a different entity Iv'e created?
When I import the data, there's no option to mention that the Source field is a lookup to another entity.
Thanks everyone,
Idan
When you set up your Contact import file you can add a column to identify the Source. The most obvious options would be the name or the ID.
Here's an example of adding the Account name to a Contact import:
When you do the mapping, you can tell it which field on the Source entity to map to. In the above example, it maps to Account Name.
During the import, lookup fields will take the right related value by searching the Name of that record like:
CustomerId(string);CountryId(lookup);
exampleCustomerId; Italy;
Italy is the name of that specific record.
Relationship is automatically solved.
Hope it helped :)

Bulk update of contacts with related records

I have a requirement to perform a bulk update on Contacts using Excel Online, but there is a set of entities with a N:N relationship to Contacts that need to be filled in order to facilitate data input.
As it's impossible to edit this kind of relation for each contact record in Excel Online, I would like to receive recommendations to overcome that limitation.
It’s going to be a manual exercise of having multiple files/sheets, with the help of vlookup or some macros - you have to manipulate (copy/paste?) the result to Excel online sheet.

Deletion of record from Microsoft CRM Based on three fields(KINGSWAYSOFT)

I have flatfile source and dynamics crm destination.I have to delete a record from CRM based on Title(text), Startdate(text) and userid(lookup field in CRM) which is given as input from flatfile.Can you suggest how can I achieve this.
Thanks
You can take a look at our Premium Lookup component in the SSIS Productivity Pack, which allows you to perform a lookup against your CRM source. The Premium Lookup component takes two inputs - Primary Input and Lookup Table Input. In your case, you can specify the flat file source component as your Primary Input and use CRM Source component as the Lookup Table Input. With that being done, you should be able to get the corresponded records in the Matched Rows ouput, which can be used to pushed to the CRM Destination component and perform a Delete action. Hope this helps.

Resources