Replacing NULL values in UiPath.Core.QueueItem object

Hey everyone,

I’ve got an issue with the Queue Items that I’m using… When I pull information from SQL and upload the DataTable in bulk to the queue, there are many fields that can be NULL. This is fine, the issue arises when I pull that Transaction Item from the Queue and process it, if it’s a process that requires pushing that Transaction to a new Queue, the fields that are NULL give “Object reference not set to an instance of an object”.

Is there a way comb/format the data in the Queue Item (I’d rather not alter the SQL statements)? Anything consistent would work, whether it be finding a way to upload QueueItems with NULL values, or mapping all the NULL values to a string “NULL” which was what I was doing previously, but in order to make that solution scalable I’d need a different method…

I tried the following:

UiPath.Core.QueueItem TempTransactionItem = TransactionItem;

foreach (KeyValuePair<String,Object> item in TempTransactionItem.SpecificContent) {
    if (item.Value is Nothing) {
        TransactionItem.SpecificContent(item.Key.ToString) = "NULL";

But as expected I reach the error “Collection was modified; enumeration operation may not execute” which I thought I’d get around with the TempTransactionItem, but it still doesn’t work.

Any ideas? Is there a UiPath.Core.QueueItem Method that I can use to make changes based on the values or something?

maybe just change the foreach and use just a simple for…

Are you referencing an activity in Studio? I can’t seem to find a “For” activity, only Foreach ones… I guess I could loop through it with a While loop, a bit more convoluted but would work fine since the collection wouldn’t need to resemble what it’s pointing at for reference.

oh, i thought you were doing this on a invoke code activity…

I honestly probably should, but I find them to be a hassle at times. I’ll give it a shot.

Just add a ToArray() to TempTransactionItem.SpecificContent

foreach (KeyValuePair<String,Object> item in TempTransactionItem.SpecificContent.ToArray) {


Maybe you need also import the namespace System.Linq.

1 Like