The example shows you how to:


Set up

  1. Open AbstractTestObject.cs and note how it extends Intacct.SDK.Functions.AbstractFunction.

    AbstractFunction is a helper class provided mainly to generate random control IDs. AbstractFunction implements Intacct.SDK.Functions.IFunction, and any class whose instances will be executed by a client must implement IFunction. If using ExecuteBatch, the parameter must be a List<IFunction>.

  2. Open TestObjectCreate.cs and note how it extends AbstractTestObject.

    The IFunction interface requires that the class implement the void WriteXml(ref IaXmlWriter xml) function. This implementation is where you provide the XML that will be processed at the gateway endpoint.

  3. Open AbstractTestObject.cs and replace test_object with the integration name for your custom object.

    protected const string IntegrationName = "test_object";

Run the example

  1. Run the project, and when prompted, enter 4 and press enter:

    "C:\Program Files\dotnet\dotnet.exe" Intacct.Examples/bin/Debug/netcoreapp2.0/Intacct.Examples.dll
    Pick an option to run:
     1 - Getting started
     2 - List vendors
     3 - CRUD customer
     4 - Custom object function
  2. Observe the terminal output, which should look similar to this:

    Created record ID 10153

    Note the record ID (for use below).

  3. Open the generated Intacct.Examples/bin/Debug/netcoreapp2.0/logs/intacct.log file in a text editor and review the entries.

    The file provides info and debug entries. The SDK provides a debug entry for each HTTP request/response (with the Sage Intacct endpoint).

    Note that the log file was created by the HTML logger set in the client config.

Extra credit

Get the record by ID

  1. Update CustomerObjectFunction.cs to execute a Read function that uses the record ID returned in the TestObjectCreate result.

    Read read = new Read()
        ObjectName = "test_object",
        Keys =
    Task<OnlineResponse> readTask = client.Execute(create);
    OnlineResponse readResponse = readTask.Result;

Delete the record

  1. Create a TestObjectDelete class and execute an instance of it that uses the same record ID returned in the TestObjectCreate result.

    If you need help, see .

    using Intacct.SDK.Xml;
    namespace Intacct.Examples
        public class TestObjectDelete : AbstractTestObject
            public TestObjectDelete(int recordId)
                this.Id = recordId;
            public override void WriteXml(ref IaXmlWriter xml)
                xml.WriteAttribute("controlid", this.ControlId, true);
                xml.WriteElement("object", IntegrationName);
                xml.WriteElement("keys", this.Id);
                xml.WriteEndElement(); // delete
                xml.WriteEndElement(); // function

What’s next?

For more complex examples, you can use the functions in the SDK as models. For example, AbstractBill extends AbstractFunction, then BillCreate and BillDelete extend AbstractBill and write the XML for creating or deleting bills.

Provide feedback