When does the Plugin registered on SetState message fires in Dynamics 365?

Hi,

Recently we were writing a plugin that should fire when a record is activated.

In this kind of scenario, it is suggested\recommended to register plugin in both SetState and SetStateDynamicEntity message.

https://community.dynamics.com/crm/f/117/t/184070

https://blogs.msdn.microsoft.com/crm/2008/03/07/developing-plug-ins-for-crm-4-0/

Interestingly we had the following observations

  • The Plugin fires only for SetStateDynamicEntity message.
  • The Plugin fires even if the SetState message step is disabled or not registered.
  • Only SetStateDynamicEntity message is fired when the record is Activated or Deactivated. For incident entity also, it was the only message fired on Reactivating the record. The plugin didn’t trigger in case of Resolve or Cancel Case.
  • Only SetStateDynamicEntity message is fired, even if we are updating the state of the record using SetStateRequest of SDK.
  • As SetStateRequest message is deprecated, if we use UpdateRequest to update the state of the record, the plugin that is registered on SetState and SetStateDynamicEntity will not fire. It will trigger only if registered for Update message.

Plugin Trace log records :-

We are yet to figure out when exactly the SetState will be fired. Please share your thoughts and experience around the same.

Hope it helps..

My Interview at MSDynamicsWorld.com

Check out my interview at MSDynamicsWorld.com

https://msdynamicsworld.com/story/nishant-rana-goes-man-series-cricket-dynamics-mvp

2018-06-16_0941

Thanks MSDynamicsWorld.com and Linda Rosencrance.

Fixed – Invalid Export Business Process Not Activated error while exporting solution in Dynamics 365

While exporting a solution from our DEV, we got the below exception.

As the messages suggests to fix it we need to activate the process (which will create the corresponding entity for the BPF and add the entity in the solution). Or if already created simply add that entity if missing in the solution.

So we Activated the BPF.

Added the BPF specific entity.

Which then allowed us to export the solution.

Hope it helps..

PLAN PROPERLY before using Back and restore and Copy instances in Dynamics 365

Update – 25 June 2018 – Took nearly 20 days to get both the instances up.

Update – 12 June 2018Support Engineer has been not been able to resolve either of the support ticket which were raised last Thursday 7th June. One instance is not opening and the other instance is not restored with the backup we had requested. They are unable to find the backup till now.

Recently we tried copying our DEV to one of the TEST instances. The idea was we were upgrading the click dimensions solution in our DEV so we wanted to make sure everything works fine after the upgrade and in case it didn’t we could then again copy it back from the TEST.

We had faced back and restore issues (instance failed) in the past so decided to go the Copy instance way this time.

However, we got the Instance Failed error on the TEST instance to which we were copying DEV to.

Interestingly the Edit, Reset, Delete etc option were still available and we could open the TEST instance (the original, as the copy of DEV had failed) without any issues.

Then we thought of giving a try again and started copy from DEV to TEST again. This time again it failed. And with no option of Edit, Reset, delete etc. and the Instance was also not opening.

The error à

Along with that we also tried Restoring the Backup in one of the other TEST instances, that also expectedly failed.

So basically, we ended up with 2 unusable instances.

A few weeks back also we faced the same with our Dev environment and the only way out was to raise the support ticket with Microsoft. That time it took 5 days for DEV to be restored. Imagine the development activity that came to halt.

Last year also we had faced this issue in Production and had to work with the support team for 16 – 20 hours continuously to get it restored.

So, if we have some critical activity planned like Production Deployment and we are counting on Back and Restore or Copy an instance to rescue us in case anything goes wrong after production deployment, we need to plan for this Instance Failure as well while restoring or copying.

Basically, be ready to raise a support ticket with the highest severity to restore things back, which could take hours or in worst case days and do all the production deployment over the weekend or have enough downtime allocated.

Hope it helps..

Using Lookup Transformation and Cache Transformation in SSIS for Dynamics 365 (using Kingswaysoft)

Recently while working in data migration project, we had a requirement to insert a record in CRM from SQL Database and assign it to the team insert.

For e.g.

We had a Transaction Record that had a Brand lookup in it i.e. n – 1 relationship.

And the Brand record had a lookup of Team in it again n – 1. So basically, while inserting the transaction record we wanted to assign the record to the team of the corresponding brand in it.

So, for this, we had to set the owner id and owner id type field while inserting the record.

And for owner id i.e. team GUID we had to do a lookup on the Brand entity.

To achieve so, we did the following step

Added 2 Data flow task in the Control Flow, one for Caching the Brand entity’s detail and other for using the fetching data from SQL DB, Lookup Transformation task and inserting the data into CRM.

For the first data flow task,

We added the Dynamics CRM Source and fetched the Brand Name and Team Lookup’ GUID field.

name field which will be used for mapping and teamid field whose value we need from it.

Then we added a Cache Transform task with following details,

Now for our second data task flow,

