Hi All,

I wanted to set a document in sequence try block, to the ‘document’ parameter value of pub.document:documentToXMLString service in sequence catch block. To get the value of a variable var1 in the catch block we use %lastError/pipeline/var1%. How will it be done for a document?

Thanks in advance.



I can’t understand what you are trying to do. Are you trying to place a copy of a document back into the pipeline in the catch block?


Hi Mark,

Thanks for your response. In the catch block, I need that document to be converted to an xml and attach to an email.


Please advice how to do this. Thanks.


One of my clients approached this by developing a java service that would “recover” one or more variables from the lastError/pipeline.

Basically, the java service accepts the lastError/pipeline document and one or more keys or variable names to restore. For each key, the java service gets the value from the lastError/pipeline document and inserts it back into the pipeline for the service.

The “recovered” variables will not appear in the pipeline editor in Developer, but will exist in the pipeline and can be used in subsequent statements.

Check PSUtilities to see if there is something helpful there.




Writing a java service as Mark suggested is one way of “recovering” the variables from lastError/pipeline, but if you don’t want to use a java service, you can simply achieve this by mapping.

map [lastError/pipeline–>pipeline]
map [pipeline/ --> var]

Here, in the second map step, create a document and indent it so that it becomes a child node inside pipeline, then map this document to whatever document you want. We are leveraging our knowledge of the fact that the ‘pipeline’ (extracted from lastError) contains the variable ‘document’ inside it at the runtime, its just that we don’t see it in the editor.

HTH, Rohit

Hi Pauly,
Agreed with Mark/Rohit,
the way you are accessing variables in pipeline in catch block i.e. %lastError/pipeline/var1%
Same way you can access the document — >

pipeline document in lastError contains all the data (name-value pair) till error occurs in try sequence.

Puneet Saxena


Thank you so much. I did it as explained by Rohit and it worked.


Glad you got it to work :slight_smile: