Using CDS/CRM Connection Manager of KingswaySoft’s SSIS Dynamics 365 Integration toolkit in Script Component (SSIS)

Recently for one of our requirements we had to use the CDS/CRM Connection of KingswaySoft’s SSIS Integration Toolkit for Dynamics 365

Below are the steps to be followed –

Drag the Script Transformation component, specify any input columns and inputs / outputs as required.

In the Connection Managers add the connection to Dynamics 365

Click on Edit Script to open the Visual Studio.

Add references to below 3 assemblies. We need to search for the 2 KingswaySoft assemblies in the machine and then add them.

The sample code –


public override void Input0_ProcessInputRow(Input0Buffer Row)
{
var connMgr = this.Connections.CRMConnectionManager;
var connectionString = (string)connMgr.AcquireConnection(null);
var conn = new CrmConnection(connectionString);

var orgService = (IOrganizationService)conn.GetCrmService();

RetrieveRequest retRequest = new RetrieveRequest();
retRequest.ColumnSet = new ColumnSet();
retRequest.ColumnSet.AddColumn("statuscode");
retRequest.Target = new EntityReference("dxc_contract", "dxc_contractnumberinternal", Row.dxccontractnumberinternal);
var response = (RetrieveResponse)orgService.Execute(retRequest);

if (response.Entity != null)
{
// status is closed
if (((OptionSetValue)response.Entity.Attributes["statuscode"]).Value == 282210002)
{
Row.IsApprovedContract = "N";
}
else
{
Row.IsApprovedContract = "Y";
}
}
}

Get all the details here

http://www.kingswaysoft.com/blog/2013/06/24/Writing-Script-Component-or-Script-Task-using-CRM-Connection-Manager

Hope it helps..

Advertisements

Assembly must be registered in isolation error while trying to register plugin \ custom workflow activity in Isolation Mode None in Dynamics 365 On Premise

While trying to register our custom workflow activity from Isolation mode – Sandboxed to None for Dynamics 365 On Premise we got the below error

This was because the user through which we were trying to register the plugin in None Isolation Mode using Plugin Registration Tool was not having Deployment Administrator role.

Adding the user to that Deployment Administrator role through Deployment Manager fixed the issue.

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/on-premises/deployment-administrators

Read more about it

https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/developers-guide/gg309620(v=crm.8)#security-restrictions

Hope it helps..

Scribe Insight Limitation – XML Source doesn’t support repeating sibling nodes

Recently we were evaluating Scribe Insight as our Integration tool for one of our clients. The requirement was to read an xml and create records in Dynamics 365 CE.

The basic structure was something like below, with Account as the parent tag and Payment, Assets, Consumer as repeating child nodes of Account i.e. 1 – n.

However, to our surprise when we started defining the same structure in the XML Component within Scribe Workbench we got the below error message à

—————————

XML Component

—————————

Repeating nodes are not supported for cousins, siblings, etc. Multiple repeating nodes must be related linearly to repeating nodes that already exist. Thus, a new repeating node must be a grandparent, parent, child, grandchild, etc., to an existing repeating node.

—————————

OK

—————————

Interestingly enough the same limitation doesn’t exist in Scribe Online. Had posted something similar few days’ back on that

https://nishantrana.me/2019/01/14/scribe-online-working-with-hierarchical-data-in-dynamics-365-ce/

As we wanted to go with something that works in On Premise setup we went ahead with SSIS Productivity Pack of KingswaySoft https://www.kingswaysoft.com/products/ssis-productivity-pack which had XML components that works perfectly well with this kind of schema or structure.

Hope it helps..

Scribe Online – Working with Upsert Block in Dynamics 365 CE

Continuing our previous posts on Scribe Online, let us look at the Upsert block for Dynamics 365 CRM Connector.

The way it works is à

The Upsert block will have a field called alternatekeyname where we need to provide the name of the alternate key as shown below.

In CRM à

Along with passing the value for the field(s) involved in the alternate key.

The way to achieve the same in Informatica Cloud

https://nishantrana.me/2018/05/18/using-alternate-key-to-upsertupdate-using-dynamics-365-for-sales-connector-of-infomatica-cloud/

Do check out this wonderful article that explains the usage of Upsert Block, Custome Update + Insert and Update/Insert block.

https://www.scribesoft.com/blog/2014/11/updateinsert/

Hope it helps..

Scribe Online – Working with Hierarchical Data in Dynamics 365 CE

In the previous post, we saw how to create XML connection and using it as a source to create records in Dynamics 365 CE.

https://nishantrana.me/2019/01/11/scribe-online-xml-to-dynamics-365-ce/

In this post, we will see how to consume the hierarchical XML data as a source and create parent-child records in Dynamics 365 CE.

Suppose this is our source data with the following relationship

Contact à n Contract à n Asset à n Asset Line

As a first step we need to get the XSD for it, which we will use while defining the XML connection.

https://www.freeformatter.com/xsd-generator.html

Our XML connection

Similarly, add the CRM Connection.

This is how our final mapping will look like

For Query Contact Block (xml) à select Entity as Contact.

For the Include tab, we have selected all the child (tag) entities to be included.

For Create Contact (CRM) block we have mapped the first name and last name field

For For Each Child block select the relationship.

Followed by Create Contract block with following fields mapping.

Here we are setting the contact’s lookup in the contract entity using the Results from Contact Create steps.

Repeat the same steps for remaining child entities like Asset and Asset Line by selecting the relationship in for each child block and in the next create step setting the fields appropriately.

Validate and close the map and run the solution.

On successful run, we can see the records created in CRM

Hope it helps..

Scribe Online – XML to Dynamics 365 CE

Follow the earlier posts to create the Scribe Online trial and steps to create an integration solution.

Below is our sample XML file that holds the contact information that we want to create inside Dynamics 365 CE

For creating XML connection, we need the XSD file.

So let us generate the XSD file using the below tool

https://www.freeformatter.com/xsd-generator.html

The generated XSD –

Now install the XML Connector from the Marketplace.

Then create a new connection specifying the XML File and the XSD File.

Let us create the integration solution, go to Solution and click on create a new integration solution

Create a new integration map for the solution as shown below

Add the XML connection and the CRM Connection to the map and drag the Query block (XML Connection)

For Query Block select the contact entity.

The add the For Each Result block and insert the Create block (CRM) within it

For Create block, the select entity as Contact.

For the Fields tab, map the source fields to the target.

Click on ok to close the map editor and back in Solution, click on RUN to execute the solution.

After successful completion,

The success.xml created in the same folder where we had XML source file.

And also, we can see the records created in CRM.

In the next post, we will see how we can consume hierarchical XML data to create parent-child records in CRM.

Hope it helps..

Working with OptionSet \ Picklist in Scribe Online

Scribe Online makes it very easy to work with OptionSets while writing Integration and Replication solutions.

While creating the Dynamics 365 CE connection we can check the Include Picklist Display Names checkbox.

Scribe generates a corresponding field schemaname_displayname that holds the label for the corresponding option set.

Within our Query Block inside an integration type solution, we can see the display name fields added for each corresponding option set field.

Go to the Preview tab

Here we can see leadqualitycode_displayname, leadsourcecode_displayname etc. field added.

Within our Filter criteria, we can directly refer the label as shown below.

We can get the label from the Preview tab itself by clicking on the information icon next to the field as shown below instead of opening CRM.

Hope it helps..

Using Scribe Online Replication Services (RS) to replicate Dynamics CE Data

Scribe Online provides Replication Services that makes it extremely easy to replicate the data, schedule it and also includes auto-detection of changes.

Follow previous posts to create a free trial of scribe online and create a connection for SQL Server On-Premise and Dynamics 365.

Here we will be creating a Solution of type Replication.

Login to Scribe Online

https://app.scribesoft.com

In the Dashboard, select create new Replication option for the Solution.

Here for simplicity, we will be replicating Lead data to our SQL On-Premise database.

Specify CRM Connection for Source Connection and SQL On-Premise Database for the Target Connection

In Select Entities dialog box, we will be selecting the Lead entity.

This is how our replication solution looks like

Click on RUN to start the execution

Once it completes successfully, we can see the records processed, the duration it took and records inserted per seconds in the execution history.

Back in our Database, we can see the table created and all the leads record inserted

Here for option set and status fields we can see the _displayname field added that holds the corresponding display name for the option set’s value. This is governed through the connection properties.

Now let us run the solution again immediately.

We’d see no records processed.

Now let us create a new lead inside CRM and run the solution again.

We can see that record processed.

