dotNet API PROCESSCMD

Sage 300 dotNet API project. Lots of the available docs say to use create a macro in the UI for what you want to do and then translate to C#. Works great for most of it but I am having an issue with the PROCESSCMD lines, which are often necessary to get optional fields that are set to automatically populate to actually have that happen.
Macro line is
ARCUSTOMER3headerFields("PROCESSCMD").PutWithoutVerification ("0")

C# translation is
ARCUSTOMER3headerFields("PROCESSCMD").PutWithoutVerification("0");
but Visual studio says: "Error CS1955 Non-invocable member 'ARCUSTOMER3headerFields' cannot be used like a method."

Anyone know how to work around this?

Parents Reply Children
  • 0 in reply to Jay Converse Acumen

    Jay,

    Thanks!  It works using COM instead Accpac Advantage.

    Is there a way to get it to autopopulate the default optional fields but still record specific optional field values?

    If PROCESSCMD is after setting the optional fields it overwrites them, and if it is before then calling arCusOpt.Insert() or Update() throws an error.  I suppose I could skip the optional fields on the insert routine and then pass the json file over to an update routine, but that feels rather wasteful.

    Phil

  • 0 in reply to PhilMcIntosh

    I handle all my optionals like this:

    static bool AddOrderOpt(string sOptfield, string sValue)
    {
    try
    {
    // Assumes that ArCustomerOpt as been composed
    OEOrderOptional.Fields.FieldByName["optfield"].PutWithoutVerification(sOptfield);
    if (OEOrderOptional.Read())
    {
    OEOrderOptional.Fields.FieldByName["value"].PutWithoutVerification(sValue);
    OEOrderOptional.Update();
    }
    else
    {
    OEOrderOptional.RecordGenerate(false);
    OEOrderOptional.Fields.FieldByName["OPTFIELD"].PutWithoutVerification(sOptfield);
    OEOrderOptional.Fields.FieldByName["value"].PutWithoutVerification(sValue);
    OEOrderOptional.Insert();
    }
    }
    catch
    {
    HandleError("AddCustomerOpt", "");
    return false;
    }
    return true;
    }