/build/static/layout/Breadcrumb_cap_w.png

Adding an asset entry into a ticket field

Hi Guys.

We are creating an IT-support ticket for the it dept.

We have a field in the ticket where the user phone

number is required.

We have an asset called (company phones),  with the phone

number and the user its assigned to.

Is there a way i can auto-populate the "phone number" field in the 

ticket with the "phone number" from the asset....... if the "Ticket  Submitter"

and the User in the "company phones" asset  are the same?


I pray this makes sense. 


0 Comments   [ + ] Show comments

Answers (2)

Posted by: chucksteel 5 years ago
Red Belt
2

In the Queue configuration's Customize Fields and Layout page choose one of Custom fields that will hold the phone number. Make a note of which field you are choosing, you will need it later.

Set the Field type to Text and the default value to "Set on Save"

Update the label for the custom field in the Layout Ticket Fields section.

Save the queue configuration.

Back on the Queue Detail page scroll down to Custom Ticket Rules and click Customize

Under Choose Action, select New (SQL)

Give your rule a name, something like Set Submitter Phone # Field

Make sure that the Enabled checkbox is checked

For the Select SQL paste the following:

select HD_TICKET.*                       
from HD_TICKET
where HD_TICKET.CUSTOM_FIELD_VALUE5 = 'Set on Save'

You will have to adjust the CUSTOM_FIELD_VALUE5 to match the custom field that you chose. The column names in the database start with 0 instead of 1, so custom field 1 is CUSTOM_FIELD_VALUE0 in the database. So take the number of your custom field, subtract one and change the 5 to your number.

Check the box for Run update query.

For the Update SQL paste the following:

update HD_TICKET as T
    set T.CUSTOM_FIELD_VALUE5 = (select WORK_PHONE FROM USER  where ID = SUBMITTER_ID) where 
        T.ID = <TICKET_IDS>;

Again, update the CUSTOM_FIELD_VALUE5 appropriately.

The <TICKET_IDS> that you see is a variable that will be replaced with the ID of the ticket returned by the select statement. We will be setting this rule to run on ticket save so it will only return one ticket. For scheduled rules that will update multiple tickets the variable becomes a list of the ticket IDs.

This rule will also update the ticket with the user's work phone. Other options are HOME_PHONE, MOBILE_PHONE and PAGER_PHONE. If the phone number is being stored in a custom user field, then that's a bit more complicated.

Under the Schedule section select on Ticket Save for frequency.

Optional: Check the box for Append comment to ticket and enter something like "Set submitter's phone to work phone" if you want to track when the rule has updated a ticket and let the technicians know.

Save the rule.

Profit.


Comments:
  • Hi Chuck
    Well done. It works perfectly.
    Greatly appreciated !!!!!!
    I have been told that not all the users in ADDS have a work phone.
    Will this ticket rule work for them as well.?
    If they have no phone number, I would still like the ticket to be saved and the field to remain blank.
    Just to confirm, Its not a condition for the ticket to be saved right?
    Thank you Again - akmagnum 5 years ago
    • Yes, the ticket will be saved and the value might be set to blank, but I'm not positive. Worst case scenario is that it will fail silently when the ticket is saved.

      Custom ticket rules can't prevent a ticket from being saved, so that isn't a concern. Saving the ticket (via either the Save button or the Apply Changes button) is what makes the rule run. - chucksteel 5 years ago
Posted by: chucksteel 5 years ago
Red Belt
1

Yes, this is possible using a custom ticket rule. It won't populate dynamically, but you can set it up to populate the field when the ticket is saved. Because you are using a custom asset type it is difficult to provide a query for you because the column names in the database are unique to your appliance. It would be much easier if the phone number is also stored in the User data, is it also there?


Comments:
  • Hi Chucksteel.

    Actually .....yes. My user imports from ldap have the telephone numbers listen in the user data.
    I'd appreciate it if you would help me out and tell me how to make this work?
    I've actually never worked with custom ticket rules in kace.

    Thanks. - akmagnum 5 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