While extracting one value from Transaction Item from Queue getting Object reference not set to an instance of an object

Hello UiPath Community,

I read data from Excel and save data in a data table, then load data into Queue
While getting transaction items one by one from the Queue for one field, I am getting the error Object reference not set to an instance of an object.

In Excel, the business phone value is empty. I need to verify all the phone numbers

I added screen shot for reference please help me out to resolve this

@Sushma_Ganapatisa
The error “Object reference not set to an instance of an object” occurs because the Business Phone field is empty in some queue items.

use this vb expression

If TransactionItem IsNot Nothing AndAlso TransactionItem.SpecificContent.ContainsKey(“BusinessPhone”) Then
BusinessPhone = TransactionItem.SpecificContent(“BusinessPhone”).ToString
If String.IsNullOrWhiteSpace(BusinessPhone) Then
Log Message: “Business phone is missing.”
Else
Process the phone number
End If
Else
Log Message: “TransactionItem or BusinessPhone field is missing.”
End If

Could you please elaborate on how to write this code in invoke code?

@Sushma_Ganapatisa ,
sure
drag invoke code from activity give the arguments like transaction item for more information refere this thread

cheers!!

@Sushma_Ganapatisa,

Check what’s the value of SpecificContent from Immediate or Locals panel. Most likely it’s null or your key Business Phone is null

Hello @ashokkarale

I have observed only business phone value is null instead “”, how I can resolve this instead null it should give white space “”

@Sushma_Ganapatisa,

Use this expression. It will give you “” if the Business Phone is null else the actual value.

If(TransactionItem.SpecificContent("Business Phone") Is Nothing, "",TransactionItem.SpecificContent("Business Phone").ToString)
1 Like

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