I keep a Wiki for each of my clients that contains all relevant tech information. My goal is to have a field (textbox, but preferably a hyperlink) on the SD Incident that shows the value of the custom organization field I've made. For example, my company, ABC, has a custom org field called Wiki with a value of "http://www.mywiki.com/abc". Any time I open a ticket for the ABC org I want that URL displayed so my techs have quick access to their info by either clicking or copy/pasting.
What I've done so far:
I've tried a million things to call that sub but the bottom line is I'm having trouble with 2 specific things:
Thank you all for any help you can give me. Hours of trying to piece together other forum posts and Kaseya KB articles have led me to this brick wall.
That's quite funny because I am looking to do the exact same thing...
I just haven't had time to get to it.
Send me or Post on this thread your xml file with the SQL query and I'll sort it out for you
Absolutely. Here is the xml file:
<?xml version="1.0" encoding="utf-8"?>
<queryDef label="getWiki" sql="
from kasadmin.orgCustomFields C
inner join kasadmin.orgCustomFieldsDef D on D.id = C.orgCustomFieldDefFK
inner join kasadmin.org O on O.id = C.orgFK
where D.ref = 'Wiki' and
O.ref like '[$Organization$]'" />
The query works in SQL Studio and returns the URL string. Thank you so much for your help. I'm often extremely disappointed at how terrible it is to customize anything in Kaseya if it can even be done at all.
Try adding "Top 1" to the elect
select Top 1 C.fieldValue .....
This way it stops the query returning multiple values which will cause it to fail
2nd is the O.ref like '[$Organization$]'" statement
Does the [$Organization$] alwasy equal exaclty what the WIKI D.ref is
Try changing it to O.ref like '%[$Organization$]%'"
As for the organization variable, I have no idea what that is. Is there a quick way to output the value of that variable to the screen on a SD ticket so I can see its value? I've been operating under the assumption that [$Organization$] is the short id given to an organization (e.g., Alpha Beta Company would have the ID in our system of "abc", so I assumed "abc" was what [$Organization$] was).
Trouble shooting SD is never easy
The best way is to add a step to a stage entry procedure that either send yourself an email and include inthe Subject or Body the variables you want to debug.
Or add a note to ticket using the same variables
Then you'll see exactly what kaseya resolves the variables to
Ok, I did the email in the waiting on stage. [$Organization$] does contain what I thought it did, so my query should be fine. I guess that means the problem is with how I have it executing or the steps beyond that.
I just created a Custom Field called Wiki i my DB , added a few URL's to a few Org's and ran the query fine.
So it might be how you are processing the query result in kaseya
Could you post a screen shot of the SD procedure and how you call the SQLQuery and then the lines following etc
Absolutely. Here is the sub procedure that executes the query and populates the Wiki variable:
I attempt to load the contents of the "wiki" variable in the Enter New stage (I've been testing this by making new tickets for the one org that has a wiki attribute set):
I've tried all different variations for the second parameter that I could find in the documentation: wiki, #wiki#, [=wiki=], etc. Nothing worked that I could see (one of those may have worked but my next step of getting that value into the ticket interface was probably broken).
Let's assume the assignCustomField worked and put the data into a ticket-wide "wiki" variable, how would I then access it in the editing template?
Again, I tried all of the different ways to reference the variable in addition to the above, cfwiki.
Again, thank you for helping me troubleshoot this.
Try moving the Assign Custom Field Step into the actual GetWIKI Sub Procedure
Not sure but the variable may not be able to be passed from one procedure to another
I can definitely do that, but how then will it get displayed in the ticket? Is my syntax from the last picture correct? Should I use a String or something else? Does the global ticket variable "wiki" get called as #wiki#, [=wiki=], or something else?
When checking for a variable i.e. If CheckVariable Exists you need to use #wiki#
But then to use the actual variable , i.e. in a Note or Assigning to a field you use [=wiki=]
It doesn't matter which procedure you assign the custom field in .. it will still be displayed in the ticket
I moved the assign task into the getWiki procedure and I left the execute procedure call in the Enter New stage. I created a new ticket, saved/closed, and re-opened. This is what I see. So obviously the custom ticket field didn't get populated from the assign() task.
Here is what the getWiki() sub procedure looks like now. I added a variable check that would send me an email so I could see if it was there. I never got an email.
Scratch that last post. The email was just extremely delayed. I got the email with the wiki URL (I made the body of the email [=wiki=]. So this sub-procedure works and populates the global ticket variable wiki properly.
That would leave line 2 as the current problem, the value of the wiki variable isn't making it into the ticket custom field. Any suggestions from here?