Hi so this string I'm creating and appending in groovy is somehow corrupting the first byte and I have no idea why this happening. Its the second string creation. In this script I'm making a query and the first one works but the second initialization somehow messes up the first byte in the string and I have to do a substring of an extra index (it's two because I'm initializing a comma). Any insight would be very appreciated!!
Note: I'm using mulesoft runtime 3.8.5 in Anypoint studio 6.4.4. Not sure if this is the reason but it is a candidate in my mind...
flowVars.queryIds = "Id IN ("
for (Integer i = 0; i < payload.size(); i++) {
flowVars.queryIds += "\'" + payload[i].Id + "\',"
}
flowVars.queryIds = flowVars.queryIds.substring(0,flowVars.queryIds.size() - 1) + ")"
//Assigning comma because a random byte is getting inserted and this makes that error explicit & deterministic
flowVars.queryFields = ",";
for (String key : payload[0].keySet()) {
flowVars.queryFields += key + ",";
}
//Skipping over custom field isMatch
flowVars.queryFields = flowVars.queryFields.substring(2, flowVars.queryFields.size() - 9);
return payload