I’m trying to Get Queue items information (with its status and other details), but I’m getting error as :
For Each currentQueueItem: Object reference not set to an instance of an object.
Kind Note: When I’m running the code in Dev tenant it’s working completely fine, but in “Test tenant” it’s throwing me the above error.
Tried:
→ Connected with the right Test tenant (Orch. URL)
→ Connected with the right Test folder name
→ Am able to add Queue items in Test and status of the items is also converting from New to Successful.
Is it the connectivity or configurable issue?
Please let me know if anyone can help me with this issue.
This usually happens when variable being referenced is not initialized(no value).
Can you please verify below:
the output variable of get items is the one you are using in for each
also it can be the case that queue doesn’t have any items matching the search criteria that you have set.
Do a manual check as well on the queue in orchestrator to see if there are any items matching your search criteria.
To mitigate this, you can do like below:
Before running the loop, include a count check on the output variable being returned by Get queue items activity.
And if count>0 then only traverse through loop.
But I want to use this as I want to fetch the data which is of current date.
Tried using DateTime.Now but it throws me now with the below error:
Get Queue Items: Invalid OData query options. Error code: 1000
NOTE:
->I have 6 items added in the Queue with “Successful” status and I am trying to fetch information from those. So count it should give me as 6 but its showing me 0 but if I remove “To” field from the Get Queue Items property it works fine.
Hi @Nitesh
Use ‘Today’ in the ‘From’ property to retrieve the items for the day.
The issue is that DateTime.Now or DateAndTime.Now returns the current hours/minutes/seconds which means there are not items created at the runtime time; instead ‘Today’ will filter the items for the specific day 01/09/2025 “without time”
I tried above (in From field) with dtime = Cdate(DateTime.Now.ToString(“M/d/yyyy”)) with datatype as System.DateTime and it thrown below error in Get Queue Items activity:
Thanks guys for your quick response, but I figured out the solution with my existing code as DateAndTime.Now in “To” field of Get Queue Items.
I forgot that I didn’t disabled the API settings in my Test server like I did in Dev server. That’s why same code was working fine in Dev but not in Test.
Solution:
After I disabled the API settings from orchestrator (Test tenant), it worked.
Navigate to Orchestrator> Tenant > Settings > General.
Scroll down to “API Settings” and disable the checkbox selected.
Save the configurations.
This solution has been provided in below thread as well.