CA Service Management

Expand all | Collapse all

API to create/run Scoreboard queries in SDM

  • 1.  API to create/run Scoreboard queries in SDM

    Posted 05-02-2017 01:06 PM

    Is there a way to create and execute score board queries through REST API or web services? Can you point to some example code for the same?



  • 2.  Re: API to create/run Scoreboard queries in SDM

    Posted 05-02-2017 02:03 PM

    Hi Vidyadhar - I dont believe there are existing calls that can create scoreboard queries via web services.  Typically Service Desk administrators would create them and then assign them to roles as needed.

    Regards,

    Jon I.



  • 3.  Re: API to create/run Scoreboard queries in SDM

    Posted 05-02-2017 03:52 PM

    Yes it is possible i even have specification for this sadly it is part of project documentation and it is in Lithuanian.

    Anyway here are the general steps that we have used

    1. get scoreboard for selected role:

     

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">

       <soapenv:Header/>

       <soapenv:Body>

         <ser:doQuery>

             <sid>1306509759</sid>

             <objectType>usq</objectType>

             <whereClause>role_persid = 'role:10005'</whereClause>

         </ser:doQuery>

       </soapenv:Body>

    </soapenv:Envelope>

    This will return scoreboard record count for the role and list handle for the next query

    2. Get query information:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">

       <soapenv:Header/>

       <soapenv:Body>

         <ser:getListValues>

             <sid>545350839</sid>

             <listHandle>-1269864422</listHandle>

             <startIndex>0</startIndex>

             <endIndex>3</endIndex>

             <attributeNames>

               <!--1 or more repetitions:-->

               <string>parent</string>

               <string>sequence</string>

               <string>query.label</string>

               <string>query.where_clause</string>

              <string>query.obj_type</string> 

             </attributeNames>

         </ser:getListValues>

       </soapenv:Body>

    </soapenv:Envelope>

     

    Parent will be equal to 0 if it is top node, so this attribute will allow you to build hierarchy

    for each node you will get something like this:

    <UDSObject>
    <Handle>usq:14008</Handle>
    <Attributes>
    <Attribute DataType="2005">
    <AttrName>parent</AttrName>
    <AttrValue>0</AttrValue>
    </Attribute>
    <Attribute DataType="2001">
    <AttrName>sequence</AttrName>
    <AttrValue>260</AttrValue>
    </Attribute>
    <Attribute DataType="2002">
    <AttrName>query.label</AttrName>
    <AttrValue>My Closed Incidents</AttrValue>
    </Attribute>
    <Attribute DataType="2002">
    <AttrName>query.where_clause</AttrName>
    <AttrValue>customer = @cnt.id AND (active = 0 OR status=\'CLREQ\') AND type = \'I\'</AttrValue>
    </Attribute>
    <Attribute DataType="2005">
    <AttrName>query.obj_type</AttrName>
    <AttrValue>cr</AttrValue>
    </Attribute>
    </Attributes>
    </UDSObject>

     

    Now you will need to do some manipulation for where_clause

     

    1. You need to substitute @cnt.atribute_name with every possible cnt attribute value (e.g @cnt.id should be substituted to logged in user id @cnt.last_name with logged in user last name) if you wan't to avoid hardcoding you will need few more webservices queries to get all possible cnt attributes and their values (I will not cover this part). It is even more complex if you will need to handle expressions like @cnt.location.name (but I think even this is possible)

    2. You should remove escape characters \ (e.g. status=\'CLREQ\' transform to status='CLREQ'

     

    Now you are ready create scoreboard tree and get values for the nodes. To get ticket list for selected node you will need to use the following query

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk">

       <soapenv:Header/>

       <soapenv:Body>

         <ser:doQuery>

             <sid>1306509759</sid>

             <objectType>cr</objectType>

             <whereClause>customer = U'6B23356F23E9BD4EA5A1046BA194503E' AND active = 1 AND status != 'CLREQ' AND type = 'I'</whereClause>

         </ser:doQuery>

       </soapenv:Body>

    </soapenv:Envelope>

     

     

     

    Have Fun



  • 4.  Re: API to create/run Scoreboard queries in SDM

    Posted 05-02-2017 03:55 PM

    To create scoreboards you can use createObject method sadly I never done this but I think this is easiest part.



  • 5.  Re: API to create/run Scoreboard queries in SDM

    Posted 05-03-2017 06:07 AM

    Hi Giedrius

    Look nice

    wondering what is the business case behind such implementation?

    /J



  • 6.  Re: API to create/run Scoreboard queries in SDM

    Posted 05-03-2017 11:34 AM

    SDM frontend that was fully integrated in to the external system, but with possibility to manage from SDM.



  • 7.  Re: API to create/run Scoreboard queries in SDM

    Posted 12-26-2017 07:00 AM

    HI, how did you get that role persistent id against any contact? How can I relate this id with given user?



  • 8.  Re: API to create/run Scoreboard queries in SDM

    Broadcom Employee
    Posted 12-26-2017 07:59 AM

    Hi Mandar,

     

    If you connect see in details, each role is linked with access type and access type is linked to contact.

     

    So for a given user - check the access type first and the check the (default) role that is linked to this access type.

     

    Pease note that the Access type contains a filed - roles which is referenced by a BREL relation i.e.

    bop_sinfo -df acctyp

    ...

    roles                BREL <- acctyp_role.access_type {access_type = ?}

     

    To fetch the role for a given access type run the below query on the server in a command prompt i.e.

     

    pdm_extract -f "select * from usp_acctyp_role"

     

    The reults are the list of records that have the relations between AccessType and Roles.

     

    Hope this helps.



  • 9.  Re: API to create/run Scoreboard queries in SDM

    Posted 12-30-2017 06:41 AM

    You can get access type assigned to particular contact by using getAccessTypeForContact method. Then you can use doSelect method to query acctyp_role object to get roles that are assigned to this access type