Xero Invoice Status Field Value Resolution

Hi There, I’m trying out the Xero interface. I’ve got as far as creating a type for output, doing a GetInvoices, then I loop For Each and transfer the fields that I want2017-12-27_10-19-26 to the Output List.

When I set the status value =ForEach1.Loop.Status , I get “5” instead of “Paid”.

Question: What do I need to do to get “Paid” Status instead of “5”?

Hi Mike,

Thank you for your question. I see you’re past the most difficult part of using Linx with Xero, so most of the rest is quite easy.

The values we receive from Xero are normally codes that refer to values, for instance, in the results for an invoice, a Paid invoice will give us a code of 5. If you look at the Status Type for Xero within Linx, the type would actually be integers, but we’ve enumerated the values to understandable names (i.e. PAID).

However, when you’re carrying the data forward, you are using the integer values (5) and writing that to a file.

There’s a couple of ways to rather show “Paid” instead of “5”. One of the easiest (most understandable) ways is to do an IfElse, and check for the values received, creating a string values you’d want to use.

I’m going to create a small example solution in a bit and attach it here to show some options.

Regards,
Dawie

Thanks Dawie, I based my project on your example project, which really helped. My output is going to JSON for a Cosmos DB solution so I don’t need the numbers, just the enumeration name. That would apply to all enumerations in the Xero data. Is it possible to create a function for this? If so could I do it myself (If I really wanted to :-))?

Dawie, I just noticed the 'Enum Format" option on the Json Writer. I tried it but it didn’t seem to change anything. However it would be nice if this did the trick!

Well I just discovered that Status.ToString() gives the enum string (ie “PAID”). I was trying to write an IfElse to resolve the value and the string sort of popped out :-). So, problem solved.

1 Like