Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Data Transfer between two online Dynamics 365 trial instances by custom code

Posted on by

Hi,

Is it possible to send all the account data created in one "online dynamics 365 trial instance" to another "online dynamics 365 trial instance" by using custom work flow?

Data should flow on creation only, if it already exists in the target system, it should be updated on updation in the source system.

Apart from  custom workflow, is it possible by any other way?

Thanks

Amit Kumar Rath

*This post is locked for comments

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    You get that error because some classes/methods you're trying to use are not allowed in SandBoxed environment.

    My suggestion - you should go Azure Bus way or Azure Functions to reach your goal.

    Good luck.

  • RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    1 )Error I am getting:

    ----------------------

    Unexpected exception from plug-in (Execute): IntersystemData.IntersystemData: System.Security.SecurityException: Request failed.

    2 )Custom WorkFlow I am using:

    -----------------------------------

    protected override void Execute(CodeActivityContext executionContext)

           {

               ITracingService tracingService = executionContext.GetExtension<ITracingService>();

               //Create the context

               IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

               IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();

               IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

               AdminCrmService = serviceFactory.CreateOrganizationService(null);

               try

               {

    --------------------------

    ----------------------

    -----------------------

              tracingService.Trace("Before successful Connection with the target system");

                   _targetorgservice = TargetInstanceConnection();

                   tracingService.Trace("Connection successful with the target system");

    -------------------------

    -------------------------

    ------------------------

    }

    }

    //TargetInstanceConnection definition

    private OrganizationServiceProxy TargetInstanceConnection()

           {

               OrganizationServiceProxy _service = null;

               try

               {

                   ClientCredentials cre = new ClientCredentials();

                   cre.UserName.UserName = "crmadmin@LTI0001.onmicrosoft.com";

                   cre.UserName.Password = "Welcome@123";

                   Uri serviceUri = new Uri("lti0001.crm8.dynamics.com/.../Organization.svc&quot;);

                   OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, cre, null);

                   proxy.EnableProxyTypes();

                   _service = (OrganizationServiceProxy)proxy;

                   return _service;

               }

               catch (Exception ex)

               {

                   throw ex;

               }

           }

  • RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    I wrote a custom workflow which fires on creation, on change of all the fields, status change. It takes the account id as input argument. Then I tried to connect with the other trial instance by creating service proxy. My logic was if the account id does not exist in the target instance, then create it else update it.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    Sure, please share the code (and the error message)

    Also, did you try that code in a standalone application (console app on your machine, for example)? Just to make sure it works.

  • RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    Hi,

    I tried the same but I am getting error with the privilege issue. I am trying to connect the other instance with the credentials of the system customizer and administrator. If you want, I can share the code also.

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    You can create a custom workflow activity and do it that way - you'll just need to create an additional connection to another CRM instance from your code(which, I think, is totally fine in the online environment as well)

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    Everything is possible. You can use SSIS or Scribe or console application.

  • RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    Thanks for the input Andrew!!

    Is it possible by any other way by using custom code e.g. plugin or console application?

  • Suggested answer
    prt33k Profile Picture
    prt33k 6,907 on at
    RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    No,  CRM online instance wont communicate with each other directly.,

    You need to write a custom logic /layer to get the data pass through.

    The better way will be to use ConfigurationMigrationTool that comes along with SDK. The tool can transfer record from one instance to other instance.

    Other option will be to use Scribe or SSIS.

    Thanks,

    Prateek

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Data Transfer between two online Dynamics 365 trial instances by custom code

    Hello,

    I don't think you can do it using workflow. You should consider usage of Flow - flow.microsoft.com/en-us

    Good luck.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans