Using Custom Fields
QuickBooks allows you to use Custom Fields for Invoices and a few other things. We don't use them in our Simple Starter, but you can add them yourself. They are a little different than other types of fields. You'll need to set them up in your Company Settings in QuickBooks Online. You'll also want to check there so you can see the order in which they appear. Once you have that done this is how to work with them.
Custom Field in Quickbooks JSON
Custom Fields are put in an Array. Notice the "[" at the beginning and the end of the CustomField property. That's your clue it's an array. The array is ordered in the way they appear in your customer settings. Also important to note is the DefinitionId is in that order as well. So the first Custom Field will have a DefinitionId of 1, the second of 2 etc. Also note it has several properties, 3 of which are required when updating or creating an invoice. The only one that isn't is "Name".
In this section of a script notice, how we build up the Custom Field with the three separate steps that use JSONModify. One to set the each property of the Custom Field that is required. Also, notice that we are setting TWO Custom Fields. The first one has the array notation for the First element in an array "" and the second one, uses "". the StringValue prooperty is the one that as the actual value we are sending to the Custom Field. In this case we have those values already set into $vars.
Invoice Map: Send Script
Getting the value out of a Custom Field is easier since all we need to worry about is the StringValue. Here in the Invoice Map: Get Script we get the PONumber and JobNumber out of the $InvoiceJSON