If statement is giving error "If: Value cannot be null. Parameter name: value"

Hi all,
My process is giving error “If: Value cannot be null. Parameter name: value” and if statement is not getting executed. I am not able to figure out why it is giving me this error. I have verified that variable “failimport” , “passimport” and “item.name” contains value by printing them just above the if statement. Instead of passing variable, if I pass value stored inside that variable, it works fine.
Below is the screenshot of my if block.

This gives me error:
if error

But this works fine:

Item.Name?? is one variable??

Item.ToString.Contains(“ABCD”) can you try like this??

@sandyk

No. I am using this inside a for each loop. For each item in File.

1 Like

what is Name here??
@sandyk

item.name contains name of file

1 Like

Hi,

I suppose failimportid and/or passimportid are Null (nothing)
Can you check them? If so, the following condition will work.

failimportid IsNot Nothing AndAlso passimportid IsNot Nothing AndAlso (item.Name.Contains(failimportid) OrElse item.Name.Contains(passimportid))

Regards,

1 Like

Can i see your WorkFLow?? @sandyk

@sandyk What is the type of the item variable? Can you send Screenshot of the For Each Loop used?

No. Both variable contains values inside it. I have verified it by printing it just above the if statement.