XERO JINT: Difference between revisions

From Data Islands
No edit summary
No edit summary
Line 27: Line 27:
    xeroRecord.Delete(id)
    xeroRecord.Delete(id)
  </nowiki>  
  </nowiki>  
//Insert Invoice
<nowiki>
var xeroRecord = XeroRecord('invoices');
xeroRecord.Set("InvoiceNumber", "TestXeroInvoice1");
xeroRecord.Set("Contact_ContactID", "e5e631e9-c5c8-4a4b-a5d0-b8dcfd4a5ad9");
xeroRecord.Set("Type", "ACCREC");
xeroRecord.Insert();
</nowiki>


getGUID - This is used where you have a given key value and need the Guid ID. Only one result is returned so this depends on the named key value being unique. Otherwise use querydb.
getGUID - This is used where you have a given key value and need the Guid ID. Only one result is returned so this depends on the named key value being unique. Otherwise use querydb.

Revision as of 08:52, 14 August 2025

There are specific commands in the Javascript Engine (JINT) relating to XERO Only.


XeroRecord

You can update XERO now from javascript code using the JINT functionality

    //Insert

 
    var xeroRecord = XeroRecord('contacts');
    xeroRecord.Set("Name", "TestXeroContact9");
    xeroRecord.Insert();
  

    //Update

 
    var xeroRecord = XeroRecord('contacts');
    xeroRecord.Set("EmailAddress", "test@test.com");
    var id = '76912505-520c-4b1d-8739-24a98493508c';
    xeroRecord.Update(id);
  

    //Delete/Archive

 
    var xeroRecord = XeroRecord('contacts');
    xeroRecord.Set("Name", "TestXeroContact5");
    var id = '76912505-520c-4b1d-8739-24a98493508c';
    xeroRecord.Delete(id)
  

//Insert Invoice

 
	var xeroRecord = XeroRecord('invoices');
	xeroRecord.Set("InvoiceNumber", "TestXeroInvoice1");
	xeroRecord.Set("Contact_ContactID", "e5e631e9-c5c8-4a4b-a5d0-b8dcfd4a5ad9");
	xeroRecord.Set("Type", "ACCREC");
	xeroRecord.Insert();
  


getGUID - This is used where you have a given key value and need the Guid ID. Only one result is returned so this depends on the named key value being unique. Otherwise use querydb.

 - Parameters (a) ENTITY(b) FILTER
  - returns GUID value
 EG
  >var quoteid=di.getguid("Quotes", "QT-1234");
  1. di.getguid("Accounts", "Name_Value") => Will pass "Name" and will get  "AccountID"
  2. di.getguid("BankTransactions", "Reference_Value") => Will pass "Reference" and will get  "BankTransactionID"
  3. di.getguid("BrandingThemes", "Name_Value")=> Will pass "Name" and will get  "BrandingThemeID"
  4. di.getguid("ContactGroups", "Name_Value")=> Will pass "Name" and will get  "ContactGroupID"
  5. di.getguid("Contacts", "Name_Value")=> Will pass "Name" and will get  "ContactID"
  6. di.getguid("CreditNotes", "CreditNoteNumber_Value")=> Will pass "CreditNoteNumber" and will get  "CreditNoteID"
  7. di.getguid("Employees", "FirstName_Value")=> Will pass "FirstName" and will get  "EmployeeID"
  8. di.getguid("ExpenseClaims", "Status_Value")=> Will pass "Status" and will get  "ExpenseClaimID"
  9. di.getguid("Invoices", "InvoiceNumber_Value")=> Will pass "InvoiceNumber" and will get  "InvoiceID"
  10. di.getguid("Items", "Name_Value")=> Will pass "Name" and will get  "ItemID"
  11. di.getguid("ManualJournals", "Narration_Value")=> Will pass "Narration" and will get  "ManualJournalID"
  12. di.getguid("Organisations", "Name_Value")=> Will pass "Name" and will get  "OrganisationID"
  13. di.getguid("Payments", "Reference_Value")=> Will pass "Reference" and will get  "PaymentID"
  14. di.getguid("PurchaseOrders", "PurchaseOrderNumber_Value")=> Will pass "PurchaseOrderNumber" and will get  "PurchaseOrderID"
  15. di.getguid("Quotes", "QuoteNumber_Value")=> Will pass "QuoteNumber" and will get  "QuoteID"
  16. di.getguid("Receipts", "ReceiptNumber_Value")=> Will pass "ReceiptNumber" and will get  "ReceiptID"
  17. di.getguid("RepeatingInvoices", "Reference_Value")=> Will pass "Reference" and will get  "RepeatingInvoiceID"