PostTrans XML API for Sage 200 - Customer Account
The PostTrans XML API for Sage 200 provides to ability to update, or create Customer details in Sage 200, from a simple to understand XML file, which can be combined to update account details before importing and Sales Order, Invoice, Credit etc. See Transaction examples. Simple Order with Delivery Address with XML API for Sage 200
The following XML file if submitted to import directory or IMAP e-mail account. At the top of the XML file, we can optionally set the Sage 200 Company for the Sage 200 API to import or update Customer details and override settings which can also be set in XML_API_mappings.xml (“View >> Mapping Settings” menu) more info
Click here for an overview of the XML API for Sage 200
List of Examples
- 10 Simple Customer Account update.xml
- 20 Simple Customer update with external Reference.xml
- List Of Tags used
Example - 10 Simple Customer Account update.xml
<?xml version="1.0" ?>
<sage200Data>
<settings>
<companyCode>DEMO03</companyCode>
<mappings>
mappingReset // Clear all settings XML_API_mappings.xml
SW_CUautoAddSaluation=1 //If Saluation not in Sage 200 list then add, else ignore value
CuCreditLimit,onlyOnCreate //Do not set if account already exisits
CuDefTaxCode,onlyOnCreate
CuUseDefTax,onlyOnCreate
CuCurrency,onlyOnCreate
</mappings>
</settings>
<Customer>
<CuRef>TEST02</CuRef>
<CuName>Comtek Accounts</CuName>
<CuMainAdd1>Venture House</CuMainAdd1>
<CuMainAdd2>Venture Court</CuMainAdd2>
<CuMainAdd3>Bolness Rd.</CuMainAdd3>
<CuMainAdd4>Wisbech</CuMainAdd4>
<CuMainPostcode>PE13 2QL</CuMainPostcode>
<CuSalutation>Mr</CuSalutation> <!-- Contact can only be updated on creation -->
<CuFirstName>Sam</CuFirstName>
<CuMiddleName></CuMiddleName>
<CuLastName>Smith</CuLastName>
<CuMPhCo>+44</CuMPhCo>
<CuMPhAr>1612</CuMPhAr>
<CuMPhNo>4762377</CuMPhNo>
<CuEmail1>ss@ss.com</CuEmail1>
<CuCreditLimit>1000</CuCreditLimit>
<CuCurrency>GBP</CuCurrency> <!-- GBP,USD -->
<CuDefTaxCode>1</CuDefTaxCode> <!-- 0=0%,1=Standard Rate, etc.-->
<CuUseDefTax>False</CuUseDefTax>
<CuTaxRegCode>612 5749 32</CuTaxRegCode> <!-- Will fail if not formated -->
<CuAccOpened>2020-02-20</CuAccOpened>
<CuTermsAgreed>True</CuTermsAgreed>
<CuAnal1>Alan Ward</CuAnal1> <!-- These are numbered in Sage 200 -->
<CuAnal2>CVR Coverings</CuAnal2>
<CuAnal3>B</CuAnal3>
<CuAnal4>Newspaper</CuAnal4>
<CuAnal5>MID Midlands</CuAnal5>
<CuAnal6>Midlands</CuAnal6>
</Customer>
</sage200Data>Results in new or updated Sage 200 Customer:

Example - 20 Simple Customer update with external Reference.xml
In this example we have renamed the “CuRef” field, to “GUID”, which normally holds the account code using “CuRef=GUID”. And we have also defined CuSpareText1 to store the GUID value using the command “mappingCustomerCodeCounter("_","CuSpareText1")” and also name any new accounts “_0000001”, and then “_0000002” using a counter.
If another update is processed with same GUID number, stored in CuSpareText1, then PostTrans XML API will look up the Sage 200 Customer record. This can then be followed through to the Transactions import. SEE EXAMPLE
<?xml version="1.0" ?>
<sage200Data>
<settings>
<companyCode>DEMO03</companyCode>
<mappings>
mappingReset // Clear all settings XML_API_mappings.xml
SW_CUautoAddSaluation=1 //If Saluation not in Sage 200 list then add, else ignore value
//Make system use and external GUID stored in Sage 200 user field on
//customer record called GUID, and refured to as GUID in XML
mappingCustomerCodeCounter("_","CuSpareText1") // Use CuSpareText1 to store/identify account ID
//CuRef will be a counter prefixed with "_", eg "_0000001" - MUST BE SPECIFIED
//The XML Value of "GUID" will no identify the account
// Renamed by THAccCode=GUID and CuRef=GUID later
//If auto generate account code is ON in Sage 200 then will be created by Sage 200
//If not Counter is stored in CustomerCounter.xml in settings folder
CuRef=GUID
CuCreditLimit,onlyOnCreate //Do not set if account already exisits
CuDefTaxCode,onlyOnCreate
CuUseDefTax,onlyOnCreate
CuCurrency,onlyOnCreate
</mappings>
</settings>
<Customer>
<GUID>12394568821252</GUID>
<CuName>Comtek Accounts</CuName>
<CuMainAdd1>Venture House</CuMainAdd1>
<CuMainAdd2>Venture Court</CuMainAdd2>
<CuMainAdd3>Bolness Rd.</CuMainAdd3>
<CuMainAdd4>Wisbech</CuMainAdd4>
<CuMainPostcode>PE13 2QL</CuMainPostcode>
<CuSalutation>Mr</CuSalutation>
<CuFirstName>Sam</CuFirstName>
<CuMiddleName></CuMiddleName>
<CuLastName>Smith</CuLastName>
<CuMPhCo>+44</CuMPhCo>
<CuMPhAr>1612</CuMPhAr>
<CuMPhNo>4762377</CuMPhNo>
<CuEmail1>ss@ss.com</CuEmail1>
<CuCreditLimit>1000</CuCreditLimit>
<CuCurrency>GBP</CuCurrency> <!-- GBP,USD,... ISO 4217:2015 -->
<CuDefTaxCode>1</CuDefTaxCode> <!-- 0=0%,1=Standard Rate, etc.-->
<CuUseDefTax>False</CuUseDefTax>
<CuTaxRegCode>612 5749 32</CuTaxRegCode> <!-- Will fail SAGE 200 API validation if not formated -->
<CuAccOpened>2020-02-20</CuAccOpened>
<CuTermsAgreed>True</CuTermsAgreed>
<CuAnal1>Alan Ward</CuAnal1> <!-- These are numbered in Sage 200 -->
<CuAnal2>CVR Coverings</CuAnal2>
<CuAnal3>B</CuAnal3>
<CuAnal4>Newspaper</CuAnal4>
<CuAnal5>MID Midlands</CuAnal5>
<CuAnal6>Midlands</CuAnal6>
</Customer>
</sage200Data>Results in Accounts numbered and prefixed with "_"

