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:
I'm trying to add something like this to the end of the PRESET_REL string.
Any idea if this is possible?
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.
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 :
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.
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.
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
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.
Thank you Jussi,
I had given up on this idea but it's now a possibility!
You're welcome! I enjoyed the challenge so win-win