The Records is not in editable state

SOLVED

Hi,

I got this "The Records is not in editable state" Error while delete contact from Ar_CustomerContact_bus object. 

Please anyone give hint to solve this issue.

Thanks.

Parents
  • 0
    verified answer
    Hint: summit's wrong in your code.
  • 0 in reply to 49153
    Hi,

    Here is the code.



    object pvx = null;
    object oSS = null;
    CreateLogFiles Err = new CreateLogFiles();
    // Instantiate a ProvidexX.Script object and initialize with the path to MAS90\Home
    pvx = System.Activator.CreateInstance(Type.GetTypeFromProgID("ProvideX.Script", true));
    // Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below
    pvx.GetType().InvokeMember("Init", BindingFlags.InvokeMethod, null, pvx, new object[] { ConfigurationManager.AppSettings["SagePath"].ToString() });



    // Instantiate a new Session object and initialize the session
    // by setting the user, company, date and module
    oSS = pvx.GetType().InvokeMember("NewObject", BindingFlags.InvokeMethod, null, pvx, new object[] { "SY_Session" });




    oSS.GetType().InvokeMember("nSetCompany", BindingFlags.InvokeMethod, null, oSS, new object[] { ConfigurationManager.AppSettings["CompanyName"].ToString() });

    oSS.GetType().InvokeMember("nSetDate", BindingFlags.InvokeMethod, null, oSS, new object[] { "A/R", "07252016" });

    oSS.GetType().InvokeMember("nSetModule", BindingFlags.InvokeMethod, null, oSS, new object[] { "A/R" });

    oSS.GetType().InvokeMember("nSetUser", BindingFlags.InvokeMethod, null, oSS, new object[] { "user", "password" });

    oSS.GetType().InvokeMember("nLogon", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);



    int TaskID = (int)oSS.GetType().InvokeMember("nLookupTask", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "AR_CustomerContact_ui" });

    oSS.GetType().InvokeMember("nSetProgram", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);


    m_object = pvx.GetType().InvokeMember("NewObject", BindingFlags.InvokeMethod, null, pvx, new object[] { "AR_CustomerContact_bus", oSS });



    object retVal = 0;

    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ARDivisionNo$", ConfigurationManager.AppSettings["ARDivisionNo"] });
    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "CustomerNo$", ConfigurationManager.AppSettings["CustomerNo"] });
    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ContactCode$", ConfigurationManager.AppSettings["ContactCode"] });



    retVal = oARCustomerEntry.InvokeMethod("nDelete");
    Err.ErrorLog(".//", "Execute Delete");

    if (retVal.ToString() == "0")
    {
    object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
    Console.WriteLine(errorMsg.ToString());
    Err.ErrorLog(".//", errorMsg.ToString());
    Console.Read();
    }

    // string customerNumber = nextCustomerNumber[0].ToString();

    Console.WriteLine(retVal.ToString());

    Console.Read();
    }
    catch (Exception ex)
    {
    object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
    Err.ErrorLog(".//", errorMsg.ToString());
    Console.WriteLine(errorMsg.ToString());
    Console.WriteLine(ex.Message);
    Console.Read();
    }






    thanks
Reply
  • 0 in reply to 49153
    Hi,

    Here is the code.



    object pvx = null;
    object oSS = null;
    CreateLogFiles Err = new CreateLogFiles();
    // Instantiate a ProvidexX.Script object and initialize with the path to MAS90\Home
    pvx = System.Activator.CreateInstance(Type.GetTypeFromProgID("ProvideX.Script", true));
    // Replace the text "*PATH TO MAS90\HOME*" with the correct MAS90\Home path in the line below
    pvx.GetType().InvokeMember("Init", BindingFlags.InvokeMethod, null, pvx, new object[] { ConfigurationManager.AppSettings["SagePath"].ToString() });



    // Instantiate a new Session object and initialize the session
    // by setting the user, company, date and module
    oSS = pvx.GetType().InvokeMember("NewObject", BindingFlags.InvokeMethod, null, pvx, new object[] { "SY_Session" });




    oSS.GetType().InvokeMember("nSetCompany", BindingFlags.InvokeMethod, null, oSS, new object[] { ConfigurationManager.AppSettings["CompanyName"].ToString() });

    oSS.GetType().InvokeMember("nSetDate", BindingFlags.InvokeMethod, null, oSS, new object[] { "A/R", "07252016" });

    oSS.GetType().InvokeMember("nSetModule", BindingFlags.InvokeMethod, null, oSS, new object[] { "A/R" });

    oSS.GetType().InvokeMember("nSetUser", BindingFlags.InvokeMethod, null, oSS, new object[] { "user", "password" });

    oSS.GetType().InvokeMember("nLogon", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);



    int TaskID = (int)oSS.GetType().InvokeMember("nLookupTask", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] { "AR_CustomerContact_ui" });

    oSS.GetType().InvokeMember("nSetProgram", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);


    m_object = pvx.GetType().InvokeMember("NewObject", BindingFlags.InvokeMethod, null, pvx, new object[] { "AR_CustomerContact_bus", oSS });



    object retVal = 0;

    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ARDivisionNo$", ConfigurationManager.AppSettings["ARDivisionNo"] });
    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "CustomerNo$", ConfigurationManager.AppSettings["CustomerNo"] });
    retVal = oARCustomerEntry.InvokeMethodByRef("nSetKeyValue", new object[] { "ContactCode$", ConfigurationManager.AppSettings["ContactCode"] });



    retVal = oARCustomerEntry.InvokeMethod("nDelete");
    Err.ErrorLog(".//", "Execute Delete");

    if (retVal.ToString() == "0")
    {
    object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
    Console.WriteLine(errorMsg.ToString());
    Err.ErrorLog(".//", errorMsg.ToString());
    Console.Read();
    }

    // string customerNumber = nextCustomerNumber[0].ToString();

    Console.WriteLine(retVal.ToString());

    Console.Read();
    }
    catch (Exception ex)
    {
    object errorMsg = oARCustomerEntry.GetProperty("sLastErrorMsg");
    Err.ErrorLog(".//", errorMsg.ToString());
    Console.WriteLine(errorMsg.ToString());
    Console.WriteLine(ex.Message);
    Console.Read();
    }






    thanks
Children