Now let us delete records from CRM and run it again. Here we have deleted 250 records.

We will see the 250 records processed and deleted from our table in the database as well.

Now let us update one of the lead records and run the solution again. On successful completion we can see 1 record updated by the solution.

Thus the replication services makes very efficiently manages the replication of the data considering all the scenario like create, update, delete.

Hope it helps..

Scribe Online – Create Integration Solution from SQL On-Premise to Dynamics 365 CE Online

In the previous posts, we saw how to create a connection for Dynamics 365 and then how to use the connection to create an integration solution for deleting Dynamics 365 records.

In the post, we’d see how we can connect to SQL On-Premise and create records in Dynamics 365 CE

Sign in to Scribe Online

https://app.scribesoft.com/

For connecting to On-Premise SQL Server we would need to first configure the On-Premise Agent.

Go to Dashboard à Add a new Agent

Click on + install On-Premise Agent

Copy the Agent key presented in the next screen this will used while running the setup for the Scribe On-Premise agent.

After successful installation, we can see the agent running within the Dashboard.

From the Marketplace Install the SQL Server connector.

Now let us create a new SQL connection, to connect to our SQL Express database.

Make sure we have selected the On-Premise Agent. Click on TEST to test the connection.

Next, we will create/ use the existing Dynamics 365 CE connection that reads data from the SQL On-Premise database and creates contact records in Dynamics 365 CE.

Go to the Dashboard and click on + to add a new solution in the Solutions section.

Create a new integration map

Add the SQL Connection and CRM Connection created.

We have dragged the Query block from SQL Connection and selected the Contact table as the entity. Next, we add the For Each Result block and added the Create block from CRM Connection and selected the Contact entity for which we want to create records.

Double click on the Create Contact block for mapping.

In the fields tab, drag the fields of the table to the corresponding fields in the Target CRM Connection.

Let us close the map and the solution and click on RUN to run the solution.

We have the following 2 records in our source SQL On-Premise table.

We can see the details in the Execution History on successful completion.

Back in our Dynamics 365 CE, we can see the contact records created.

In the next posts of the series, we’d explore some more features of the Scribe Online.

Hope it helps..

Scribe Online – Creating your first integration solution for Dynamics 365 CE

In the last post, we created the connection for Dynamics 365 CE

https://nishantrana.me/2019/01/08/getting-started-with-scribe-online-connecting-to-dynamics-365-ce/

Here we will create the integration solution that would consume that connection.

We will take the following simple scenario to understand the basics.

“Delete all the leads with Status = Disqualified”

Let us get started à

Login to Scribe Online

https://app.scribesoft.com

Go to Solution Tab and click on + to create a new solution of type Integration

The solution screen provides the option to define the trigger for the Solution, it could be either on demand or can be scheduled to run once or on recurring basis.

The interface for defining the recurrence

For our example, we are keeping it as on demand.

Next, we need to define the MAPS that holds the processing logic of our Solution. Click on the Create Integration Map option to create the map.

Inside the Map designer, click on Add Connection to add the connection that we created earlier to connect to our Dynamics 365 CE.

Here we have added our CRM Connection created earlier.

This adds the block for our CRM Connection for various operations that can be performed.

Here we will first add the Query block to retrieve all the leads in the state disqualified, followed by For Each Result block to loop through all the records and Delete block to delete those records.

Drag the Query Block, double click on it

Select Lead as Entity and click on Filter to define the filter condition i.e. statecode equals “Disqualified'”

Next drag For Each Result block below the Query lead block.

Followed by dragging the Delete block inside the For Each Result and double click it.

Specify lead as the entity and click on Matching Criteria tab

Specify leadid as the field to be used for delete and for Value click on the formula icon

Select the lead as the source and leadid as the field that we would be using from the source Query Block and click on Validate to verify the condition.

Close the Map dialog boxes back in our home pages’ Solutions tab, we will see the status as preparing.

Once prepared we can click on RUN to execute the solution. The execution history will show the details of the run.

After successful completion à

Back in CRM, we can see all the disqualified lead records deleted.

In the next posts, we will try covering other features of the Scribe Online with regards to Dynamics 365 CE

https://nishantrana.me/2019/01/09/scribe-online-create-integration-solution-from-sql-on-premise-to-dynamics-365-ce-online/

Hope it helps..