First, we added the OLE DB Source to fetch data from the source SQL View, having Brand (string) column in it.

Then we added the Lookup Transformation task with following properties,

Setting Connection to Cache Connection Manager defined earlier.

Now the most important part, the columns properties. Here we defined the mapping between the Brand field of the SQL View and name field of the Brand Entity of CRM and selected the teamid field as the lookup column whose value we would like to fetch as shown below.

Then we added Derived Column task to add one more column for specifying ownerid type field to be used in CRM Destination Component while mapping. We defined the field type as string and hardcoded the value as “team”.

And as the final step mapped the above fields to the corresponding ownerid and owneridtype field in CRM Destination Component for Create operation.

For ownerid, we selected the below option as we were setting the GUID of the team.

On running the package, we can see the transaction records getting created and properly assigned to the corresponding team of the brand.

The transaction record with Team set as Owner.

Brand record with Team lookup in it.

Hope it helps..

Operation on clone solution failed error during solution import in Dynamics 365

We’d get this error if we are trying to import a solution whose upgrade solution is already there in the target system.

So, either we need to Clone the Solution to remove the upgraded solution or we need to delete the Upgrade Solution. Deleting the Upgrade solution will only delete the solution it will not delete the components as it will already be there in the main solution whose upgrade has been imported.


Hope it helps..

The import of the solution failed – The specified role cannot be updated error in Dynamics 365

We got this error while trying to import managed solution to our TEST environment.

The detail of the error message clearly tells the reason for the error.

The error was because that we had a similar a role with same name in our TEST environment, and in DEV we had renamed that existing role and had created a new role with similar name.

So, while trying to import the solution, CRM was getting confused as it was able to find the role with same name but different id.

To fix this either rename the Role in DEV and export and import it back or rename the role in TEST to and them import the same solution.

Hope it helps..

The solution installation or removal failed due to the installation or removal of another solution at the same time error in Dynamics 365

While trying to install a managed solution we were getting the below error

As the error message suggests, at the same time we had the solution upgrade (Apply Solution Upgrade) going on in the same environment.

Installing the solution worked after the solution upgrade successfully completed.

At times we might face SQL Timeout issue while trying to upgrade solution if it contains large number of components in it.

https://nishantrana.me/2016/12/06/sql-timeout-issue-while-trying-to-apply-solution-upgrade-in-dynamics-365/

Hope it helps..

Setting Lookup field in the Dynamics 365 for Sales Connector in Informatica Cloud

Informatica Cloud has recently released new connector for integration with Dynamics 365 named Dynamics 365 for Sales Connector, which uses Web API of Dynamics 365.

Below is how we specify the details of the connection –

Because of lack of documentation for the new connector, while trying to insert a record inside CRM and trying to setup a lookup field we struggled a lot.

Eventually, we realized the format that is required for setting the lookup field.

EntitySetName:(GUID)

i.e.

sab_fash_categories(72e0b837-e060-4a5c-b831-0e8266dd9a56)

Here sab_fash_categories is the EntitySetName of the custom entity sab_fash_item and it is being used as a lookup in another entity.

For the older version of the connector that used OrganizationService, the documentation is available which specifies the following format for the lookups

{SchemaName:GUID} i.e. the way we specify while setting EntityReference field

https://kb.informatica.com/proddocs/Product%20Documentation/6/IC_Spring2017_MicrosoftDynamicsCRMConnectorGuide_en.pdf

ER

Hope it helps..

Limitation of Solution Patch in Dynamics 365

Recently while working with a Solution Patch we came to realize one of its limitation (or feature) which we weren’t aware of.

If we are trying to update a component through the patch, and that particular component has been customized in the target environment ( through default solution in case of managed), the update won’t work on that component.

Let us take a simple example to understand this.

Below we have created a solution with one workflow in it named Test Process.

Now let us export the solution as managed and import it in Test.

Now back in our DEV let us rename the Process and create a patch for it and import it in Test.

https://nishantrana.me/2016/09/22/creating-patches-solution-management-in-crm-2016/

We can see the update in the name after applying\importing the patch.

Now let us go back in our DEV and make some update in the name of the process and import it again in the Test.

We have selected the option of overwriting customizations here.

We can see the update in the TEST after importing the patch.

Now comes the interesting part, in the TEST environment, go to Settings – Customizations and rename the Process. Here we have appended “Updated” in its name.

Now let us import the same Patch Solution back in our TEST with Overwrite selected.

Unexpectedly, we do not see any change, the process is unchanged in the TEST even after importing the patch with Overwrite option. We expected it to be renamed to Test Process Patch Version 1 as it was in the patch solution, instead, it has the suffix Updated to it i.e. the changes that we made directly in the TEST through default solution.

The way we can now update it from DEV is to clone our solution there.

Import it to TEST and apply Solution Upgrade.

Below we can see the new version imported into the TEST and as expected the Process renamed to what it was in DEV.

Hope it helps..