Testing for not existing item in collection
I have a call in a business process that returns a response which may contain a collection of error message. I use the following code in my response builder to extract the messge value from the first error and map them to a context variable:
Set context.ErrorMessage callresponse.result.GetAt(1).errors.GetAt(1).message
This works nicely when an error comes up, however when no error is returned (i.e. the collection is empty) I receive an error: ERROR <Ens>ErrException: <INVALID OREF>zOnResponse2+4^Calarm.UserRegistrationProces.Context.1 -- logged as '-' number - @' Set status=1,context.ErrorMessage=callresponse.result.GetAt(1).errors.GetAt(1).message
Obviously I need to test if the result exists before I transfer it to my context.ErrorMessage. However, I can't find the proper command for that. I tried something like $GET(callresponse.result.GetAt(1).errors.GetAt(1).message), but that doesn't work.