/build/static/layout/Breadcrumb_cap_w.png

Pull Data from AD for Fields in Tickets

We have a few required fields for our tickets to be closed and some fields are already pre-populated in AD (we do use LDAP SSO for authentication). I do not see any reason why these fields cannot be auto-populated with the information from AD. One example is the users Department. This is already in AD, so how can I get this field to pre-populate?


0 Comments   [ + ] Show comments

Answers (2)

Posted by: chucksteel 1 month ago
Red Belt
2

I use custom ticket rules to populate these values. For example, in our main helpdesk queue (ID = 2) custom field number 11 (CUSTOM_FIELD_VALUE10) is the user's location. The default value for this field is Set on Save. Here is the select rule which runs on save and identifies tickets that need the submitter's location set:

select HD_TICKET.*, DATE_FORMAT(HD_TICKET.CREATED,'%b %d %Y %I:%i:%s %p') as CREATED, DATE_FORMAT(HD_TICKET.MODIFIED,'%b %d %Y %I:%i:%s %p') as MODIFIED,
                        HD_STATUS.NAME AS STATUS_NAME,
                        HD_STATUS.ORDINAL as STATUS_ORDINAL,
                        HD_IMPACT.ORDINAL as IMPACT_ORDINAL,
                        HD_CATEGORY.ORDINAL as CATEGORY_ORDINAL,
                        HD_PRIORITY.ORDINAL as PRIORITY_NUMBER,
                        STATE, 
                        if((datediff(DUE_DATE, now()) = 0), 2, if((datediff(DUE_DATE, now())<0), 1, 3)) as SORT_OVERDUE_STATUS,
                        if(unix_timestamp(TIME_OPENED) > 0, TIME_OPENED, 1<<62) as SORT_TIME_OPENED, 
                        if(unix_timestamp(TIME_STALLED) > 0, TIME_STALLED, 1<<62) as SORT_TIME_STALLED, 
                        if(unix_timestamp(TIME_CLOSED) > 0, TIME_CLOSED, 1<<62) as SORT_TIME_CLOSED, 
                        if(unix_timestamp(ESCALATED) > 0, ESCALATED, 1<<62) as SORT_ESCALATED,
                        if(unix_timestamp(HD_TICKET.CREATED) > 0, HD_TICKET.CREATED, 1<<62) as SORT_TIME_CREATED, 
                        if(unix_timestamp(HD_TICKET.MODIFIED) > 0, HD_TICKET.MODIFIED, 1<<62) as SORT_MODIFIED,
                        if(unix_timestamp(HD_TICKET.DUE_DATE) > 0, HD_TICKET.DUE_DATE, 1<<62) as SORT_DUE_DATE,
                        case upper(STATE) 
                        when 'CLOSED' then unix_timestamp(HD_TICKET.TIME_CLOSED) - unix_timestamp(HD_TICKET.TIME_OPENED) 
                        when 'OPENED' then unix_timestamp(NOW()) - unix_timestamp(HD_TICKET.TIME_OPENED) 
                        else unix_timestamp(NOW()) - unix_timestamp(HD_TICKET.CREATED) end as AGE,
                        if ((LENGTH(U1.FULL_NAME) = 0), U1.USER_NAME, U1.FULL_NAME) as OWNER_NAME,
                        U1.FULL_NAME as OWNER_FULLNAME,
                        U1.EMAIL as OWNER_EMAIL,
                        if (U1.ID is null, 'z', concat('a', if ((LENGTH(U1.FULL_NAME) = 0), U1.USER_NAME, U1.FULL_NAME))) as SORT_OWNER_NAME,
                        if ((LENGTH(U2.FULL_NAME) = 0), U2.USER_NAME, U2.FULL_NAME) as SUBMITTER_NAME,
                        U2.FULL_NAME as SUBMITTER_FULLNAME,
                        U2.EMAIL as SUBMITTER_EMAIL,
                        U2.WORK_PHONE as SUBMITTER_PHONE,
                        if (U2.ID is null, 'z', concat('a', if ((LENGTH(U2.FULL_NAME) = 0), U2.USER_NAME, U2.FULL_NAME))) as SORT_SUBMITTER_NAME,
                        if (U3.ID is null, 'z', concat('a', if ((LENGTH(U3.FULL_NAME) = 0), U3.USER_NAME, U3.FULL_NAME))) as SORT_APPROVER_NAME,
                        if(APPROVAL='rejected', 'Rejected', if(APPROVAL='info', 'More Info Needed', if(APPROVAL='approved', 'Approved', if(APPROVER_ID>0, 'Pending', '')))) as APPROVAL_STATUS,
                        Q.NAME as QUEUE_NAME                        
                        from (HD_TICKET, HD_PRIORITY, HD_STATUS, HD_IMPACT, HD_CATEGORY)
                        LEFT JOIN USER U1 on U1.ID = HD_TICKET.OWNER_ID
                        LEFT JOIN USER U2 on U2.ID = HD_TICKET.SUBMITTER_ID
                        LEFT JOIN USER U3 on U3.ID = HD_TICKET.APPROVER_ID
                        LEFT JOIN HD_QUEUE Q on Q.ID = HD_TICKET.HD_QUEUE_ID
                        LEFT JOIN MACHINE M1 on M1.ID = HD_TICKET.MACHINE_ID
                        where HD_PRIORITY.ID = HD_PRIORITY_ID
                        and HD_STATUS.ID = HD_STATUS_ID
                        and HD_IMPACT.ID = HD_IMPACT_ID
                        and HD_CATEGORY.ID = HD_CATEGORY_ID
                        and ((  HD_TICKET.CUSTOM_FIELD_VALUE10 = 'Set on Save') and HD_TICKET.HD_QUEUE_ID = 2 )

