CA Service Management

 View Only
  • 1.  Create an Incident from a URL and preset logged in user as AEU

    Posted Feb 04, 2016 06:50 PM

    Hi Community,

     

    I'm trying to figure out how to preset the Affected End user on an Incident with the currently logged in user.  I know that in macros you can use the object audit_userid to grab the id of the logged in user.  Do you know if it's possible to build a URL which utilizes audit_userid?  I think this might not be possible as it seems the values are input before the user logs in.

     

    Here is my working URL:

    http://hlpdskdevapp.chq.ei/CAisd/pdmweb.exe?OP=CREATE_NEW+FACTORY=in+PRESET=category:pcat:400048+PRESET_REL=affected_ser…

     

    I'm trying to add something like this to the end of the PRESET_REL string.

    @@customer:audit_userid.id

     

    Any idea if this is possible?



  • 2.  Re: Create an Incident from a URL and preset logged in user as AEU

    Posted Feb 08, 2016 01:30 AM

    I have no idea if this is possible with the URL alone but could you work your way around it by adding an additional KEEP argument to the URL and then put an if-clause on the form where you give the AEU field a default value depending on that KEEP argument? Didn't try if this is even remotely feasible but it's apparent that the usual $cst tricks don't work on the URL.



  • 3.  Re: Create an Incident from a URL and preset logged in user as AEU

    Posted Feb 24, 2016 10:57 AM

    This may  depend from where you wanted to use /construct this URL.

    i.e. if the user is already logged iand you construct your URL from an HTMPL form, n you must be able to access the $cst.id variable and use it to construct your URL

    Something like :

    ?op=CREATE_NEW+FACTORY=in+PRESET=customer:$cst.id

    and the $cst.id will be replaced by the preprocessor with the correct value

     

    This will of course not work if your link is just harcoded somewhere outside of SDM

    just out of my head so to be tested...

     

     

    Hope this help.

    /J



  • 4.  Re: Create an Incident from a URL and preset logged in user as AEU

    Posted Feb 24, 2016 11:41 AM

    Thanks for the reply,

     

    In this case the link is hard coded into another web application and the user is not already logged in.  I figured this likely wasn't possible.



  • 5.  Re: Create an Incident from a URL and preset logged in user as AEU
    Best Answer

    Posted Feb 25, 2016 03:02 AM

    Took a while but I managed to get it to work.

    I assume you want whoever clicks on that link to be set as the affected end user once they log into SDM, single sign-on or not. You'll need to change a number of forms if you can't be sure which role the logged-in user is going to have when they actually log in but that's the trade-off of this solution as it depends on form customization.

    I built on the idea I presented earlier that maybe you could do something based on a custom URL parameter. It turns out this works just fine, so first construct the url with something like this

    http://localhost/CAisd/pdmweb.exe?OP=CREATE_NEW+FACTORY=cr+KEEP.foo=bar

    Then on the detail form right before the last script block within the head block is closed, add these lines (might not be too picky about the location but that that's where I have the lines and I know it works)

    <PDM_IF "$args.KEEP.foo" == "bar">
          <PDM_SET args.customer="$cst.id">
          <PDM_SET args.customer.combo_name="$cst.combo_name">
    </PDM_IF>

    Now every time the user clicks on your link there is the custom KEEP param on the URL which is then tested on the PDM_IF block and the $args variables are set with PDM_SET accordingly. Verified this works for requests, so adapt it for incidents and replace the KEEP param with something more sensible and you're good to go.



  • 6.  Re: Create an Incident from a URL and preset logged in user as AEU

    Posted Feb 25, 2016 12:29 PM

    Thank you Jussi,

     

    I had given up on this idea but it's now a possibility!



  • 7.  Re: Create an Incident from a URL and preset logged in user as AEU

    Posted Feb 26, 2016 01:30 AM

    You're welcome! I enjoyed the challenge so win-win