Custom ticket rule
Hi everyone,
I have a question, is possible create a custom ticket rule, where the condition was the fields of the LDAP users, and automatically update some fields in the ticket? , due to the wizard don´t have the fields of the user, is very difficult create this condition.
Thanks.
Answers (2)
The wizard is so useless to me I forgot it was even there.
To answer your question.. yes.. it is possible, I do it so the title of the submitter is known to out techs. I simply copy the title from an ldap update to a custom field and in the template I make that custom field read only.
Here is the update portion:
update
HD_TICKET T
set
T.CUSTOM_FIELD_VALUE133 = (
select
UFV.FIELD_VALUE
FROM
ORG1.HD_TICKET
join ORG1.USER_FIELD_VALUE UFV ON UFV.USER_ID = T.SUBMITTER_ID
WHERE
T.ID in (<TICKET_IDS>) AND
UFV.FIELD_ID = "2"
LIMIT 1)
where
T.ID = <TICKET_IDS>
to build on barchetta point here is the custom ticket rule I came up with it updates three or more custom fields using data from LDAP, but in addition, it only updates the field if the person logging the ticket did not input any additional data collected.
UPDATE HD_TICKET
SET
CUSTOM_FIELD_VALUE2 = Coalesce(NULLIF(CUSTOM_FIELD_VALUE2, ''), (SELECT WORK_PHONE FROM USER where USER.ID = HD_TICKET.SUBMITTER_ID LIMIT 1)),
CUSTOM_FIELD_VALUE0 = Coalesce(NULLIF(CUSTOM_FIELD_VALUE0, ''), (SELECT FIELD_VALUE FROM USER_FIELD_VALUE where USER_ID = HD_TICKET.SUBMITTER_ID and FIELD_ID = 1 LIMIT 1)),
CUSTOM_FIELD_VALUE1 = Coalesce(NULLIF(CUSTOM_FIELD_VALUE1, ''), (SELECT FIELD_VALUE FROM USER_FIELD_VALUE where USER_ID = HD_TICKET.SUBMITTER_ID and FIELD_ID = 2 LIMIT 1))
where
(HD_TICKET.ID in (<TICKET_IDS>))