Looping through a function with preconditions

Hi!

I've just built in a precondition into my (very long) calculation function to throw up an error message if the user hasn't been approved to view a contract_id.
[image.png]Note: The 'check_access_verification' function looks up the user_id and the contract_id in an approval_log table and brings back the status from that.

Seems to work well when used on a single contract_id.

Challenge I'm having is that I have another API that loops through a list of contract_id's, running the calculation on each.

Where one record_id fails because it's not authorized, I'd ideally like it to skip that one and move on to the next, but currently triggering the precondition instantly ends the loop and means it doesn't display any of the successful calcs.

This is the API that loops through a list of contract_id's and in this example, access is authorized for contract_id 123, but not for 125)
[image.png]Because the second one fails, I get this as the output
[image.png]Any ideas on best way forward? Should I be using something other than preconditions in this case?

Thanks,

Nick
Other
3 replies