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?
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
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.
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