Get complete data from Queue to Datatable

activities
queueitem
filter-datatable

#1

Is there a way to get complete data present in the queue to an Datatable?


#2

Keep a for loop and read all queue items to DataTable.


#3

@karthi2612

Complete data in the sense, do you mean, Creation Time, Bot Processed etc.

If it is so you can achieve it through Orchestrator API.

Regards,
Mahesh


#4

No no, i mean the actual data present in the queue.


#5

@Karthi2612

Please follow the below Procedure to get the details of Queue Items by using API.

  1. First Create a DateTable Whose columns number should be equal to the Number of Parameters in the QueueItem and in the same Order. Let us take this as dtQueueData

2. First you have to Authenticate to your Orchestrator by using HTTP Request activity
a. Use HTTP Request Activity
b. EndPoint Property : orchestratorurl/api/account/authenticate
url–> Your Orchestrator url
c. In Parameters Section – usernameOrEmailAddress, password
If You are having a Tenant Region then create one more parameter — tenancyName
d. Keep the method as POST
e. You will get one Response as a string in JSON format. let us take jAuthenticate.
f. Next declare one string Variable as AuthenticationToken and
assign with Value as "Bearer "+jAuthenticate(“result”).ToString

  1. Retrieve Queue Definition ID by using Queue Name
    a. Use HTTP Request Activity
    b. EndPoint Property : orchestratorurl/api/account/authenticate
    url–> Your Orchestrator url
    c. In Headers Section create two parameters
    Content-Type–“application/json”----------- Authorization-- AuthenticationToken
    d . In Parameters section
    $filter–"Name eq "+QueueName---------- $select–“Name,Id”
    What Ever fields you mention in Select parameter those will display.
    e. Keep the method as GET
    f. You will get the response as Json String.
    g. Deserialize the JSON string response to Jobj.
    h. Next Access the Value and store as Jvalue= Jobj(“value”)
    i. Next Access the QueueDefinition ID and store as
    strQueueDefID= Jvalue.First.Item(“Id”).ToString()

  2. Access Queue Items by using QueueDefinitionID
    a. Use HTTP Request Activity
    b. EndPoint Property : orchestratorurl/api/account/authenticate
    url–> Your Orchestrator url
    c. In Headers Section create two parameters
    Content-Type–“application/json”----------- Authorization-- AuthenticationToken
    d. In Parameters Section
    $filter-- "QueueDefinitionId eq “+strQueueDefID+” and Status eq "+strStatus
    _ $select-- “SpecificContent”_
    strStatus is the the Status whose values you have ton retreive, for Example, New, InProgress,
    Abandoned etc

    e. Keep the method as GET
    f. You will get the Json Response
    g. Deserialize the JSON response to Jobj.
    h. Get the value Node and store it as Jarray.
    i. Run For Each for JArray
    a. Use DeserialiseJson Activity and pass each value of JArray and Convert that to Jobj.
    b. Create one List variable lstQueueDetails of type string.
    c. Use Below Linq

              lstQueueDetails = From p In jobj.Properties
               Select Convert.ToString(p.Value)).ToList
    

    d. Now Use Add DataRow Activity , Mention dtQueueData as DataTable Name and
    lstQueueDetails.ToArray as Values

Now you will get all the Values in a DataTable

Regards,
Mahesh