/build/static/layout/Breadcrumb_cap_w.png

Ticket rule to add a new record to an asset table- can it be done?

I have a ticket type used to request a new ERP account.  I also have a KACE asset table which lists all of the ERP accounts and users they are assigned to.

I would like to have a ticket rule which, when the request for a new ERP account is completed, adds a record to the Asset table.

I have been successful in creating the ticket rule which creates the record in the ASSET table, but there is associated data in the ASSET_DATA_33 table (linked by ASSET_DATA_33.ID = ASSET.ASSET_DATA_ID.  I have also been successful in appending the correct data to the ASSET_DATA_33 table, and have a ticket rule which looks in theory like it should

SELECT

Select
  ASSET.ID As ID,
  ASSET.ASSET_DATA_ID,
  ASSET_DATA_33.ID As Asset33ID
From
  ASSET_DATA_33 Inner Join
  ASSET
    On ASSET.NAME = ASSET_DATA_33.FIELD_10173
Where
  ASSET.ASSET_DATA_ID Is Null


UPDATE

Update 
ASSET Inner Join
  ASSET_DATA_33
    On ASSET.NAME = ASSET_DATA_33.FIELD_10173
Set ASSET.ASSET_DATA_ID = ASSET_DATA_33.ID
Where
ASSET.ASSET_DATA_ID is null and ASSET.ID in (<TICKET_IDS>)


ERROR

mysqli error: [1062: Duplicate entry '33-2199' for key 'INDEX_TYPE_DATA_ID'] in EXECUTE("Update ASSET Inner Join ASSET_DATA_33 On ASSET.NAME = ASSET_DATA_33.FIELD_10173 Set ASSET.ASSET_DATA_ID = ASSET_DATA_33.ID Where ASSET.ASSET_DATA_ID is null and ASSET.ID in (65837,65838,65839,65840,65841,65842,65843,65843)")


I am assuming that there is an index table or something that also needs to be updated... 


Does anyone have an approach to doing this (that might be completely different) or a suggestion on how to tweak my current approach?

thanks



0 Comments   [ + ] Show comments

Answers (0)

Be the first to answer this question

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