XML API Tags for Sage 200 Entity 'Customer'
|
Tag Name |
Data Type |
Description |
|---|---|---|
|
Important Fields: | ||
|
CuRef |
Text 8 |
Cust Reference. Usually Sage 200 ref, but a switch in mappings allows an External referance to be used can given instead. Any transaction or updates will then be identified by this external referance |
|
CuName |
Text 60 |
Company Name |
|
CuShortName |
Text 8 |
Short Name |
|
CuCurrency^ |
Text 3 |
Currency, GBP,EUR,USD… |
|
CuCreditLimit |
Double |
Credit Limit |
|
CuHidden |
Yes/NoTF |
Hidden Account |
|
Main Address: | ||
|
CuMainAdd1 |
Text 60 |
Address1 |
|
CuMainAdd2 |
Text 60 |
Address2 |
|
CuMainAdd3 |
Text 60 |
Address3 |
|
CuMainAdd4 |
Text 60 |
Address4 |
|
CuMainPostcode |
Text 10 |
Postcode |
|
Main Segmented Address: | ||
|
CuMainCity |
Text 60 |
City, Only used if Segmented address is ON |
|
CuMainCounty |
Text 60 |
County, Only used if Segmented address is ON GB,US,IE,FR,...ISO 3166-1 alpha-2 |
|
CuMainCountry^ |
Text 60 |
Country, Only used if Segmented address is ON |
|
Main Contact: | ||
|
CuSalutation^ |
Text 20 |
This is a list in Sage 200 |
|
CuFirstName |
Text 60 |
Can only be set on creation |
|
CuMiddleName |
Text 60 |
Middle Name |
|
CuLastName |
Text 60 |
Last Name |
|
Main Phone/Fax: | ||
|
CuMPhCo |
Text 5 |
Main Phone Country Code |
|
CuMPhAr |
Text 20 |
Main Phone Area code |
|
CuMPhNo |
Text 200 |
Main Phone Number |
|
CuMFaxCo |
Text 5 |
Main Fax Country Code |
|
CuMFaxAr |
Text 20 |
Main Fax Area code |
|
CuMFaxNo |
Text 200 |
Main Fax Number |
|
CuMWeb |
Text 200 |
Main Web |
|
CuEmail1 |
Text 200 |
Should only be updated on creation since no way of updating same value |
|
Trading: | ||
|
CuCountryCode^ |
Text 2 |
Country Code GB,US.. |
|
CuDUNSCode |
Text 9 |
DUNS Code, must be 9 chrs long |
|
CuDefTaxCode^ |
Text 2 |
Default Tax Code, 0=Exempt,1=Std,2=Zero |
|
CuUseDefTax |
Yes/NoTF |
Use Tax Code As Default |
|
CuTaxRegCode |
Text 30 |
Tax Registration Code. Will fail if not formated |
|
CuMon2Keep |
Integer |
Months To Keep Transactions |
|
CuOrderPri |
Text 1 |
Order Priority A-Z |
|
Default Nominal Codes: | ||
|
CuDefaultNom^ |
Text 15 |
Default Nom. Can be NOM/CC/DEP |
|
Analysis Codes: | ||
|
CuAnal1^ |
Text 60 |
Analyisis code 1 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal2^ |
Text 60 |
Analyisis code 2 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal3^ |
Text 60 |
Analyisis code 3 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal4^ |
Text 60 |
Analyisis code 4 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal5^ |
Text 60 |
Analyisis code 5 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal6^ |
Text 60 |
Analyisis code 6 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal7^ |
Text 60 |
Analyisis code 7 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal8^ |
Text 60 |
Analyisis code 8 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal9^ |
Text 60 |
Analyisis code 9 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal10^ |
Text 60 |
Analyisis code 10 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal11^ |
Text 60 |
Analyisis code 11 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal12^ |
Text 60 |
Analyisis code 12 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal13^ |
Text 60 |
Analyisis code 13 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal14^ |
Text 60 |
Analyisis code 14 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal15^ |
Text 60 |
Analyisis code 15 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal16^ |
Text 60 |
Analyisis code 16 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal17^ |
Text 60 |
Analyisis code 17 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal18^ |
Text 60 |
Analyisis code 18 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal19^ |
Text 60 |
Analyisis code 19 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
CuAnal20^ |
Text 60 |
Analyisis code 20 - Setup View >> Analaysis code menu option will list mapping numbers and values |
|
Payment: | ||
|
CuAccType^ |
Integer |
Account Type |
|
CuSetDiscPerc |
Double |
Early Settlement Discount Percent |
|
CuSetDiscDays |
Integer |
Early Settlement Discount Days |
|
CuTermsDays |
Integer |
Payment Terms Days |
|
CuTermsBasis^ |
Integer |
Payment Terms Basis |
|
Credit: | ||
|
CuAccOpened |
DateBlank |
Account Opened |
|
CuLastCredRev |
DateBlank |
Last Credit Review |
|
CuNextCredRev |
DateBlank |
Next Credit Review |
|
CuAppDate |
DateBlank |
Application Date |
|
CuDateReceived |
DateBlank |
Date Received |
|
CuTradingTerms |
Text 30 |
Trading Terms |
|
CuCreditRef |
Text 60 |
Credit Reference |
|
CuCreditBureau^ |
Text 40 |
Credit Bureau Name |
|
CuCreditPosition^ |
Text 40 |
Credit Position Name |
|
CuFinCharge^ |
Text 40 |
Finance Charge |
|
CuAvgTimeToPay |
Integer |
Average Time To Pay |
|
CuTermsAgreed |
Yes/NoTF |
Terms Agreed |
|
CuCreditMemo |
Memo |
Credit Memo |
|
Documents - Billing: | ||
|
CuConsBilling |
Yes/NoTF |
Use Consolidated Billing |
|
Pricing: | ||
|
CuInvDiscPerc |
Double |
Invoice Discount Percent |
|
CuLineDiscPerc |
Double |
Line Discount Percent |
|
CuPriceBand^ |
Text 40 |
Price Band Name |
|
CuGroupDisc^ |
Text 40 |
Group Discount Name |
|
CuOrderValDisc^ |
Text 40 |
Order Value Discout Name |
|
Head Office: | ||
|
CuHeadOffStatus^ |
Integer |
Head Office Status |
|
CuAssHeadOffice^ |
Text 8 |
Associated Head Office Account |
|
CuProdStat |
Yes/NoTF |
Produce Statements For Customer |
|
Other: | ||
|
Spare: | ||
|
CuSpareBit1 |
Yes/NoTF |
SpareBit1 |
|
CuSpareBit2 |
Yes/NoTF |
SpareBit2 |
|
CuSpareBit3 |
Yes/NoTF |
SpareBit3 |
|
CuSpareDate1 |
DateBlank |
SpareDate1 |
|
CuSpareDate2 |
DateBlank |
SpareDate2 |
|
CuSpareDate3 |
DateBlank |
SpareDate3 |
|
CuSpareNumber1 |
Double |
SpareNumber1 |
|
CuSpareNumber2 |
Double |
SpareNumber2 |
|
CuSpareNumber3 |
Double |
SpareNumber3 |
|
CuSpareText1 |
Text 100 |
SpareText1 |
|
CuSpareText2 |
Text 100 |
SpareText2 |
|
CuSpareText3 |
Text 100 |
SpareText3 |
|
ObjectStore Mappings: | ||
|
CuUser1 |
Text 3000 |
The user defined Sage 200 field name of these Userfields should be defined in mappings using 'CuUser1,userField("MyNewField",text,20)' and 'CuUser2=OurScore,userField("OurScore",integer)' |
|
CuUser2 |
Text 3000 |
User2 |
|
CuUser3 |
Text 3000 |
User3 |
|
CuUser4 |
Text 3000 |
User4 |
|
CuUser5 |
Text 3000 |
User5 |
|
CuUser6 |
Text 3000 |
User6 |
|
CuUser7 |
Text 3000 |
User7 |
|
CuUser8 |
Text 3000 |
User8 |
|
CuUser9 |
Text 3000 |
User9 |
|
CuUser10 |
Text 3000 |
User10 |
Req = Field is required EOF = End of file, Stop when no more values
With data type Yes/No fields, if cell starts with 'y' or 'Y' is taken as TRUE
Where ^ denotes a In Cell Code Search, delete ^ at end of tag, to turn off code search
All Text fields are trimmed (spaces before) by default. Add ' to the end of the tag name to stop this.