Hi,
I have the following data that I am sending to Xero:
- Job 1 - JOB-00001
- Invoice Line Item 1
- Description - ‘Apple’
- Cost - 50
- Invoice Line Item 2
- Description - ‘Orange’
- Cost - 60
- Invoice Line Item 1
- Job 2 - JOB-00002
- Invoice Line Item 3
- Description - ‘Banana’
- Cost 30
- Invoice Line Item 4
- Description - ‘Pear’
- Cost 70
- Invoice Line Item 3
I have managed to pull out all the descriptions and costs as a comma separated string using the line-itemiser, which looks like this:
Output: Description: Apple,Orange,Banana,Pear
Output: Cost: 50,60,30,70
Which is great, but I need to tell Xero which items belong to which job. What I actually need for the description is:
Output: Description: JOB-00001 - Apple,JOB-00001 - Orange,JOB-00002 - Banana,JOB-00002 - Pear
Because the job number sits one level up on the message format, I can’t use the itemiser or append to match the invoice line items.
I think I need to use a code snippet to loop through each invoice item, find the relevant job number, and append it to the description and return a comma separated string, but I don’t know how to approach this with the non-array text inputs into the code snippet.
Any help would be appreciated. Thanks.