D365 Convert a Note to a Post:
Here at Dynamics Chronicles, we are all nice guys!
During an episode of XrmToolCast, our editor Lloyd Sebag agreed to make an article detailing how to convert a Note to a Post, or a Post to a Note. So here we go :)
Of course, the first option that comes to mind is the "bazooka option": go full custom! Create an application console, connect to your CRM, retrieve the records, convert them and push them back.
Another option would be to go custom, but without any code using Power Automate. But it still requires Azure and it's not that trivial.
Therefore, we will go another way, the "community option" using the XrmToolBox!
We could create an OnDemand workflow and, if the workflow will need to be ran for more records than one would want to do manually, use the XrmToolBox's Bulk Workflow Execution to run the workflow for all records.
But because the community is so amazing, we can use two other tools without a need for an On Demand workflow, Export To Excel and Data Impot++
Let's start at the end: creating the new records. We don't need all fields to create a post or a note. Below are two screenshots of the Data Import++ tool for importing those two records.
- Notes with the annotation entity
Obviously, the fields objectid and regardingobjectid must be adapted for Contact and Accounts, meaning one Excel file for each.
Before importing and creating the new records, we need to export the source records. For that, a simple export to excel does the trick. Below are the two FetchXML used in the Export to Excel tool
- For the Post records
- For the Notes records
Then the mapping is important.
Post based on Notes: four columns for the import
- A note that a Title and a Content, but a post only has an unique text field. So there a concatenation of the two fields is easily done.
- Note that the annotation field Content - technical name notetext - is sometimes an HTML field. It's easy to remove the HTML tags on Excel, for example with a Find & Replace for "<*>"".
- Set to 2 here
- Set to annotation's field _objectid_value
- Set to 1 here
Notes based on Posts: three columns for the import
- Title of the note
- Set to post's field text
- Set to post's field _regardingobjectid_value