Integrations and APIs for Service

Get Involved. Join the Conversation.

Topic

    Nicolas Almarza
    Random assignment
    Topic posted April 29, 2019 by Nicolas Almarza, tagged Connect PHP 
    41 Views, 1 Comment
    Title:
    Random assignment
    Summary:
    how to assign a random agent of a group through PHP code.
    Content:

    Hello, I need information on how to assign a random agent of a group through PHP code. What I want to do is that when a button is clicked, the queue must change and an agent of that queue must be assigned. Please help me with information on how to assign an agent of a group through PHP. The code bit is the following: $ incident-> AssignedTo-> Account This piece of code allows searching and finding the value that contains the "Assigned" field of the object "Account". What I need is to assign to that field a random agent from the queue it is in. Thank you

    Version:
    Oracle Service Cloud (RightNow) 18D

    Comment

     

    • Gursimran Singh Saini

      Use rand() function in Report.

      Here's how I would do:

      - Create a report with a runtime filter of queues.queue_id.
      - Table joins: queues -> profile2queue -> profiles -> accounts
      - Columns: accounts.acct_id, rand()
      - Sort rand() column in Ascending order.
      - Now when you run this report, it will rearrange the list of accounts.acct_id in random order every time.

      Run this report from Connect PHP by passing the Queue Filter.
      In the report results, pick the first row and assign Incident to that agent.