Search
Close this search box.

Useful SSIS Expressions

Change Root Business Unit Name in Dynamics 365 CRM

It is possible to change the root Business Unit Name in Dynamics 365 CRM using SSIS.

We will get the GUID of Business Unit using Advanced Find and Export to Excel.

You’ll need to cast the GUID to a unique identifier in SSIS, with a formula as indicated in the article below, or like this:

(DT_GUID) (“{” +”6ddb52ca-f0df-e711-a95b-000d3a370f0a” + “}”)

Next, we use an SSIS job with one record input including the GUID of the root Business Unit, and a derived column for the “new” name for the Business Unit.

The SSIS job will look like this — see following screenshots.

Convert (Cast) GUID Text String to GUID formatted for import into D365

Convert a GUID text string to a GUID formatted for import to Dynamics 365. You can extract the GUID from a list of users, exported to Excel.

Use the “Derived Column” SSIS component to cast into GUID format.

(DT_GUID) (“{“+[Owner]+”}”)

where [Owner] is the GUID in text format.

Derived Column SSIS component showing how to convert GUID string to GUID formatted for import into Dynamics 365.

T-SQL Case Statement for Status Codes

 
Dynamics 365 Status Codes are easy once you get used to them. You have to make sure they are aligned such that only the “Open” status reasons (statuscode) are associated with the “Open” status code (statecode), and only the “Completed” status reasons are associated with the “Completed” status code.
 
Use a simple case statement to get your data ready for upload to Dynamics 365 CRM through the KingswaySoft D365 Destination component.
 
,CASE [Activity Status]
     WHEN ‘Open’ THEN 0
     WHEN ‘Completed’ THEN 1
     WHEN ‘Canceled’ THEN 2
     WHEN ‘Scheduled’ THEN 3
     ELSE ‘999’
END AS phl_statecode
,CASE [Status Reason] 
     WHEN ‘Completed’ THEN  5
     WHEN ‘Not Started’ THEN 2
     WHEN ‘In Progress’ THEN 3
     WHEN ‘Waiting on someone else’ THEN 4
     WHEN ‘Deferred’ THEN 7
     ELSE ‘999’
END AS phl_statuscode

Note, this works in both Dyanamics 365 (on-premises) and Dynamics 365 online — this example is for online.

Change Root Business Unit Name in Dynamics 365 CRM

It is possible to change the root Business Unit Name in Dynamics 365 CRM using SSIS.

We will get the GUID of Business Unit using Advanced Find and Export to Excel.

You’ll need to cast the GUID to a unique identifier in SSIS, with a formula as indicated in the article below, or like this:

(DT_GUID) (“{” +”6ddb52ca-f0df-e711-a95b-000d3a370f0a” + “}”)

Next, we use an SSIS job with one record input including the GUID of the root Business Unit, and a derived column for the “new” name for the Business Unit.

The SSIS job will look like this — see following screenshots.

Convert (Cast) GUID Text String to GUID formatted for import into D365

Convert a GUID text string to a GUID formatted for import to Dynamics 365. You can extract the GUID from a list of users, exported to Excel.

Use the “Derived Column” SSIS component to cast into GUID format.

(DT_GUID) (“{“+[Owner]+”}”)

where [Owner] is the GUID in text format.

Derived Column SSIS component showing how to convert GUID string to GUID formatted for import into Dynamics 365.

T-SQL Case Statement for Status Codes

 
Dynamics 365 Status Codes are easy once you get used to them. You have to make sure they are aligned such that only the “Open” status reasons (statuscode) are associated with the “Open” status code (statecode), and only the “Completed” status reasons are associated with the “Completed” status code.
 
Use a simple case statement to get your data ready for upload to Dynamics 365 CRM through the KingswaySoft D365 Destination component.
 
,CASE [Activity Status]
     WHEN ‘Open’ THEN 0
     WHEN ‘Completed’ THEN 1
     WHEN ‘Canceled’ THEN 2
     WHEN ‘Scheduled’ THEN 3
     ELSE ‘999’
END AS phl_statecode
,CASE [Status Reason] 
     WHEN ‘Completed’ THEN  5
     WHEN ‘Not Started’ THEN 2
     WHEN ‘In Progress’ THEN 3
     WHEN ‘Waiting on someone else’ THEN 4
     WHEN ‘Deferred’ THEN 7
     ELSE ‘999’
END AS phl_statuscode

Note, this works in both Dyanamics 365 (on-premises) and Dynamics 365 online — this example is for online.

Stay informed with our latest content

opt-in for occasional emails with latest blog articles, promotions, and webinar invites.

Subscribe Our Blog

Hidden

Next Steps: Sync an Email Add-On

To get the most out of your form, we suggest that you sync this form with an email add-on. To learn more about your email add-on options, visit the following page (https://www.gravityforms.com/the-8-best-email-plugins-for-wordpress-in-2020/). Important: Delete this tip before you publish the form.

Download DataStream Checklist of Cybersecurity Requirements for Cyber Insurance gated conent

"*" indicates required fields

Embark on your digital transformation journey with our **Free Small Business IT Assessment** and unlock the potential of cloud technology for enhanced cybersecurity, productivity, and growth.
Stay informed with our latest content:

Contct Us

Schedule a Demo

"*" indicates required fields

Embark on your digital transformation journey with our **Free Small Business IT Assessment** and unlock the potential of cloud technology for enhanced cybersecurity, productivity, and growth.
Opt-in

Schedule a CRM Assessment

"*" indicates required fields

Embark on your digital transformation journey with our **Free Small Business IT Assessment** and unlock the potential of cloud technology for enhanced cybersecurity, productivity, and growth.
Stay informed with our latest content:

Get a Free Quote Today

"*" indicates required fields

Let us know how many licensed Microsoft 365 users you have.
Stay informed with our latest updates:

Microsoft 365 Licensing Consultation

"*" indicates required fields

We would love to answer any questions you may have on Microsoft 365 licensing. Let us know how we can help.
Stay informed with our latest content:
This field is for validation purposes and should be left unchanged.

Download our Microsoft 365 Business Premium * Day 1 * Security Setup Checklist

"*" indicates required fields

Stay informed with our latest content:

Free Small Business IT Assessment

"*" indicates required fields

Embark on your digital transformation journey with our **Free Small Business IT Assessment** and unlock the potential of cloud technology for enhanced cybersecurity, productivity, and growth.
Stay informed with our latest content: