I have an automation that is reading workorders from salesforce and creating invoices in intacct.
The trigger queries and returns the workorder with multiple lines. The action uses that to create the invoice. On the workorder data there is a field for coupon code. Not every line will contain the code. Typically i would expect that to fill in a null value for any empty line. for example, i have a workorder with two lines. only one has the coupon
Line Item Amount Total:
Line Item Coupon:
Line Item Product Code:
This coupon should apply to the second line. When i process it, it gets dropped completely and doesnt get read. If I have the code on all lines, it works fine.
This was working until recently, this one is a copy of 3caa25bcad074d098fb2b9680daa92f8. No changes to the code were made. The company was going through a merge so we had to have multiple versions going for each set of credentials.
Any ideas what would cause it to get dropped like that?
edit…If you want to look at the specific one I mentioned here, it was the run on may 6 10:20
Please send me a link to the log where it is happening, I am unable to find it:
The source of trouble is the API response in trigger e5d847b1902c4cfd87946e2c96f740e4:
The API is not returning a consistent schema, such that the schema for the 2nd row having a coupon does not match the schema of the 1st row without a coupon. This in turn messes up Trigger module #7 when it fetches values for coupons:
This is generally a thorny issue whenever working with trigger API’s that emit array data like line items but don’t emit the same schema for each array element.
Sorry, there’s not a general way I’ve found to address this. The only solution I have been able to think of is to use custom Java code to scrub the array elements and insert missing schema elements as needed for the trigger output such that each array element is the same.
For your case, this would mean looping through each line item. Where a coupon is null, you would replace that null node with this schema containing empty node values:
The goal is to make the xpath for the coupons in module Trigger #7 select the same number of elements as all the other xpaths selecting line item data.
Actually, maybe there is a way to build a generic module that could sanitize data rows to clean up schema like this. I will make a note and give it a try one day, but not something I can provide in the very near timeframe.
Thanks. They must have changed something as it was working until recently. maybe api version or something.
I will look into it. thanks
Unfortunately life as an API Integrator can be challenging, depending on the API’s involved.
yeah. tell that to my clients. ha
Wanted to let you know the forthcoming v6.53 release has a new “Data Rows - Standardize Schema” module that will add nodes and attributes as needed to make all data rows have the same XML schema.
For example, given the following XML:
If configured to process data rows root/row, the output will be: