CA Service Management

 View Only
  • 1.  get value of a local attribute of the nr object

    Posted Mar 06, 2018 09:31 AM

    Hi Team,

    when an incident is saved, I want to write the value of a local attribute of the nr objet to the incident.
    I need the value in the incident record for a remote reference triggered by an event.
    I tried to realize it in the function  preSaveTrigger (), but I do not get the value,
    $args.affected_resource.zTA_Stellplatz_Nr    doesn't work.
    Defining a hidden variable
    <input type="hidden" name="Set.ci_stellplatz_nr" value="$args.affected_resource.zTA_Stellplatz_Nr">

    and use it in the preSaveTrigger
    var ci_stellplatz_nr = document.main_form.elements["SET.ci_stellplatz_nr"];
    also does not solve my problem, I get the value "undefined".

    Do you know a solution for this problem?

    Thanks
       Baerbel



  • 2.  Re: get value of a local attribute of the nr object

    Posted Mar 06, 2018 10:37 AM

    hi,

    $args object is maintaned by pre-processor, so it cannot be modified on the go.

    Here is 2 ways:

    1. good way:

    - you can simply add dtlReadonly with your attr on incident form;

    2. I really need it:

    - you need to create checker that will catch affected_resource change;

    - using ajax, search for decided attributes using catched UUID and display them on page.

    Regards,

    Timur Alimov



  • 3.  Re: get value of a local attribute of the nr object
    Best Answer

    Posted Mar 06, 2018 05:22 PM

    Hi Bärbel.

    Why not doing this in an object trigger ?

    POST_VALIDATE for example.

    assuming ci_stellplatz_nr is your incident Attribute the Code might look like

    (majic) MODIFY cr POST_VALIDATE your_trigger() 110;

    spel

    cr::your_trigger(...) {
       ci_stellplatz_nr=affected_resource.zTA_Stellplatz_Nr;
    }

    Where and how exactly do you need the new attribute value in your remote reference. If you use a ci_stellplatz_nr substitution in your remote refernence definition, you might be able to use "affected_resource.zTA_:Stellplatz_Nr" instead. So you could prevent any additional change.

     

    cdtj What is meant by  "2) I really need it". Are you looking for a solution getting some values by ajax based on changes of affected_resource? 

     

    Best regards

    ..............Michael



  • 4.  Re: get value of a local attribute of the nr object

    Posted Mar 07, 2018 04:51 AM

    Hi Michael,

    I meant that presented scenario should be used only if someone forced to use it and shouldn't on any other situations

    btw I implemented something like I described, here is an example: SPEL: Dynamic filling of related fields in edit mode.

    Regards.



  • 5.  Re: get value of a local attribute of the nr object

    Posted Mar 07, 2018 05:25 AM

    I see. there might was a missing "f" instead of "2. I really need it" it meant "2. If really need it":

    Thanks, cdtj



  • 6.  Re: get value of a local attribute of the nr object

    Posted Mar 07, 2018 06:43 AM

    Hi Michael, cdtj,

    following situation, the Stellplatz-Nr is passed via soap-request to another application when the incident is created. Normally this should be the Stellplatz-Nr of the ci selected for the incident. If the ci does not exist, the analyst must key in the number manually. This means, I fill the incident Stellplatz-Nr with the one of the ci if the incident Stellplatz-Nr is null. My idea was to write the ci Stellplatz-Nr directly to the incident Stellplatz-Nr so the analyst feels comfortable that the Stellplatz-Nr is OK before saving the incident, I thought using a spell trigger will of course work fine, but the analyst cannot be completely sure regarding this Stellplatz-Nr.
    Now I've got it, I will display the ci Stellplatz-Nr, if it exists and the incident Stellplatz-Nr is null, otherwise the incident Stellplatz-Nr is displayed and can be filled. In my trigger then I will write the ci Stellplatz-Nr to the incident Stellplatz-Nr if this is null. The Analyst is happy and no complicate js-code is needed.

     

    Thanks a lot!

       Baerbel