web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Import solution using SDK does not enable plugin steps

(0) ShareShare
ReportReport
Posted on by

Hi. I've written some code that imports a solution using the ImportSolutionRequest.

I execute the request with ExecuteAsyncRequest, and then periodically check the status of the request to see if the import was successful. Then I execute a PublishAllXmlRequest.

When I do this, everthing works fine, EXCEPT that I have a whole lot of Plug-in Steps that are disabled.

The Weird thing is if I import that same solution manually using the web client, the plug-in steps get enabled just fine.

Any ideas what could be causing this? Am I missing something?

Thanks

(I've included the code below if it helps)

        byte[] fileBytes = File.ReadAllBytes("Solution Files\\" + solutions[i]);

                ImportSolutionRequest impSolReq = new ImportSolutionRequest()
                {
                    CustomizationFile = fileBytes,
                    ImportJobId = Guid.NewGuid(),
                    OverwriteUnmanagedCustomizations = true,
                    SkipProductUpdateDependencies = true,
                    PublishWorkflows = false,
                   
                };
                ExecuteAsyncRequest importRequest = new ExecuteAsyncRequest()
                {
                    Request = impSolReq
                };
                ExecuteAsyncResponse importRequestResponse = (ExecuteAsyncResponse)_client.Execute(importRequest);

                // Block for 30 seconds
                string solutionImportResult = null;
                while (solutionImportResult == null)
                {
                    System.Threading.Thread.Sleep(30000);

                    Console.Write(".");

                    Guid asyncJobId = importRequestResponse.AsyncJobId;

                    Entity job = (Entity)_client.Retrieve("asyncoperation",
                        asyncJobId,
                        new ColumnSet(new System.String[] { "asyncoperationid", "statuscode", "message" }));

                    int jobStatusCode = ((OptionSetValue)job["statuscode"]).Value;

                    switch (jobStatusCode)
                    {
                        // Success
                        case 30:
                            Console.WriteLine(" Done");
                            solutionImportResult = "success";
                            break;

                        //Pausing //Canceling //Failed //Canceled
                        case 21:
                        case 22:
                        case 31:
                        case 32:
                            throw new Exception(string.Format("Solution Import Failed: {0}{1}",
                                jobStatusCode,
                                job["message"]));
                        default:
                            break;
                    }
                }
                if (solutionImportResult=="success")
                {
                    PublishChanges();
                }

*This post is locked for comments

I have the same question (0)
  • Verified answer
    thewrongmans Profile Picture
    on at

    I found the problem. PublishWorkflows must be set True - this governs enabling Plugin Steps during import - not just workflows as the name suggests. The SDK documentation does not clearly explain this.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans