Try Catch and manually set the data

Hi guys,

I need help handling System.NullReferenceException. So I try to assign a variable to take an argument from the queue item, but that argument is null or empty, and then when I try to assign, it will break with “Object reference not set to an instance of an object”. I want to be able to catch that exception and then manually assign the variable a data.


1 Like

Buddy its obvious that when we get a null value to a variable and if that variable is used anywhere as a parameter or argument it will show error like “Object reference not set to an instance of an object”,
so to handle this you can Try Catch block where in Try block you can get the queue item and if it has value no worries it will continue with the process or if it has any null value in the queue, yes we will get exception but that would get captured in catch block, as we would use exception capture mechanism by using system.exception so in catch block use a assign activity to assign a value you want to when null value is obtained

Thats all buddy you are done…
Hope this would help you and kindly let know whether this works or not
Cheers @jadepu2010

1 Like


It’s a good question for when working with exception stuff. You can use Try-Catch Block Activity for this query. inside the Try please use activity or process which has getting an exception while running time from user knowledge. In the Catch Block please select the System.Exception which will get all the exceptions. from there you can assign your exception into a variable.

Use of Try-Catch it will not break your process and you can get what exception your getting on your process and handle that exception.

Please check this link for more information.

I hope after reading this info you can solve your problem:grinning:.


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.