You need to sign in to do that
Don't have an account?

Data deletion Trigger
I have a requirement:
When the Billing Item with Unit price=0 and Subsegment=Undefined I need to delete the data.
I have written the below code and Process Builder to handle the same but its not working as expected.
public class DeleteBillingItems
{
@InvocableMethod
public static void BIDelete(List<Id> BIIds)
{
List<BillingItem__c> BI =[select id,BillingDocumentId__c,UnitPrice__c,Sub_Segment__c,Gross__c,NettoAmount2__c from BillingItem__c
where BillingItem__c.id in :BIIds and BillingDocumentId__c!=Null
and (UnitPrice__c=0 OR UnitPrice__c=null) and Sub_Segment__c='Undefined' and Gross__c=0 and NettoAmount2__c =0 ];
delete BI;
}
}
ProcessBuilder:
If criteria meets calling the apex class.
Please suggest any other workaround
When the Billing Item with Unit price=0 and Subsegment=Undefined I need to delete the data.
I have written the below code and Process Builder to handle the same but its not working as expected.
public class DeleteBillingItems
{
@InvocableMethod
public static void BIDelete(List<Id> BIIds)
{
List<BillingItem__c> BI =[select id,BillingDocumentId__c,UnitPrice__c,Sub_Segment__c,Gross__c,NettoAmount2__c from BillingItem__c
where BillingItem__c.id in :BIIds and BillingDocumentId__c!=Null
and (UnitPrice__c=0 OR UnitPrice__c=null) and Sub_Segment__c='Undefined' and Gross__c=0 and NettoAmount2__c =0 ];
delete BI;
}
}
ProcessBuilder:
If criteria meets calling the apex class.
Please suggest any other workaround
Yes it is returning blank .what should be the workaround can u suggest.