Search the Community
Showing results for tags 'master'.
Found 1 result
Forgive me if this write-up is crap, I'm fairly new to Automate. But we have the Warranty Master plugin to help pull warranty information for devices. Unfortunately, Warranty Master does not sync with the computers table in the labtech database by default. We are connected to Manage and want warranty dates to sync so that we can automatically start ticketing based on Warranty expiration dates. We have found that the WarrantyEnd dates in the computers table is often random and totally unreliable. To solve this problem, I wrote a few database modifications to sync the dates. Disclaimer: All code is provided for reference use only. You MUST customize it to your own use case. Prerequisites: Just an EDF for PurchaseDate at the Computer Level. Solution: Since our labtech database is running on a MySQL database the solution for this is easy. Triggers. You can learn more about MySQL triggers here: https://dev.mysql.com/doc/refman/8.0/en/triggers.html Basically, the purpose of a trigger is to detect when a change is made to a table and to perform a certain action when it does. In our case, we are detecting changes to the `plugin_warrantymaster_aux` table and updating the `WarrantyEnd` field in the appropriate rows in the computers table with the new values. We are also updating the `extrafielddata` Value field where the row shares the same `ComputerID` and `ExtraFieldID`. This can get a little tricky as the `extrafielddata` table is a junction table for the many-to-many relationship between computers and `extrafield` tables. Be sure you understand what my code does before running it. Scripts: I have attached two scripts which I used to create this sync: AGAIN, ALL CODE IS PROVIDED FOR REFERENCE USE ONLY. !PRNWarrantySyncCommands.sql This script will provide an initial sync for your database. Since our triggers only run AFTER UPDATE and AFTER INSERT on the plugin_warrantymaster_aux table It may be necessary to do an inital sync. MAKE SURE YOU USE THE CORRECT ExtraFieldID(Not 577). !PRNWarrantyMasterSyncTriggersSetup.sql This script will automatically setup the triggers required for the sync to work automatically. MAKE SURE YOU USE THE CORRECT ExtraFieldID(Not 577).