I created a support case. The responded solution is added below, it solved my problem.
In a CAI Process, the output is generated based on output fields. As such, object list fields will be always treated as arrays, and single object fields will not accommodate more than one object.
Hence, in this case, using Any or List of Any will not give you the desired output. However, we can set the output field as whole payload of the type attachment to achieve your use case. More details on the same available in the KB below:
I have also attached a sample process to show how the response will vary for success and error scenarios. Kindly import it into your org and use it as reference.
1. The current process is set to give the success output as response now. To change to error response, please change the field name in the last assignment step.
2. ' ' is the HTML encoding for newline character, added for readability. This character can be removed from the expression without causing any validation errors.
3. Please be advised that this is a sample process based on a particular input and output. Please use it only for reference and modify the logic as per your requirement.
P-03139136-1626801791938.zip 3.9 KB