/build/static/layout/Breadcrumb_cap_w.png

destroy data in a field

I need to destroy all existing data in a custom field. How can I do this.  I did a script which ran as on save only for now but it seems like it only works if I open the ticket.


Any one know how to do this?


0 Comments   [ + ] Show comments

Answers (1)

Posted by: Hobbsy 2 years ago
Red Belt
0

Ticket rule, if it is every value in a custom field, write a simple ticket rule to set that field to NULL.


Comments:
  • Thanks.. I thought the same. But as far as I can tell, rules don't run on closed tickets. I wrote this script and while it runs on a open ticket just fine, it wont run on a closed ticket. the select result is 0 if it is in a closed status. This rule is just to do a test of a saved ticket, I realize if I wanted to run it on all tickets Id need to modify... or would it work? Anyway, another subject.

    SELECT

    HD_TICKET.ID, -- $id
    HD_TICKET.ID AS TICKNUM, -- $ticknum
    HD_TICKET.TITLE, -- $title
    HD_STATUS.STATE

    FROM
    HD_TICKET

    JOIN HD_STATUS S ON S.ID=HD_STATUS_ID
    Inner Join
    ORG1.HD_STATUS On ORG1.HD_STATUS.ID = ORG1.HD_TICKET.HD_STATUS_ID
    join HD_SERVICE_TICKET ST on HD_TICKET.SERVICE_TICKET_ID = ST.ID
    join HD_SERVICE SERVICE on ST.HD_SERVICE_ID = SERVICE.ID

    where
    (HD_TICKET.HD_QUEUE_ID = 5)
    and (SERVICE.ID = 21) and (ST.ORDINAL = 3)

    update
    HD_TICKET
    set
    HD_TICKET.CUSTOM_FIELD_VALUE20 = "Entry removed"
    where
    (HD_TICKET.HD_QUEUE_ID = 5) and
    (HD_TICKET.ID in (<TICKET_IDS>))


    03/05/2022 05:19:20> Starting: 03/05/2022 05:19:20 03/05/2022 05:19:20> Executing Select Query... 03/05/2022 05:19:20> selected 0 rows - barchetta 2 years ago
  • Ticket rules will run on whatever data you want and whenever, if you want the ticket rule to run on save then the ticket probably needs to be open. If you set your select so that it only runs on closed tickets select the ticket rule to run on tickets that are closed every hour, even better run it on tickets closed within the last hour to reduce stress on the database. - Hobbsy 2 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