GeneXus - Getoldvalue Gx Ev1

 
Vista:
Imágen de perfil de Marco Ricord

Getoldvalue Gx Ev1

Publicado por Marco Ricord (30 intervenciones) el 16/07/2014 21:08:01
No se como lograr utilizar los valores de las variables de un GetOldValue()

La transacción la hize tipo Business Component porque estuve investigando y me dice que se utiliza para usar GetOldValue de la base de datos.

Transacción:
TestingTrn

Evento:
Event AfterTrn

If &Mode = TrnMode.Update
ProcTesting1.Call(TestingTrnId,TestingTrnName,TestingTrnEmail,TestingTrnDescripcion)
EndIf

EndEvent

ProcTesting1: Commit on exit : NO

For Each
where TestingTrnId = &TestingTrnId
If TestingTrnEmail <> &OldTestingTrnEmail or TestingTrnName <> &OldTestingTrnName
TestingTrnName = &TestingTrnName
TestingTrnEmail = &TestingTrnEmail
TestingTrnDescripcion = &TestingTrnDescripcion
ProcTestingMail1.Call(TestingTrnId,TestingTrnName,TestingTrnDescripcion,&OldTestingTrnName,&OldTestingTrnEmail)
EndIf
EndFor
Commit

Rules de ProcTesting1:
parm(in:&TestingTrnId,in:&TestingTrnName,in:&TestingTrnEmail,in:&TestingTrnDescripcion);

&OldTestingTrnEmail = &TestingTrn.TestingTrnEmail.GetOldValue();
&OldTestingTrnName = &TestingTrn.TestingTrnName.GetOldValue();

ProcTestingMail1 es un procedimiento que envía un correo utilizando los valores &OldTestingTrnName y &OldTestingTrnEmail.

No me esta funcionando!! quiero ayuda urgente!!!!! Si falta alguna información haganmela saber para resolver esto.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Marco Ricord

Getoldvalue Gx Ev1

Publicado por Marco Ricord (30 intervenciones) el 18/07/2014 00:00:29
Bueno..... despues de tanto esfuerzo, he logrado lo que quería.
Aquí les dejo el codigo. Espero les agrade. Comenten si les gusta!!! *-*

Esto va en las Rules de la Transacción

[web]
{
&TestingTrn.Load(TestingTrnId)
if Update
on BeforeValidate;
ProcTesting1.Call(TestingTrnId,TestingTrnEmail,TestingTrnDescripcion,&TestingTrn,&Mode)
on BeforeComplete;
}

Esto va en el Procedimiento

&OldTestingTrnEmail = &TestingTrn.TestingTrnEmail.GetOldValue()
For Each
where TestingTrnId = &TestingTrnId
If TestingTrnEmail <> &OldTestingTrnEmail
If TestingTrnDescripcion = &TestingTrn.TestingTrnDescripcion.GetOldValue()
&TestingTrn.TestingTrnEmail = &TestingTrnEmail
&TestingTrn.TestingTrnDescripcion = &TestingTrnDescripcion
&TestingTrn.Save()
ProcTestingMail1.Call(TestingTrnId,TestingTrnDescripcion,&OldTestingTrnEmail)
EndIf
EndIf
EndFor
Commit

Las rules del proc:
parm(in:&TestingTrnId,in:&TestingTrnEmail,in:&TestingTrnDescripcion,in:&TestingTrn,in:&Mode);

el proc es commit on exit NO.
la transaccion es tipo Business Component.

El procedimiento ProcTestingMail1 es el que envía un correo con la variable &OldTestingTrnEmail
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar