Create, Read, Update, and Delete (CRUD) Customer
This example shows you how to:
- Create a customer
- Read a customer
- Update a customer
- Delete a customer
Prerequisites
- You have downloaded or cloned the Sage Intacct SDK for .NET examples.
- You successfully ran the getting started example—in particular, you set up the
credentials.inifile required byBootstrap.cs. - The user you are using has add, edit, delete, list, and view permissions for the customer object.
Run the example
-
Run the project, and enter
4when prompted.For example, the following runs the project from the command line:
cd Intacct.Examples "C:\Program Files\dotnet\dotnet.exe" bin/Debug/netcoreappX.X/Intacct.Examples.dll -
Observe the terminal output.
Information is echoed for each customer API function executed:
Created inactive customer ID 10066 Updated customer ID 10066 to active Read customer ID 10066 Deleted customer ID 10066 -
Type
6to exit the program. -
Open the generated
Intacct.Examples/bin/Debug/netcoreappX.X/logs/intacct.logfile 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 logger set in the client config.
Extra credit
Get a customer by name
-
Execute a
ReadByNamefunction (instead ofRead):ReadByName readByName = new ReadByName() { ObjectName = "CUSTOMER", Fields = { "RECORDNO", "CUSTOMERID", "STATUS", }, Names = { customerId, } }; Task<OnlineResponse> readByNameTask = client.Execute(readByName); readByNameTask.Wait(); Console.WriteLine("Read customer ID " + customerId + " using ReadByName");
Try a different object
- Try a different object’s CRUD functions from the
Intacct.SDK.Functionsnamespace.
What’s next?
- Try an example that implements the
IFunctioninterface for use with a custom object. - Browse the reference documentation for the SDK.