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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

State code or status code is invalid while deactivate the custom entity record

(0) ShareShare
ReportReport
Posted on by

Hi,

We have migrated to CRM 2013 and facing one issue while deactivating the custom entity record

Error-  State code or status code is invalid: State code is invalid or state code is valid but status code is invalid for specified state code

when downloading the log, it is giving below error.

<s:Envelope xmlns:s="<faultcode>s:Client</faultcode><faultstring">http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xmlns:xml="http://www.w3.org/XML/1998/namespace" xml:lang="en-US">-1 is not a valid state code on new_partner.</faultstring><detail><OrganizationServiceFault xmlns="<ErrorCode>-2147187704</ErrorCode><ErrorDetails">http://schemas.microsoft.com/xrm/2011/Contracts"><ErrorCode>-2147187704</ErrorCode><ErrorDetails /><Message>-1 is not a valid state code on new_partner.</Message><Timestamp>2014-03-18T05:42:04.5523897Z</Timestamp><InnerFault><ErrorCode>-2147187704</ErrorCode><ErrorDetails /><Message>-1 is not a valid state code on new_partner.</Message><Timestamp>2014-03-18T05:42:04.5523897Z</Timestamp><InnerFault><ErrorCode>-2147220970</ErrorCode><ErrorDetails /><Message>System.ArgumentException: -1 is not a valid state code on new_partner.
Parameter name: stateCode</Message><Timestamp>2014-03-18T05:42:04.5523897Z</Timestamp><InnerFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:nil="true" /><TraceText xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:nil="true" /></InnerFault><TraceText xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:nil="true" /></InnerFault><TraceText xmlns:i="http://www.w3.org/2001/XMLSchema-instance" i:nil="true" /></OrganizationServiceFault></detail></s:Fault></s:Body></s:Envelope>

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Royal King Profile Picture
    27,686 on at

    This error occurs when you delete some option set value and did not update the records that had this value. To fix this issue find all the records which has deleted option set value and update with right option set value.

    As well check the mapping between Status and status reason value for your entity.

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi,

    try to check the state code of entity new_partner.

    Do you have -1 in your current data?

    Try to do query in SQL Query

    select distinct statecode, statuscode from new_partner.

  • Community Member Profile Picture
    on at

    Hi Aileen,

    I found my state code and status code in both conditions.

    When record is active then

    State code = 0 and status code = 1

    When record is inactive then

    State code = 1 and status code = 2.

    I also found out that values for state code and status code in both conditions are same for basic ms crm entities.

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi ATS,

    if you notice:

    "-1 is not a valid state code on new_partner."

    this is -1.

    Do you have any data having -1 of the statecode?

  • Suggested answer
    Hosk Profile Picture
    on at

    It seems you have a record with status reason which has been deleted

    You need to note down the status reasons you have and find the int value

    then do a select on the SQL table and find the records with status reason int values which no longer exist.

    You then need to set those records to a different value

    Something similar happened to me

    crmbusiness.wordpress.com/.../crm-2013-what-happens-when-you-delete-a-status-currently-in-use

  • Community Member Profile Picture
    on at

    Hi all,

    I have been able to activate deactivated records from homegrid. This error is only throwing when I activate deactivated form from record form.

    I think status code = 2 and state code = 1, in case of deactivated records.

  • Community Member Profile Picture
    on at

    Hi ats,

    Did you ever find the cause of this issue?  We're experiencing it at a client site.  The fact it only occurs on the form and not the homegrid steers me away from data (as it would happen in both cases).

    Let me know if have any info.

    Thanks!

  • Fighter Profile Picture
    5 on at

    Hi,

    Please, check that state field has the correct values in customizations.xml inside solution for this entity: invariantname="Active" and invariantname="Inactive". Translation of these values is not allowed.

  • Community Member Profile Picture
    on at

    Hi,

    I have a similar issue. After I migrated to CRM 2016 from 2015, when trying to deactivate a custom entity record, I get the below error.

    State code or status code is invalid.

    State code is invalid or state code is valid but status code is invalid for a specified state code.

    <s:Envelope xmlns:s="schemas.xmlsoap.org/.../envelope"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring xml:lang="en-US">1 is not a valid status code for state code progres_rsdreviewState.Inactive on progres_rsdreview with Id 22a3112d-91b6-e411-b429-005056817afb.</faultstring><detail><OrganizationServiceFault xmlns="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance"><ErrorCode>-2147187704</ErrorCode><ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic"/><Message>1 is not a valid status code for state code progres_rsdreviewState.Inactive on progres_rsdreview with Id 22a3112d-91b6-e411-b429-005056817afb.</Message><Timestamp>2016-08-09T03:14:00.3755503Z</Timestamp><InnerFault><ErrorCode>-2147187704</ErrorCode><ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic"/><Message>1 is not a valid status code for state code progres_rsdreviewState.Inactive on progres_rsdreview with Id 22a3112d-91b6-e411-b429-005056817afb.</Message><Timestamp>2016-08-09T03:14:00.3755503Z</Timestamp><InnerFault><ErrorCode>-2147187704</ErrorCode><ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic"/><Message>1 is not a valid status code for state code progres_rsdreviewState.Inactive on progres_rsdreview with Id 22a3112d-91b6-e411-b429-005056817afb.</Message><Timestamp>2016-08-09T03:14:00.3755503Z</Timestamp><InnerFault><ErrorCode>-2147220970</ErrorCode><ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic"/><Message>System.ArgumentException: 1 is not a valid status code for state code progres_rsdreviewState.Inactive on progres_rsdreview with Id 22a3112d-91b6-e411-b429-005056817afb.
    Parameter name: statusCode</Message><Timestamp>2016-08-09T03:14:00.3755503Z</Timestamp><InnerFault i:nil="true"/><TraceText i:nil="true"/></InnerFault><TraceText i:nil="true"/></InnerFault><TraceText i:nil="true"/></InnerFault><TraceText i:nil="true"/></OrganizationServiceFault></detail></s:Fault></s:Body></s:Envelope>

    I tried checking the state and status code are in sync in CRM 2015 and 2016. But it works fine in the previous version but not in the later.

    I am unable to figure out the problem.

    Any help would be greatly appreciated.

    Regards,

    Ganesh A

  • Community Member Profile Picture
    on at

    We are having similar issue. Did you find any solution for 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans