CA Service Desk Manager
Hello, I'd like somebody help me with this...
I need register in "zLog_Values" table every change made in some fields of "zValues" table, using spel code
I have two custom tables: "zLog_Values" and "zValues".
The "zValues" fields are:
-cr_persid (SREL to cr table)-chg_persid (SREL to chg table)-value1-value2-value3
I need register in "zLog_Values" table the following values from zValues table and the current session:
-Contact name who is making the change in the field (connected user)-Modification date (current date)-Current value (fields= value1, value2, value3)-New value entered by the user(fields= value1, value2, value3)-Request/Incident/Problem/Change persid
Thanks in advance,
You can access the previous value of an attribute when that attribute is passed as a parameter in a trigger. So for all the attributes you want to check you’ll need them added as parameters.
cdtj explains this well here. How can I get the previous and current value of a field in a POST-VALIDATE TRIGGER?
You can can use the spel api method insert_object to create entries in this customs table. Also, instead of creating two columns with relationships to chg and cr I suggest creating one column called object and storing the persistent_id of the foreign object as a string. One reason for this is the foreign key for the chg table is id but the foreign key for cr is persistent_id.
Let is know if you need help with the trigger/script.
Thank you so much!
I wll chedk that link as soon as I can.
Thanks Grant! you're very kind!
I will try what you suggest about the fields....
Honestly, I have a bit experience building spel scripts/triggers, so, definetly I'll need help.
I was read about audit log and kpi options but I think it will work only for OOTB tables.
My concern also was how to obtain the previous value of the updated fields...and yesterday I found this link Save Previous Value to custom field (made by you)
Also, before you get too far into this. Have you looked at enabling kpi ticket data or investigated the audit log options? If either of those work for your use case they would be preferred.