Here is the update portion of the ticket rule:

update HD_TICKET as T
    set T.CUSTOM_FIELD_VALUE10 = (
select ASSET.NAME FROM USER
JOIN ASSET on ASSET.ID = USER.LOCATION_ID
where USER.ID = SUBMITTER_ID ) where 
        T.ID = <TICKET_IDS>;


I have similar fields and rules configured for department, phone number, etc. 

Posted by: sven.hain 1 month ago
Third Degree Green Belt
0

You can import those attributes via the user import in the LDAP authentication.

If you click on the clock symbol you can afterwards add custom attributes to the import so that you have it in your users data.

A+RHYcO0rD+OAAAAAElFTkSuQmCC

PKVDkSAREQAREQAREQAREQgQ4E5Ph3QKIDIiACIiACIiACIiACItDzCMjx73llqhyJgAiIgAiIgAiIgAiIQAcCcvw7INEBERABERABERABERABEeh5BOT497wyVY5EQAREQAREQAREQAREoAMBOf4dkOiACIiACIiACIiACIiACPQ8AnL8e16ZKkciIAIiIAIiIAIiIAIi0IFA7w5HajjQp0+fsOyyy4bvvvuuMPQ444wT7rvvvjB48ODCa3WBCIiACIiACIiACIiACIhAYwj8PzqIG7zozH4RAAAAAElFTkSuQmCC


In your service desk queue configuration under Custom Fields you can run queries to get this data in your ticket layout. An example below to choose Vendors from Asset Management.

Query: query: select ASSET.NAME from ASSET where ASSET.ASSET_TYPE_ID = 4 order by ASSET.NAME asc

+3SM0bjdu6YAAAAASUVORK5CYII=

Hope that helps :)


Comments:
  • Thanks Sven! I am not a database administrator by any stretch of the imagination. Is there any possibility that you could explain what that query does exactly? - Nickelrw87 1 month ago
    • Of course. So I have in Asset Management an asset type called "Vendor". There I have all the vendors listed with additional information. Since asset types can not be auto populated in service desk, I need to have a custom field with this query. The query it self looks in the database for the asset type ID 4, which is my type "Vendor" and looks only after the Asset Name and once I click on save, I can see all the vendors in my ticket layout as a field. You need to do a similar query against the user table, for example to get the home phone number:

      query:SELECT USER.HOME_PHONE FROM USER WHERE ((USER.HOME_PHONE > '0')) ORDER BY HOME_PHONE

      The very easiest way to create those queries is to use the report wizard for it. I created a new report with topic "User". Please make sure that you only choose ONE field since more are not supported in a single custom field in service desk. Once you select your field you save the report and look at the data displayed in the report. Add filters if needed to only display what you want to see in the ticket and once finished, you can go in the report again and at the bottom you see the field "Edit SQL". Once you click on it, you see the query and this one can be used in the field as you can see above in my screenshot. Other than that, if you need further help you can also contact your sales rep for a training or professional services where experts can help you to create these queries :)

      Hope that explains it. - sven.hain 1 month 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