in_TransactionItem Object reference not set to an instance of an object

Using REFramework, I’ve made a custom function to check if there are any higher priority pending jobs in the orchestrator folder.
It uses and in_TransactionItem, which I supply from Main->GetTransactionData->RetrieveData, just after “Check Stop Signal”. It outputs a bool if there is a pending job or not.

The whole thing works perfectly when I’m running it on my developer machine, both in debug and run. But when I run it unattended on my robot VM’s it throws a “Object reference not set to an instance of an object” error. Let me explain when:

In my custom function, I start out by doing a null check: If: in_TransactionItem Is Nothing
This triggers perfectly the first time the check is run which is when Transaction from Main is an empty variable of type QueueItem
It will then run the process as expected, until it is to do the check again just before getting a new TransactionItem. So this time the TransactionItem contains the QueueItem data from the first run.
Now it will throw the “Object reference not set to an instance of an object” error when it attempts to performs the If: in_TransactionItem Is Nothing.

Can anyone help me out as to why this is happening?

@Henrik_Sondergaard

Can you please check if it is happening on if condition or somewhere else…looks like it is happening on the else side of if condition based on your condition and explanation

cheers

I have Trace Log Messages in both then and else, and neither is triggered when it throws this error

@Henrik_Sondergaard

Can you show a screenshot of the flow and the error screenshot…

if looking at orchestrator trace logs might not come up as well if robot is set to info level

cheers


This is the function in question

@Henrik_Sondergaard

Can you try changing the log level to info and check if it is failing inside else please

and I hope in log messages you are not using any arguments or variables

cheers

Good point about the robot not set to Trace information level. I’ll give it another go with that changed

Thanks Anil_G. This helped out a great deal. I’ve now identified that the problem was indeed not where I expected.
The problem is with the Orchestrator HTTP Request activity with gets data with the following relative endpoint:
“/odata/Jobs?$Filter=State eq ‘Pending’ AND JobPriority eq '” + Priority + “'”

I guess it must have something to do with reduced permissions of the robot account vs. my UiPath dev account.

On my dev machine it will return:
“message”: "Check_Higher_Priority_Pending_Jobs: If Priority IsNot Nothing = true, Deserialize JSON\r\nApiStatusCode: 200\r\nApiJSONResponse: {"@odata.context":"https://url.net/odata/$metadata#Jobs\“,\”@odata.count\“:0,\“value\”:[]}”

Where as on the robot it returns:
message: Check_Higher_Priority_Pending_Jobs: If Priority IsNot Nothing = true, Deserialize JSON ApiStatusCode: 200 ApiJSONResponse: {“@odata.context”:“https://url.net/odata/$metadata#Jobs","value”:}

When I deserialize the JSON after the Orchestrator HTTP Request activity, I specificially look for the “@odata.count” which isn’t returned on the robot

1 Like

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