+ Start a Discussion
TestingSFUserTestingSFUser 

Update the parent field based on child's records

Hi all, 

i have 3 obj's..i.e. Account, Invoice__c & Payment__c (Account is parent to Invoice__c & Invoice__c is parent to Payment__c)
Invoice_Amount__c, Invoice_Status__c & Invoice_Date__c fields are in Invoice__c obj.
Total_Payment_Amount__c field is in Payment__c obj.
Account_Status__c field is in Account obj.

i am created Invoice records through based on monthly schedule based.
now my requirement is..i want to update Invoice_Status__c & Account_Status__c fields based on below conditions.
1. when ever Today - Invoice_Date__c = 30 days
2. Either i have related payments or not.
3. if i have related payments.. then we need to check Total_Payment_Amount__c is less than that of Invoice_Amount__c

then only i want to update Status of Invoice__c & Account.

thanks in advance
PriyaPriya (Salesforce Developers) 
The developer community recommends providing any attempts/code you've started, any errors you're getting, or where exactly you're struggling in achieving this while posting a question.