CA Service Management

 View Only
  • 1.  Add Button to External Link

    Posted Apr 20, 2021 11:14 AM
    Hi Team! 

    I need to add a button on detail_cr, this button should open a new window with a specific URL followed by the case number, name and email of the requester. I can add the button, as well as the reference to a new window with the case number, but I cannot add the name or email of the requester.


    This is the button 

    <PDM_MACRO name=button Caption="Remote" Func="openWindow()" hotkey_name="btnRemote" ID="btnRemote">

    And this is the JS function openWindow(). 

    function openWindow()
    {

    var URL = "https://MyServer:Port/#/redirectremote?ticket=";
    URL = URL+$args.ref_num+'&';
    URL = URL+'emailcliente='+$args.customer.email_address;
    window.open(URL);
    }
     
    My JS code don´t work with $args.customer.email_address or $args.customer.combo_name. Any idea? 

    Thank you!


  • 2.  RE: Add Button to External Link
    Best Answer

    Posted Apr 21, 2021 02:45 AM
    Edited by Wicner Chacon Apr 21, 2021 01:26 PM
    Hello,

    you can´t use SDM variables in JS directly. If you want to use JS variables you have to transform them before.

    Examples in detail_cr (Top):

    <PDM_INCLUDE FILE=std_head.htmpl DebugSource=1>
    <script type="text/javascript">
    var argHumantouchLog = "$args.KEEP.humantouch_log";
    var argPersistentID = "$args.persistent_id";
    var argCstID = "$cst.id";
    
    var argRefNum = "$args.ref_num";
    
    var argID = "$args.id"
    .....
    
    var argEmailCliente = "$args.customer.email_address​";

    function openWindow()
    {
    
    var URL = "https://MyServer:Port/#/redirectremote?ticket=";
    URL = URL+argRefNum+'&';
    URL = URL+'emailcliente='+argEmailCliente;
    window.open(URL);
    }




    Ref_num is already defined.

    Hope it helps.




  • 3.  RE: Add Button to External Link

    Posted Apr 21, 2021 01:26 PM
    Hi henning,

    Thank you! its works.