I send both the original and modified request data to System.log, and everything seems fine. I even commented out all the modifications and still get the errors.
Not sure what to look at as the next troubleshooting step.
Segment of code where the error occurs :
var modifiedRequest = JSON.stringify(JSONdata, null, "\t"); // I also tried it without null and "\t". Same error
System.log("Modified Request : " + modifiedRequest);
// Submit request. Both these fail with same error
// request = System.getModule("com.vmware.library.vcaccafe.request").requestCatalogItemWithProvisioningRequest(catalogItem, provisioningRequest);
request = vCACCAFERequestsHelper.requestCatalogItemWithProvisioningRequest(catalogItem, provisioningRequest);
Error message I see in the Logs tab:
<< stringified request that I send to Catalog Item with added modifications. >>
[2018-09-30 07:54:06.995] [E] Workflow execution stack:
workflow: 'Request VM' (f09230c6-4c67-4a77-9cc6-1db56a5312d0)
<< Then it lists inputs and attributes >>
I figured out my main problem.
In the sample code "catalogItem" (as in an individual object) is referenced for retrieving, updating and submitting the request.
I was confusing this with an ARRAY of catalogItems I retrieved earlier. Was fixed in my code by replacing "catalogItem" with "catalogItem" where appropriate.