You need to sign in to do that
Don't have an account?
Alejandro Garcia Lopez
how to do a test class for a trigger on a custom object
Hi, i don't understand how to do reference from the trigger in the class, i need the test
this is my trigger
trigger VendidasDisponiblesEstado on Estados__c (before update) {
for (Estados__c c:Trigger.new)
{
integer i=[select count() from oferta__c where Estatus__c = 'cobrada' AND id=:c.id];
c.vendidas__c=i;
integer d=[SELECT count() FROM Oferta__c WHERE TiempoOferta__c >= -1500 AND PrecioVenta__c <= 5000000
AND Estatus__c != 'Descartada' AND FechaCobro__c = Null AND FechaPago__c != Null
AND ((Etapa__c IN ('Compilación expediente compra','Compra final',
'Escrituras en proceso registro','Compilación expediente cliente'))
OR (Etapa__c IN ('Rehabilitación') AND Invadida__c = true))
AND Estado__c=:c.id ];
c.Propiedades_disponibles__c=d;
}
}
this is my trigger
trigger VendidasDisponiblesEstado on Estados__c (before update) {
for (Estados__c c:Trigger.new)
{
integer i=[select count() from oferta__c where Estatus__c = 'cobrada' AND id=:c.id];
c.vendidas__c=i;
integer d=[SELECT count() FROM Oferta__c WHERE TiempoOferta__c >= -1500 AND PrecioVenta__c <= 5000000
AND Estatus__c != 'Descartada' AND FechaCobro__c = Null AND FechaPago__c != Null
AND ((Etapa__c IN ('Compilación expediente compra','Compra final',
'Escrituras en proceso registro','Compilación expediente cliente'))
OR (Etapa__c IN ('Rehabilitación') AND Invadida__c = true))
AND Estado__c=:c.id ];
c.Propiedades_disponibles__c=d;
}
}
But I have come up with a pseudo code here.
Hope this helps.