Change fields on a request from a project using a trigger
Hello I am trying to modificate some fields from a Project to a request and backwards. To do it, I thougt the best way is to create a trigger that changes the fields when one of them change. I am trying to modificate the email field in a request when I modificate it in a project.
I am using: "CREATE OR REPLACE TRIGGER ppmuser.correo AFTER UPDATE OF PARAMETER26 ON ppmuser.KCRT_REQ_HEADER_DETAILS REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN UPDATE PPMUSER.KCRT_REQ_HEADER_DETAILS SET PARAMETER26 = :NEW.PARAMETER26 WHERE PARAMETER4 = :NEW.PARAMETER4 and REQUEST_ID <> NEW.REQUEST_ID; END"
Re: Change fields on a request from a project using a trigger
Is your Project and request related to each other in a Parent child relationship? If yes then you will find a record in knta_references table and then you can create a PL/SQL code and use it in a Workflow execution step whenever a decision is taken on the Project/Request. Before this you might want to check at which stage of Project/Request lifecycle these fields will be modified. Please let me know if this helps.
UPDATE PPMUSER.KCRT_REQUEST_DETAILS SET LAST_UPDATE_DATE = SYSDATE, LAST_UPDATED_BY = 1 WHERE REQUEST_Id = (SELECT REQUEST_ID FROM PPMUSER.KCRT_REQ_HEADER_DETAILS WHERE PARAMETER4 = &proyecto AND REQUEST_ID < &solicitud);
UPDATE PPMUSER.KCRT_REQUESTS SET CONTACT_ID = (SELECT CONTACT_ID FROM PPMUSER.KCRT_REQUESTS WHERE REQUEST_ID = &solicitud), DESCRIPTION = (SELECT DESCRIPTION FROM PPMUSER.KCRT_REQUESTS WHERE REQUEST_ID = &solicitud), LAST_UPDATE_DATE = SYSDATE, LAST_UPDATED_BY = 1WHERE REQUEST_ID = (SELECT REQUEST_ID FROM PPMUSER.KCRT_REQ_HEADER_DETAILS WHERE PARAMETER4 = &proyecto AND REQUEST_ID < &solicitud);
COMMIT; EXIT; EXIT;ï»¿"
It works propertly but i think it would be cleaner with a trigger, because the workflow needs a lot of transitions with this way.
With the Trigger the user would only have to press "save" button, and with this way the user has to transition to other state.