Menu

Customer Account

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

List of Tags/Entities for mapping are at bottom of page.

Click here for an overview of the XML API for Sage 200

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…
    In Cell Searching values in table Cur

CuCreditLimit

Double

Credit Limit

CuHidden

Yes/NoTF

Hidden Account
    Sage V2017 onwards

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
    In Cell Searching values in table CountryCode

Main Contact:

CuSalutation^

Text 20

This is a list in Sage 200
    In Cell Searching values in table CustomerSalutation

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..
    In Cell Searching values in table CountryCode

CuDUNSCode

Text 9

DUNS Code, must be 9 chrs long

CuDefTaxCode^

Text 2

Default Tax Code, 0=Exempt,1=Std,2=Zero
    In Cell Searching values in table Tax

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
    In Cell Searching values in table NOM

Analysis Codes:

CuAnal1^

Text 60

Analyisis code 1
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_01

CuAnal2^

Text 60

Analyisis code 2
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_02

CuAnal3^

Text 60

Analyisis code 3
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_03

CuAnal4^

Text 60

Analyisis code 4
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_04

CuAnal5^

Text 60

Analyisis code 5
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_05

CuAnal6^

Text 60

Analyisis code 6
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_06

CuAnal7^

Text 60

Analyisis code 7
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_07

CuAnal8^

Text 60

Analyisis code 8
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_08

CuAnal9^

Text 60

Analyisis code 9
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_09

CuAnal10^

Text 60

Analyisis code 10
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_10

CuAnal11^

Text 60

Analyisis code 11
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_11

CuAnal12^

Text 60

Analyisis code 12
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_12

CuAnal13^

Text 60

Analyisis code 13
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_13

CuAnal14^

Text 60

Analyisis code 14
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_14

CuAnal15^

Text 60

Analyisis code 15
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_15

CuAnal16^

Text 60

Analyisis code 16
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_16

CuAnal17^

Text 60

Analyisis code 17
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_17

CuAnal18^

Text 60

Analyisis code 18
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_18

CuAnal19^

Text 60

Analyisis code 19
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_19

CuAnal20^

Text 60

Analyisis code 20
    Sage V2015 onwards
    In Cell Searching values in table AnalCust_20

Payment:

CuAccType^

Integer

Account Type
        In Cell Searching values:Account Type
                  0, Balance Forward
                  1, Open Item
                  2, Auto Allocation

CuSetDiscPerc

Double

Early Settlement Discount Percent

CuSetDiscDays

Integer

Early Settlement Discount Days

CuTermsDays

Integer

Payment Terms Days

CuTermsBasis^

Integer

Payment Terms Basis
        In Cell Searching values:Payment Terms Basis
                  0, Due From Calendar Month
                  1, Due From Start Of Month
                  2, Payment Due From End Of Month
                  3, Payment Due From Document Date

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
    In Cell Searching values in table Bureau

CuCreditPosition^

Text 40

Credit Position Name
    In Cell Searching values in table CreditPositions

CuFinCharge^

Text 40

Finance Charge
    In Cell Searching values in table FinanceCharges

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
    In Cell Searching values in table PriceBands

CuGroupDisc^

Text 40

Group Discount Name
    In Cell Searching values in table DiscountGroups

CuOrderValDisc^

Text 40

Order Value Discout Name
    In Cell Searching values in table OrderValueDiscounts

Head Office:

CuHeadOffStatus^

Integer

Head Office Status
        In Cell Searching values:Head Office Status
                  0, Independent
                  1, Branch
                  2, Head Office
                  3, Independent No Statement4
                  Head Office No Statement,

CuAssHeadOffice^

Text 8

Associated Head Office Account
    In Cell Searching values in table CustHead

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.