I am extracting vendor information from outlook email body by using regex.
Instead of using multiple matches, I entered regex patterns into a table and applied for each to extract multiple values from the body. Then, I tried to assign extracted regex value into a different table, so I can upload into queue. However, I am keep getting this message…
“Assign: Object reference not set to an instance of an object.”
I have tried all kinds of methods and still can’t find the solution.
Need more context on this, can you share a screenshot of the implementation and the “assign” activity that’s failing? Most likely you’re referencing a null variable.
Basically it means you have nothing/null. 1 or 2 scenarios.
Scenario 1:
If its all the same workflow, it means your Regex pattern is not getting a match. (Its likely this from the screenshot I am looking at).
Scenario 2:
If its from a separate workflow (passed in as argument) then its likely a missing argument connection.
Solution:
You can use a system.text.regularexpression.Regex.IsMatch(yourstring, YourRegexPattern) to check IF there is a match BEFORE trying to extract.
Got a sample email? Or sample text with your expected outout.
(De-identify your data also).
I actually found what the error is.
The error is that the for each was not exiting after it went through all the rows in the table. In fact, the error occurred as it was trying to loop for the 8th time after “postal Code”
Could you please advise me how to make the loop to exit as there are no more rows to apply?
Then, move on to next activity which is to add values into the second table where I created?