-- script: EmailScriptToCloseFPTicket.lua -- purpose: This Script will query the FootPRints SQL DB and associate the NimID with the FootPrints Incident ID of the particular alarm, sending the "Status=Closed" Email to FP cLosing the ticket -- author: Stephen Ternes (sternes@sourcedirect.com), Source Direct -- (c) 2013 Source Direct ---------------------------------------------------------------------------------------------------------------- -- Input values for:[ServerIP], [FootPrintsDBName], [SQLUSERID], [SQLPassword], [FootPrintsTableName], [FPWorkspace#], [FPEmailAddress] --Get Alarm Variables a=alarm.get() --Open connection to the SQL Database; database.open("Provider=SQLOLEDB;Server=[ServerIP];Database=[FootPrintsDBName];User Id=[SQLUSERID];Password=[SQLPassword];") --Run Query to identify the particular ticket by searching for the NIMID within the Description FPID = database.query("SELECT top 1 [mrID] FROM [FootPrintsDBName].[dbo].[FootPrintsTableName] where [nim_id]='"..a.nimid.."'") --Display the Issue ID from Footprints print ("Issue="..FPID[1].mrID.. " Proj=[FPWorkspace#]") --Email FooPrints with the Issue Number Variable in the Subject line and "STATUS=closed" in the body of the email to close the ticket recipient = "[FPEmailAddress]" title = "Issue="..FPID[1].mrID.. " Proj=[FPWorkspace#]" buf = "STATUS=closed" action.email(recipient,title, buf) end database.close()