CA Service Management

Expand all | Collapse all

how to get the organisation information onto the detail page on a selection of Affected end user

  • 1.  how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 02, 2017 01:00 PM

    Hi Community,

     

    Service Desk 12.9 

    Advanced availability

     

    How to get the organisation information on detail page on a selection of Affected End User in Request/Incident/Problem detail page before saving of the ticket.

     

    looking for any reference or suggestions on implementation.


    Thanks,



  • 2.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 02, 2017 02:02 PM

    Hi Venkat - i am not sure I follow exactly what you are looking to do here.  Is it that you are looking to display additional fields from the Organization for which the affected end user belongs to, on the detail form for Req/Inc/Prob?

    Let us know.

    Thanks,

    Jon I.



  • 3.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 03, 2017 06:11 AM

    'cnt' object have 'organisation' attribute which is SREL relation to object 'org'. I would like to display the ticket Affected End User --> Organisation value on one of the detail form field of the ticket before saving the ticket.
    On selection of Affected End User on a ticket, a form field has to auto fill with the Organisation value of 'Affected End User' contact record.

    I believe this can achieved by Java Script, I am looking for any reference and suggestions on implementation procedure.

    Thanks,

    Venkat



  • 4.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 03, 2017 06:15 AM

    HI,

    Using 12.9 jquery is available.

    You will then have to play by the creation of a small function doing an ajax call or however and associate it with an onChange event on your AEU field.

     

    /J

     

    P.S.: have a look into the ...\bopcfg\www\wwwroot\scripts\ajax.js file to see how to do or reuse some functions avalaible there.



  • 5.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 03, 2017 08:28 AM

    Hi jmayer

    I have reviewed the ajax.js and found SyncAjaxCall function is most suitable but how to construct the url?

    any suggestions or reference.

     

    Thanks,

    Venkat



  • 6.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 03, 2017 08:45 AM

    sync XMLHttpRequest request are depreciated  and must be avoided when possible as  this can conduct to bad user experience.

    this is better to implement a sync call using promise or callback method like CA seems to do using the AsyncAjaxCall function

     

    I'm not familiar with the functionfrom CA but you can easily construct your own and access the REST web services using the GET method by providing the necessary path to the object you would like to retrieve.

    Have a look to the REST API doc for those.

    This is alsa pretty of example of AJAX call on internet that are not specific to CA but can provide you good examples

    /J



  • 7.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 04, 2017 06:11 AM

    Hi,

    I have published solution that could fit (or at least provide useful example) your requirements: SPEL: Dynamic filling of related fields in edit mode 

     

    Regards,

    cdtj



  • 8.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 04, 2017 09:23 AM

    Hi cdtj ,

     

    The above document is helpful, can I request you to post the code of detail_cr.htmpl code which is showing in demonstration video in this linkSPEL: Dynamic filling of related fields in edit mode , it will very helpful.

     

    Thanks 



  • 9.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 04, 2017 09:52 AM

    All code presented in the doc, you need to "install" it and then PDM_INCLUDE htmpl form into detail_cr.htmpl

     

    Regards,

    cdtj



  • 10.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 04, 2017 10:50 AM

    Hi cdtj,

     

    I have followed and install the z_backfill.spl , z_backfill.htmpl file added the operation in op_custom.cfg on mentioned locations.

     

    I have added the following code on detail_in.htmpl file 

     

    <PDM_INCLUDE FILE=std_head.htmpl DebugSource=1>
    <script type="text/javascript">
    <PDM_INCLUDE FILE=z_backfill.htmpl>

     

     

    added the onChange event on Affected end user form field.

     

    <PDM_MACRO name=dtlLookup hdr="Affected End User" attr=customer evt="onChange=\\\"zInitBackfill()\\\"">

     

    Now, I have the read only field as below and looking for dynamic filling this value on edit mode.

     

    <PDM_MACRO name=dtlReadonly hdr="Administrative Organization" attr="customer.admin_org">

     

    can you suggest me if something is wrong.

     

    Thanks,

    Venkat



  • 11.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 04, 2017 02:55 PM

    Your code seems to be ok, but no need to add onChange event, on page load script should fetch all lookups and check their related fields. I have tested it in IE11 and Chrome.

    If it doesn't work could you check browser's console and stdlog for more info?



  • 12.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 05, 2017 04:06 AM

    Hi cdtj,

     

    I have removed the onchange function on Affected End user form field as suggested.

    I couldn't find any entry neither in Chrome console or Stdlog's.

     

     

    I have doubt, don't we have to call the function to run?

     

    Thanks,



  • 13.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 05, 2017 06:02 AM

    Hi CodeGeek,

    algorithm works in this way:

    - once you include htmpl file, script will attach event listner to the form as onload activity;

    - when form loads, it executes BackfillInit function, which determines all lookups (and hiers) presented on form;

    - if lookup have "child" attributes, script creates new object which contains: parent lookup, all child attributes and previous value. Also script adds timer to compare values, because we can't catch value change of hidden inputs. Timer triggers every 400ms (defaultly) and compares values.

    - if value have been changed, script calls AJAX query using Webengine OP to fetch values for child attributes, if value is SREL it will fetch COMMON_NAME.

    - then data returns as JSON and fills child attributes.

     

    I have attached detail_cr.htmpl used in my video to doc, could you try to perform test using it?

     

    Regards,

    cdtj



  • 14.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 08, 2017 01:09 PM

    Hello cdtj,

     

    I am testing this solution on SD 14.1 environment,

     

    can you help me to understand what [aria-autocomplete=list] this filter does ?

     function zInitBackfill() {
    if (_dtl.edit) {
    var zBackfills = [];
    jq("[aria-autocomplete=list]").each(function(index) {
    var thisAttr = jq(this).attr("pdmqa");
    if (zConsoleLog) console.log(index + ": " + thisAttr);
    if (thisAttr != "") {
    var thisAttrObjs = [];
    jq("[pdmqa^=" + thisAttr + ".]").each(function(index) {
    thisAttrObjs.push(jq(this).attr("pdmqa"));
    });
    if (thisAttrObjs.length > 0) {
    zBackfills.push({
    key: thisAttr,
    attrs: thisAttrObjs,
    val: zFetchSetValue(thisAttr)
    });
    }
    }
    });
    jq.each(zBackfills, function(index, item) {
    zCheckBackfill(item);
    });
    }
    }

     

    Thanks 

    Venkat



  • 15.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 08, 2017 01:45 PM

    Hi cdtj

    jq("[pdmqa^=" + thisAttr + ".]").each(function(index)

    throwing an error in as incorrect syntax at the above line in 'zInitBackfill' function.

     

    Thanks,

    Venkat



  • 16.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 01:39 AM

    Hi,

     

    >> can you help me to understand what [aria-autocomplete=list] this filter does ?

    this one fetches all lookups on the form.

     

    >> throwing an error in as incorrect syntax at the above line in 'zInitBackfill' function.

    this one clarifies a lot. Due to specification of SDM pre-processor and jQuery sign, both are uses $ as key phrase. To avoid a conflict, in std_head.htmpl, in SDM 12.7 and SDM 12.9 presented this line:

    var jq = jQuery.noConflict();

    Which means that you need to use jq as an alias of $ for jQuery.

    To check this, you can open any page in SDM, open source code (F12) and find for noConflict pharse, to determine alias. If you don't find anything, could you provide your version of std_head.htmpl?



  • 17.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 03:09 AM

    Okay, I have updated entire doc. CodeGeek, could you redownload z_backfill.htmpl file and give another try?

    I think that I fixed jquery alias problem.



  • 18.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 05:25 AM

    Hi cdtj,

     

    I am testing this solution on both 14.1 and 12.9 Service Desk installations, the customer.organisation and customer.location values are getting updated in the form after saving the ticket,  is there some thing needs to be reviewed to dynamically update the values on edit page itself.

     

    I have the  following observations.

     

    I could see the below initialization  in both 14.1 and 12.9 std_head.htmpl

    var jq = jQuery.noConflict();

     

     

    Service Desk 12.9

    var cfgContext = '<PDM_FMT ESC_STYLE=C PAD=NO>${Context:}</PDM_FMT>';
    var jq = jQuery.noConflict();

     

    Service Desk 14.1

    var cfgContext = '<PDM_FMT ESC_STYLE=C PAD=NO>${Context:}</PDM_FMT>';
    var jq = jQuery.noConflict();

     

    I also checked the Affected End User html form element using developer tools (F2) the lookup form values have below class, but in

    class="ui-autocomplete-input"

    z_backfill.htmpl we are looking for "aria-autocomplete=list" as below, how this selector "aria-autocomplete" relate to all the looksups?

     

    "zjq("[aria-autocomplete=list]").each(function(index)"

    SD 14.1

    <input id="df_0_1" pdmqa="customer" tabindex="100" onfocus="return detailFocus(this);" onblur="return detailBlur(this);" onchange="detailAutofill(this,'cnt',true,'combo_name',false,'QBE.EQ.delete_flag=0');" type="text" value="ServiceDesk" size="20" name="customer_combo_name" class="ui-autocomplete-input" autocomplete="off">

     

    SD 12.9

    <input id="df_0_1" pdmqa="customer" tabindex="100" onfocus="return detailFocus(this);" onblur="return detailBlur(this);" onchange="detailAutofill(this,'cnt',true,'combo_name',false,'');" type="text" value="Ebonding, RSA " size="20" name="customer_combo_name" class="ui-autocomplete-input" autocomplete="off">

     

     

    Thanks,

    Venkat



  • 19.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 05:51 AM

    Thank you for examples, CodeGeek!

    Very interesting, because my code in each lookup/hier looks like this:

    <input
         id="df_0_0"
         pdmqa="requestor"
         tabindex="100"
         onfocus="return detailFocus(this);"
         onblur="return detailBlur(this);"
         onchange="detailAutofill(this,'cnt',true,'combo_name',false,'');"
         type="text"
         value=""
         size="30"
         name="requestor_combo_name"
         class=""
         autocomplete="off"
         role="textbox"
         aria-autocomplete="list"
         aria-haspopup="true"
    >

     

    So, as a workaround we can use:

    zjq("[type=text]").each(function(index) {

    instead of:

    zjq("[aria-autocomplete=list]").each(function(index) {

     

    Regards,

    cdtj



  • 20.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 06:34 AM

    Thank you cdtj,

     

    I have made the changes to z_backfill.htmpl as 

    zjq("[type=text]").each(function(index) 

     

    I could an error message on browser console as follows.

     

    Uncaught Error: Syntax error, unrecognized expression: [pdmqa^=category.]

    I believe this error message thrown from the below statement in z_backfill.htmpl, what

    zjq("[pdmqa^=" + thisAttr + ".]").each(function(index) 

     

    In the html form element the syntax for the pdmqa attribute as follows 

    pdmqa="category" - Area/Category
    pdmqa="requested_by" - Affected end user

     

     

    what we are trying to fetch the values into these variable

    thisAttr

    and this array.

    thisAttrObjs

     

    Thank you,

    Regards,

    Venkat



  • 21.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 07:01 AM

    Could you share HTML code of "child" attributes? (like requestor's location and organization)

    jQuery expression [pdmqa^=category.] should fetch all attributes that contain category. such as catgeory.group and category.assignee in my example.

     

    Also direct executuion from console of:

    ahdframe.zjq("[pdmqa^=category.]");

     could be useful.



  • 22.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 07:35 AM

    I have only two dependent attributes in the form those are customer.organization and customer.location, I don't have any category dependent attribute elements in the form.

     

    Affected end user organisation html element

    <td id="df_1_0"
    pdmqa="customer.organization"
    style
    ="font-size:0.7em;"

    class="detailro"
    align="left"
    valign="top">

    Test Org
    </td>

     

    Affected end user Location html element

    <td id="df_1_1" 
    pdmqa="customer.location"
    style
    ="font-size:0.7em;"
    c
    lass="detailro"
    align="left"
    valign="top">

    Kings Mountain
    </td>

     

    Thank you

    Venkat



  • 23.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 08:16 AM

    Could you execute this code directly from console and share output?

    ahdframe.zjq("[pdmqa^=category.]");


  • 24.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 07:53 AM

    the below are the results of 

    ahdframe.zjq("[pdmqa^=category.]")

     

    // customer

    VM5135 jquery-1.9.0.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [pdmqa^=customer.]
    at Function.a.error (VM5135 jquery-1.9.0.min.js:2)
    at f (VM5135 jquery-1.9.0.min.js:2)
    at x (VM5135 jquery-1.9.0.min.js:2)
    at Function.a [as find] (VM5135 jquery-1.9.0.min.js:2)
    at init.find (VM5135 jquery-1.9.0.min.js:2)
    at init (VM5135 jquery-1.9.0.min.js:1)
    at st (VM5135 jquery-1.9.0.min.js:1)
    at <anonymous>:1:22
    a.error @ VM5135 jquery-1.9.0.min.js:2
    f @ VM5135 jquery-1.9.0.min.js:2
    x @ VM5135 jquery-1.9.0.min.js:2
    a @ VM5135 jquery-1.9.0.min.js:2
    find @ VM5135 jquery-1.9.0.min.js:2
    init @ VM5135 jquery-1.9.0.min.js:1
    st @ VM5135 jquery-1.9.0.min.js:1
    (anonymous) @ Script snippet #1:1

    // Category

    VM5135 jquery-1.9.0.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [pdmqa^=category.]
    at Function.a.error (VM5135 jquery-1.9.0.min.js:2)
    at f (VM5135 jquery-1.9.0.min.js:2)
    at x (VM5135 jquery-1.9.0.min.js:2)
    at Function.a [as find] (VM5135 jquery-1.9.0.min.js:2)
    at init.find (VM5135 jquery-1.9.0.min.js:2)
    at init (VM5135 jquery-1.9.0.min.js:1)
    at st (VM5135 jquery-1.9.0.min.js:1)
    at <anonymous>:1:22
    a.error @ VM5135 jquery-1.9.0.min.js:2
    f @ VM5135 jquery-1.9.0.min.js:2
    x @ VM5135 jquery-1.9.0.min.js:2
    a @ VM5135 jquery-1.9.0.min.js:2
    find @ VM5135 jquery-1.9.0.min.js:2
    init @ VM5135 jquery-1.9.0.min.js:1
    st @ VM5135 jquery-1.9.0.min.js:1
    (anonymous) @ Script snippet #1:1

    Thank you,

    Venkat



  • 25.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 09:06 AM

    please find the attached output.

     

    ahdframe.zjq("[pdmqa^=category.]");

    jquery-1.9.0.min.js:2 Uncaught Error: Syntax error, unrecognized expression: [pdmqa^=category.]
    at Function.a.error (jquery-1.9.0.min.js:2)
    at f (jquery-1.9.0.min.js:2)
    at x (jquery-1.9.0.min.js:2)
    at Function.a [as find] (jquery-1.9.0.min.js:2)
    at init.find (jquery-1.9.0.min.js:2)
    at init (jquery-1.9.0.min.js:1)
    at st (jquery-1.9.0.min.js:1)
    at <anonymous>:1:10

     

    Thank you,

    Venkat



  • 26.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 10, 2017 11:43 AM
      |   view attached

    Hi cdtj

    I have changed the syntax

     

    ahdframe.zjq("[pdmqa^=category.]");
    to
    ahdframe.zjq('[pdmqa^="customer."]');

    and the syntax error is disappeared and I have changed the same format  for all the JQuery selectors. the values are getting updated dynamically on edit page. however, In my testing

     

    Step 1 : If the Affected End User Value is 'Venkat'  the dependent attributes are updated dynamically.

    Step 2 : next, if i cleared the Affected End User value to empty the dependent attributes values become empty.

    Step 3 : Then, If i enter the Affected End User value same as 'VENKAT' as in step 1 , the depend values are not getting updated in dynamically.

     

    Do we need to consider this scenario in the function "zCheckBackfill"

    attached the updated z_backfill.htmpl

    Thanks 

    Venkat

    Attachment(s)

    zip
    z_backfill.htmpl.zip   1 KB 1 version


  • 27.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 19, 2017 05:32 AM

    Hi cdtj,

     

    In this particular function call 

     

    send_wait(0,top_object(), "call_attr",srel_factory, "val_by_key", "REL_ATTR", obj_id, 1, input);

    I am getting the below error unable to obtain the DomSession '501450189' , however the DomSession '501450189' was very old and there is another new DomSession for the same userid.

     

    For ServiceDesk  userid there is a new Session with session ID '284932362' created below is the entry for the same.

     

     

    05/19 04:16:55.41 ITSM-D-SD-A web:local 6172 SIGNIFICANT session.c 10864 Session 284932362:0x04772128 login by analyst ServiceDesk (cnt:A790B9F23EDCC44289A47227C55ECF49); session count 1)

    I could see from the below error message the spl function is looking for the old session i,e  '501450189', even when there is a new session for the same user '284932362'.

     

    Can i get the assistance/Suggestion on how to correct this?  

     

    how to fetch the latest session to pass the send_wait function so that the function call won't fail.?

     

     

     

     

     

     

    05/19 04:16:55.41 ITSM-D-SD-A web:local 6172 SIGNIFICANT session.c 10864 Session 284932362:0x04772128 login by analyst ServiceDesk (cnt:A790B9F23EDCC44289A47227C55ECF49); session count 1
    05/19 04:16:55.57 ITSM-D-SD-A web:local 6172 SIGNIFICANT sel_data_cache.c 4046 Select cache initialization complete
    05/19 04:16:55.58 ITSM-D-SD-A web:local 6172 SIGNIFICANT sel_data_cache.c 1700 3 untenanted objects found in TENANT_REQUIRED factory cnt
    05/19 04:17:10.88 ITSM-D-SD-A web:local 6172 SIGNIFICANT sel_data_cache.c 2253 Secondary cache resomethod:tenant IS NULL is waiting for primary resomethod to initialize

    05/19 04:17:15.62 ITSM-D-SD-A domsrvr 5388 ERROR sec_mgr.c 4027 Unable to find DomSession 501450189 used by user ServiceDesk invoked by domsrvr with reply method got_dob
    05/19 04:17:15.63 ITSM-D-SD-A domsrvr 5388 ERROR factory.c 7255 Error at got_dob in at_by_key: 1 Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)
    05/19 04:17:15.63 ITSM-D-SD-A web:local 6172 ERROR z_backfill.spl 65 msg[0]: Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)
    05/19 04:17:15.64 ITSM-D-SD-A domsrvr 5388 ERROR sec_mgr.c 4027 Unable to find DomSession 501450189 used by user ServiceDesk invoked by domsrvr with reply method got_dob
    05/19 04:17:15.65 ITSM-D-SD-A domsrvr 5388 ERROR factory.c 7255 Error at got_dob in at_by_key: 1 Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)
    05/19 04:17:15.65 ITSM-D-SD-A web:local 6172 ERROR z_backfill.spl 65 msg[0]: Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)

     

    Thanks,

    Venkat



  • 28.  Re: how to get the organisation information onto the detail page on a selection of Affected end user

    Posted May 23, 2017 08:04 AM

    Hi,

     

    how can I obtain the session Id that is being used for particular spl function?

    can we can have a control to pass the session id to send_wait  functional call?

     

    Multiple dom sessions are allowed for single user in our environment  and  in one of my spl function I am getting the error as below.

     

    05/23 06:11:32.98 "ServerName" domsrvr 5388 ERROR sec_mgr.c 4027 Unable to find DomSession 501450189 used by user ServiceDesk invoked by domsrvr with reply method got_dob
    05/23 06:11:32.98 "ServerName" domsrvr 5388 ERROR factory.c 7255 Error at got_dob in at_by_key: 1 Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)
    05/23 06:11:32.99 "ServerName" web:local 11508 ERROR z_backfill.spl 126 msg[0]: Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)
    05/23 06:11:32.99 "ServerName" domsrvr 5388 ERROR sec_mgr.c 4027 Unable to find DomSession 501450189 used by user ServiceDesk invoked by domsrvr with reply method got_dob
    05/23 06:11:32.99 "ServerName" domsrvr 5388 ERROR factory.c 7255 Error at got_dob in at_by_key: 1 Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)
    05/23 06:11:33.00 "ServerName" web:local 11508 ERROR z_backfill.spl 126 msg[0]: Unable to obtain DomSession 501450189 (persid cnt:3C6A12444D3D374AA0A82718C9FACDDF)

     

    how can I fix this.

     

    Thank you,

    Venkat