Need help..

Is there a way to add custom field to auto populate two fields when create a ticket?

1) IP address of the user computer when logged in to kace
2) all computers that with this user as "last user"


Thank you
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Yes, you should be able to do this using a custom ticket rule. If you search the forums (and some of my older posts), you'll see a bunch of examples listed. Here's a couple of mine to get you started:
__________________________

Title:
Autopopulate Department Field

Order:
10

Notes:
Automatically populates department field (custom field 4 in UI, custom field 3 in SQL) with department name. This is to help facilitate creation of weekly Sales reports.

Frequency:
on Ticket Save

Select Query:
SELECT HD_TICKET.ID AS ID FROM HD_TICKET
JOIN USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
WHERE HD_TICKET.SUBMITTER_ID <>0

X Run an update query, using the results from the one above

Update Query:
UPDATE HD_TICKET T
JOIN USER S ON (S.ID = T.SUBMITTER_ID)
SET T.CUSTOM_FIELD_VALUE3 = S.CUSTOM_2 WHERE T.ID=<TICKET_IDS>
__________________________

Title:
Autopopulate Termed User Lookup Field

Order:
10

Notes:
Automatically populates termed user lookup field (custom field 3 in UI, custom field 2 in SQL) with submitter's full name. This is to ensure searches done for termed users' tickets by name can be done after they have been removed from the system (removing users clears the Submitted By field and sets it to Unassigned).

Frequency:
on Ticket Save

Select Query:
SELECT HD_TICKET.ID AS ID FROM HD_TICKET
JOIN USER S ON (S.ID = HD_TICKET.SUBMITTER_ID)
WHERE HD_TICKET.SUBMITTER_ID <>0

X Run an update query, using the results from the one above

Update Query:
UPDATE HD_TICKET T
JOIN USER S ON (S.ID = T.SUBMITTER_ID)
SET T.CUSTOM_FIELD_VALUE2 = S.FULL_NAME WHERE T.ID=<TICKET_IDS>

__________________________

"On Ticket Save" (OTS) Rules

A rule with a frequency of On Ticket Save (OTS) will imply that the query of the rule will act ONLY on the ticket that is being saved. That means when the ticket "save" button is pressed or when an email is sent into the ticket. It does this by adding and HD_TICKET.ID = X to the select query at run time. With clever SQL you could circumvent this restriction, but it is inadvisable -- this is a safe guard that will facilitate your rules performance and ease of development. Take advantage of it.

* per GillySpy
http://itninja.com/question/create-outlook-exchange-profiles07

WHERE T.ID=<TICKET_IDS>

That last part will make sure that the ID (ticket number) from the select query is passed to the update

__________________________

The main trick is going to find out the names to use in the SQL code for the IP address and the "last user", but if you create a report using the wizard (just specify the computer name and these fields) and then go into its SQL code after it's saved, you should be able to pull the names fairly easily. If you need more details, I spelled it out a little better in an earlier post.

http://www.appdeploy.com/messageboards/tm.asp?m=78912&mpage=1&key=𔿿

Next point is how I figure out the field names to use in SQL statements. It's pretty straightforward:

1) make a new report using the report wizard, including the field (or fields) you want to target (along with something that will be obvious, like the computer's IP address, etc)

2) save the report

3) click on a HTML, csv, etc link to run the report

4) verify the correct info is being pulled (some field names/choices aren't obvious, so do this - better to be 100% certain)

5) close the report and redo until you are satisfied with results

6) click on the name of the report to "edit" it and you should see the SQL code for the report

7) look at the first line (or two) for the "SQL names" of the fields you targeted

8) use these names in your custom ticket rules
__________________________

Hope that helps!

John
Answered 03/10/2012 by: jverbosk
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity