Comments (2)
I want allocate the created Credit Notes to invoice
<Allocations>
<Allocation>
<AppliedAmount>60.50</AppliedAmount>
<Invoice>
<InvoiceID>f5832195-5cd3-4660-ad3f-b73d9c64f263</InvoiceID>
</Invoice>
</Allocation>
</Allocations>
So I have created the class below structure
public class JSON2Apex {
public Allocation Allocation=new Allocation();
public class Allocation {
public String AppliedAmount;
public Invoice Invoice=new Invoice();
}
public class Invoice {
public String InvoiceID;
}
}
This is the code I am executing in Salesforce developer console
String consumerKey;
HttpResponse response;
Xero_Settings__c xeroSettings=Xero_Settings__c.getInstance('UKINC');
consumerKey = xeroSettings.Consumer_Key__c;
JSON2Apex js=new JSON2Apex ();
JSON2Apex.Allocation alt=new JSON2Apex.Allocation();
alt.AppliedAmount='1.0';
alt.Invoice.InvoiceID='test';
js.Allocation=alt;String xmlInvoiceString = XeroXmlUtility.serialize(js, 'Allocations');
System.debug('*****************'+xmlInvoiceString);
And the Output structure is coming like below
<?xml version="1.0" encoding="UTF-8"?>
<Allocations>
<Allocation>
<AppliedAmount>1.0</AppliedAmount>
</Allocation>
<Invoice>
<InvoiceID>test</InvoiceID>
</Invoice>
</Allocations>
This Structure is not as expected there is some issue , Can any one know how to fix this.
from apex-for-xero.
i'm doing something similar but using
have you public class for allocation like this:
public class Allocation {
public String AppliedAmount;
public XeroInvoice Invoice;
}
from apex-for-xero.
Related Issues (20)
- Invalid :Type XeroContact
- Tests
- You are a bloody legend. Thanks for sharing!
- Not find "Manage on Xero Settings" HOT 4
- Cannot deploy to SalesForce HOT 1
- Cannot deploy to SalesForce HOT 2
- Xero OAuth 1 Endpoint Depreciated HOT 2
- Contact not inserting in SF
- oAuth1.0a is Deprecated HOT 1
- Other endpoints HOT 1
- How do you even get this to work HOT 1
- Issue with not being authorised HOT 1
- Token not refreshed
- Trying to get tenant Id I now get a 301 Moved Permanently HOT 1
- Test Class for XeroContact
- Paging Get Results
- Test Failure deploying to production HOT 1
- Deployment Errors HOT 1
- Errors when trying to insert invoices
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apex-for-xero.