I have tried using a custom action. The update invoice as currency, but no exchange rate.
Could you post the correct code or point me in the right direction using a custom event to do this.
Thanks,
I have tried using a custom action. The update invoice as currency, but no exchange rate.
Could you post the correct code or point me in the right direction using a custom event to do this.
Thanks,
Hi John, Welcome to the Community! 👋
I see that QuickBooks does not support displaying the default Exchange Rate field in invoices, according to this response by a QuickBooks representative here.
However, further down in the thread, another representative explains that it is possible to set up a custom field to display this value. To confirm, have you set up a custom field to pass the exchange rate?
If not, you can follow the steps suggested there and then map that custom field in the Create Invoice step within your Zap.
I hope this helps, and don't hesitate to reach out if you have any other questions!
Thank you for your response.
I did manage to do this. QuickBooks has an exchange rate field. Needed to calculate the home amount correctly. I custom field would not work.
The issue was using the QuickBooks api correctly.
After battling with copilot that kept saying it could not be done. I fed it a link to the api. After that it did write the required code for a custom action.
// Define and export an async function to update an invoice in QuickBooks Online
export async function updateInvoiceWithExchangeRate({
invoiceId,
syncToken,
exchangeRate,
currencyCode,
currencyName,
customerId,
companyId
}: {
invoiceId: string;
syncToken: string;
exchangeRate: number;
currencyCode: string;
currencyName: string;
customerId: string;
companyId: string;
}): Promise<{ result: string }> {
// Construct the URL using the companyId
const url = `https://quickbooks.api.intuit.com/v3/company/${companyId}/invoice`;
// Prepare the request body with the necessary invoice details
const body = {
Id: invoiceId,
SyncToken: syncToken,
CurrencyRef: {
value: currencyCode,
name: currencyName // Include the currency name in the request body
},
ExchangeRate: exchangeRate,
CustomerRef: {
value: customerId
},
sparse: true
};
// Make a POST request to the QuickBooks API using fetchWithZapier
const response = await fetchWithZapier(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify(body)
});
//return { Reponse: JSON.stringify(response) };
// Use throwErrorIfNotOk to handle any errors in the response
await response.throwErrorIfNotOk();
// Return a success message if the request was successful
return { result: 'Invoice updated successfully' };
}
Great work here
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.