CA Service Management

 View Only
Expand all | Collapse all

CA-SDM WS R11 - Getting Logs (CHG/HD)

  • 1.  CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 11, 2016 11:40 AM

    Hello everybody.

    I have built a webservice (C#) that connects with the WS R11 and gets information from CHGs and HDs. My problem is to get the Activity Logs (Change Order Activity Log List) of those Change Orders or Incidents.

     

    I am not sure if the Act_Log (alg) table and the Change_Act_Log (chgalg) are the tables where we can obtain the textual logs for HDs and CHGs respectively.

    I use the doSelect method to obtain the other information. I know there is a certain nomenclature for the data fields such as:

    group.combo_name; (textual description, not the ForeignKey) status.sym (also textual description, not the Fkey)

     

    For instance, I use only the object table chg with doSelect for the Change Orders and obtain the textual data of the field Status which is in another table. (The field Status in the chg table is a foreign key - but using Status.sym I can go directly to get it as text)

     

    Can someone helpme about the table, acronyms or nomenclature for those activity log tables?

     

    Thank you in advance.



  • 2.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 11, 2016 12:53 PM

    activity logs table are multi-relationship table therefore you will not be able to use dottet syntax to retrieve your info.

    However you can use the method below

    ◦getLrelLength

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

       <soapenv:Header/>

       <soapenv:Body>

          <ser:getLrelLength>

             <sid>1989767513</sid>

             <contextObject>cr:412290</contextObject> use the persid of the parent object

             <lrelName>alg</lrelName> use the lrel factory as defined in the scehma

          </ser:getLrelLength>

       </soapenv:Body>

    </soapenv:Envelope>

    ◦getLrelValues

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

       <soapenv:Header/>

       <soapenv:Body>

          <ser:getLrelValues>

             <sid>1989767513</sid>

             <contextObject>cr:412290</contextObject>

             <lrelName>alg</lrelName>

             <startIndex>0</startIndex>

             <endIndex>3</endIndex>

             <attributes>

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

                <string>description</string> the attributes you want to retrieve

                <string>time_spent</string>

             </attributes>

          </ser:getLrelValues>

       </soapenv:Body>

    </soapenv:Envelope>

     

    you will of course need to have additional call in you code to retreive it

    Hope this help

    /J



  • 3.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 14, 2016 06:31 AM

    Hello jmayer. Thanks for your insight!

    In my whole code I am not using xml parameters calls directly, so Jussi's reply is more or less "enjoyable" albeit the extra resource consuming. Alas, I don't know how to apply your method within my code either, even I absolutely underatand what you had replied. Thank you anyway, very insightful.



  • 4.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)
    Best Answer

    Posted Mar 14, 2016 02:58 AM

    In addition to jmayer's response you could just do another doSelect directly against the alg/chgalg objects and use the call_req_id/change_id in the where clause. You'll need to be careful if you're joining the algs for multiple tickets at a time but as long as you have a specific ticket for which you want to fetch the logs this will work just fine.



  • 5.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 14, 2016 05:35 AM

    HI Jussi,

    Agree your method will work too but just a little safe to use the designed method for it and a little more resource consuming to use doSelect.

    Just my 2 cents

    /J



  • 6.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 14, 2016 06:32 AM

    Thanks for your answer, I was in that direction, although my real problem was to identify the required tables and the usefulness of the dottet syntax. Regards.



  • 7.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 16, 2016 11:37 AM

    Hello Jussi. I opted for your answer. I can bring the data for the CHGs.

    Howver it seems I am unable to pull in the ones from the HD table.

    Here's the fields and the querie I have built:

     

    Table:

    Act_Log (alg)

     

    Fields:

    time_stamp

    time_spent

    description

    type

    (The CA manual says that the field Type it is not used and states it as a foreign key... which field corresponds for the Type then?)

     

    In a crude way:

    ....doSelect(SID, "alg", call_req_id = ID (of the HD), -1, array with the fields above);

    This query string works fine when applying to CHGs, so my mistake must have to do with a field or the wehere clause.

     

    Thansk in advance.



  • 8.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 17, 2016 02:24 AM

    The type field is very much used, no idea which documentation says it isn't. I see no mistakes with the fields you list so I bet you're either querying the wrong object or using the wrong SREL field in the where clause. The fields you used are correct so double check that you use alg + call_req_id for cr and chgalg + change_id for chg. If that doesn't work then paste your real queries here and we'll take a look.



  • 9.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 17, 2016 01:01 PM

    Hello Valkonen: Here's the results:

    For a CHG I retrieve this info (formatted in XML):

     

    <?xml version="1.0" encoding="UTF-8" ?>

     

    - <UDSObjectList>

     

     

    - <UDSObject>

     

     

    <Handle>chgalg:4088772</Handle>

     

     

    - <Attributes>

     

     

    - <Attribute DataType="2005">

     

     

    <AttrName>analyst</AttrName>

     

     

    <AttrValue>3B8656FD8E8A784FA73EA099CA3FD95D</AttrValue>

     

    </Attribute>

     

    - <Attribute DataType="2004">

     

     

    <AttrName>system_time</AttrName>

     

     

    <AttrValue>1447932907</AttrValue>

     

    </Attribute>

     

    - <Attribute DataType="2003">

     

     

    <AttrName>time_spent</AttrName>

     

     

    <AttrValue>248</AttrValue>

     

    </Attribute>

     

    - <Attribute DataType="2002">

     

     

    <AttrName>description</AttrName>

     

     

    <AttrValue>Create a new request/incident/problem/change/issue</AttrValue>

     

    </Attribute>

    </Attributes>

    </UDSObject>

    </UDSObjectList>

     

    s.....doSelect(SID, chgalg[TABLE], (change_id[FIELD] + " = " + (ID[FIELD] of chgTABLE)), -1, array of fields);

    WORKS WONDERFUL!

     

    For a HD there is no data

    .....doSelect(SID, alg[TABLE], (call_req_id[FIELD] + " = \'" + (ID[FIELD] of crTABLE+ "\'")), -1, array of fields);

     

    Notes: The testing HD in CA has log entries.

    I use "\'" because call_req_id is a nvchar - I tried without and with anyway. If without, it gives me bad where clause.



  • 10.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 18, 2016 02:34 AM

    Ah, there's the issue. chgalg uses chg.id as the SREL field pointing to chg table whereas alg uses cr.persistent_id to point to cr table.

    change_id            SREL -> chg.id REQUIRED DISPLAY_NAME "change id"  WRITE_NEW
    call_req_id          SREL -> cr.persistent_id REQUIRED DISPLAY_NAME "call request id"  WRITE_NEW

    If you switch from cr.id to cr.persistent_id on the doSelect for alg you should start getting values, like this:
    doSelect(SID, "alg", "call_req_id = 'cr:123456'", -1, [...]);



  • 11.  Re: CA-SDM WS R11 - Getting Logs (CHG/HD)

    Posted Mar 18, 2016 08:23 AM

    Well, I used the name persid[FIELD] - my papers must be outdated! There is no persistent_id field in my cr table...Thank you very much Valkonen!!! I have tried the persistent_id and worked like a charm!!!