Training part 4 fails


I get this error once I try to finish the training part 4. It’s not clear to me what I’m doing wrong, even though I have looked at it, and started from scratch, several times.


Source: Assign

Message: Object reference not set to an instance of an object.

Exception Type: System.NullReferenceException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.NullReferenceException: Object reference not set to an instance of an object.
at lambda_method(Closure , ActivityContext )
at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)
at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate) at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)


It means that PN variable is empty. Try to output only that and see if it’s empty or not. After you cand to the Substring only if it’s not empty.

Hi buddy

Welcome to uipath community

this error usually occurs when the object been referred and used in assign activity has null value in it or no value in it
kindly check once with the assign activity in the right side variable is been with value or not
Cheers @Sondergaard

Hi there,

And thank you for the warm welcome :slight_smile:

However, it seems to me that the value includes data. But is it done wrong somehow?

Kindly check whether the variable PN is getting value from Get OCR text,
Use a write line activity next to Get OCR Text activity and check with the output panel with output buddy
if no value get ocr text didn’t fetch any value or
if we get the value, kindly change the scope of the variable PN in the variable panel to whole sequence
Cheers @Sondergaard

Hi @Palaniyappan

Thank you for your advices, but I’m totally new. So most of the stuff you are suggesting, isn’t something I’m familiar with :slight_smile:

How do I check if the variable PN gets the value?

No Worries
–we got an output from Get OCR text activity, with a variable named PN
–next to this Get OCR text activity use a Message box ACTIVITY and mention the input as PN.ToString
–if we are able to see any output with the text obtained from get OCR text activity then we are fine, so now we just need to change the scope of the variable, the variable scope can be changed by going to the variable panel in bottom of studio, click it and change the scope value by selecting the whole sequence name in the drop down list and run again it will work
–if we are not getting any output , then the Get OCR text activity does not give any value at all, we need to select again the text with a new Get OCR Activity

Cheers @Sondergaard


Sorry - I still don’t get it. The things you want me to do, is more advanced than the starter tutorial. Can you please check the Academy starter tutorial in stead? I’m following the steps notoriously, so I really can’t understand what’s missing.

Can i have a view on your xaml if possible
send them all together as a zip file like project.json file, your xaml
Cheers @Sondergaard


If you could illustrate it - exactly - what I need to do eg. with a screenshot, that would be nice.


I’m a new user, so I’m not allowed to upload xaml :S

1 Like

it should be like this, just on where to place the write line activity, dont take the other activities terms,
we can even use message box instead of writeline and mention the same as input
if we are not getting any value then the get text didn’t get any value
if we are getting any value, go to the variable panel highlighted at the bottom left and change the variable PN scope as whole sequence name in the drop down list
Kindly try this and let know buddy

Cheers @Sondergaard


Please… All I need to know/see is, what the correct end result for the Tutorial is. I simply don’t understand the logic behind, yet.

Now you have used message box
So when the bot runs we will be getting a small popup window with the value of PN variable…
Where i told to check the output panel with values ONLY WHEN WRITE LINE ACTIVITY is used…
So you are going good.
Now run the bot, we will be getting the value using get ocr text and that output will be displayed by this message box…if any value is displayed, we just need to change the scope of the variable PN in the variable panel


If no value gets displayed, get ocr text is not getting any value when the bot runs

Kindly try this and let know buddy
Cheers @Sondergaard

@Palaniyappan Yeah, I get the small popup with the value of the PN variable displayed now.

How to change the scope then? :slight_smile:


Okay, now I managed to solve this :-). Can you please let me know what changing the scope does? And how could I know this was the solution?

1 Like

Fantastic buddy
Changing the scope means when we place a activity inside a sequence (usually we call Sequence a CONTAINER), the variable inside those activities will be accessible only inside that container, like a local variable, while if the variable in those activity is changed with the scope in the variable panel, to the whole sequence that is the whole container name, that variable will be accessible in all the activities and in all the container within the main container, like a Global variable, (i mean the container as a sequence, like here DO is a container, where we have activities like Get OCR Text and Message box,)

Hope this would help you
Cheers @Sondergaard