locked
KingswaySoft error when setting statecode to inactive RRS feed

  • Question

  • When performing and update statecode to inactive using SSIS and the KingswaySoft adapters I get the below error. Are there any suggestions to resolve this issue?

    CRM service call returned an error: CRM service call returned an error: An unexpected error occurred.(Error Code: -2147220970, Detail Message: An unexpected error occurred.) 

    Is it possible to capture the web service messages between SSIS/KingswaySoft and CRM using Fiddler? I have tried with no success.

    Tuesday, April 5, 2016 1:56 AM

Answers


  • The error seemed to be with updating state code using an alternative key as the update of state code with primary key worked fined. After updating to version 7.1 of the KingswaySoft adapters the issue was resolved and I could update the state code using alternative keys.
    • Edited by Dean776 Tuesday, April 19, 2016 4:07 AM Fix formatting
    • Marked as answer by Dean776 Tuesday, April 19, 2016 4:08 AM
    Tuesday, April 19, 2016 4:07 AM

All replies

  • Hi,

    I have not tried fiddler in this case but an issue I have encountered before with setting statuses is that you should set both the statecode and statuscode together and not just one, this may be a solution to your original error.

    William

    Tuesday, April 5, 2016 2:50 AM
  • Thanks William, I did try this but still got the above error. I will try setting both the statecode and statuscode again just to double check.

    I also executed, successfully, the below console app code.

    class Program
        {
            static void Main(string[] args)
            {
                var connectionString = "Url=<URL>; Username=<USER_NAME>@<DOMAIN>.onmicrosoft.com; Password=<PASSWORD>;";
                var connection = CrmConnection.Parse(connectionString);
    
                using (var service = new CrmOrganizationServiceContext(connection))
                {
                    var contactId = Guid.Parse("<GUID>");
                    var entity = new Entity("contact", contactId);
                    entity["statecode"] = new OptionSetValue(1);
                    //entity["statuscode"] = new OptionSetValue(2);
                    service.Update(entity);
    
                    var state = new SetStateRequest
                    {
                        State = new OptionSetValue(1),
                        Status = new OptionSetValue(2),
                        EntityMoniker = new EntityReference("contact", contactId)
                    };
    
                    var response = (SetStateResponse) service.Execute(state);
                }
            }
        }
    


    Tuesday, April 5, 2016 3:10 AM
  • Hi,

    Is this an online or on-prem version of CRM? How have you set up the changing of state in the SSIS package?

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    Tuesday, April 5, 2016 7:43 AM
  • Hi Dean, 

    This is a vague error message. Since the error comes from CRM server side, the only option to troubleshoot the error is to turn on CRM trace log on CRM server side.

    For CRM on-prem, you can turn on CRM trace log with the following tool.

    After you have turned on trace log, you can run the data load task, and CRM server will generate some log files under C:\Program Files\Microsoft Dynamics CRM\Trace folder. The log file is big, and not easy to read. So you would use one of the following tools toread the log files.

    If you are using CRM Online, you would want to contact the CRM Online Support team to request for assistance. Alternatively you can create an on-prem environment to reproduce the error message, in which case you can turn on the CRM trace log in the replicate environment.

    PS. This is an exact copy of my response to your question on StackOverflow. 

    Hope this has helped.


    Daniel Cai | http://danielcai.blogspot.com | @danielcai | Data Integration made easy with SSIS Integration Toolkit


    Tuesday, April 5, 2016 12:00 PM

  • The error seemed to be with updating state code using an alternative key as the update of state code with primary key worked fined. After updating to version 7.1 of the KingswaySoft adapters the issue was resolved and I could update the state code using alternative keys.
    • Edited by Dean776 Tuesday, April 19, 2016 4:07 AM Fix formatting
    • Marked as answer by Dean776 Tuesday, April 19, 2016 4:08 AM
    Tuesday, April 19, 2016 4:07 AM