CA Service Management

 View Only
  • 1.  Updating object data from another object web form

    Posted Jun 28, 2016 08:08 AM

    Hi all,

     

    Configuration: CA SDM 12.9, MS SQL 2012

     

    i got question about updating object from another object.For example i have form detail_cr.htmpl and i would like to update object zpm_portal.

    I tried to build web URL and execute it by AJAX (function SyncAjaxCall). I was inspired by We encounter an issue with customized code not working in every browser except for Internet Explorer. Has anyone encountered the same issue?

     

    This code tried to change value zpm_portal.cr_id from NULL to 'cr:519696' (cr_id SREL -> cr.persistent_id)

    var sURL = cfgCgi + 
          "?SID=" + cfgSID + 
          "+FID=" + fid_generator() + 
          "+OP=UPDATE" +
          "+SET.id=400066" +
          "+FACTORY=zpm_portal" + 
          "+KEY.cr_id=" + escape("cr:519696");
    SyncAjaxCall(sURL);
    

     

    But result of this call was error "AHD04400:Argument error".

     

    My next try was with modified function parameters

    SyncAjaxCall(sURL, "POST", 1000, 1000);
    

     

    But the result was same.

     

    Has anyone experience with this problem? If you have another way to update object from another object please let me know. Btw. SPEL is a last way, i prefere form modification.

     

    Thanks

    Lumir



  • 2.  Re: Updating object data from another object web form
    Best Answer

    Posted Jul 01, 2016 07:24 AM

    Hi Lumir.

    This should be possible, but must be seen as a separate independent trabsaction not related to the cr update, in your example .

    Some thing you need to take care of:

    • updating an object through ajax is a two step process:
      • The first update operation will do a checkout of the object, and returns an "edit page" of the object
      • A second update operation can set several attributes of  the object, and will do a "safe"
    • so the principal is: sending an update operation for the given object
      • this will checkout the object
      • you should pass beside SID
        • FACTORY
        • PERSID : the persistent_id of the object to update
        • HTMPL: use your own htmpl template
        • if you want to use ajax, your own htmpl file may return json with at least $ARGS.FID
      • check for errors, because the checkout may have failed.
      • after this first request do a second OP=Update request with
        • FACTORY
        • PERSID
        • FID : the fid you got from the first request
        • SET.attrname= : don't use KEY stuff because it will try to lookup the given values
      • check for errors, because the checkin may have failed.

    Hope this helps a bit

    Regards

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



  • 3.  Re: Updating object data from another object web form

    Posted Aug 01, 2016 03:22 AM

    Hi Michael,

     

    you are right, thanks a lot for solution.

     

    Lumir



  • 4.  Re: Updating object data from another object web form

     
    Posted Jul 05, 2016 04:36 PM

    Hi Lumir_Botur - Did Michael_Mueller 's response help answer your question? If so please mark as Correct Answer. Thanks!