You need to sign in to do that
Don't have an account?
subodh chaturvedi 17
how to write a trigger to check & Uncheck the parent Record based on the Child Record Values.
subodh chaturvedi 17
how to update a parent field (checkbox) Based on child records field Values.
i have checkbox field Visa__c In Account & i have a custom Object (Card program ) where i have two fields Cardtype __c & card_processor_status__c, so the requiremnt is when the cardtype__c=Visa & Card_processor_Status__c =Active then the Checkbox should get check in Visa__c in account & when the two fields value is other than visa & active the checkbox should get unchecked.
let suppose we have 10 records in Cardprogram out of 10 if atleast 1 record have fullfill the criteria then also the checkbox should get checked .
Here is the criteria for when the “Visa” field should be TRUE:
There is a Card Program record related to the Account that has at least one single record that meets both the criteria below:
The “Card Type” field is “Visa”
The “Card Processor Status” field is “Active”
how to update a parent field (checkbox) Based on child records field Values.
i have checkbox field Visa__c In Account & i have a custom Object (Card program ) where i have two fields Cardtype __c & card_processor_status__c, so the requiremnt is when the cardtype__c=Visa & Card_processor_Status__c =Active then the Checkbox should get check in Visa__c in account & when the two fields value is other than visa & active the checkbox should get unchecked.
let suppose we have 10 records in Cardprogram out of 10 if atleast 1 record have fullfill the criteria then also the checkbox should get checked .
Here is the criteria for when the “Visa” field should be TRUE:
There is a Card Program record related to the Account that has at least one single record that meets both the criteria below:
The “Card Type” field is “Visa”
The “Card Processor Status” field is “Active”
Actually i was not checking that condition previously in my code. If you see there i declared map but didn't use .
now as per your requirement I fixed the code and attested below please have a look :)
It is now working as expected :)
Please let us know if this will help you. and mark it as best answer
Thanks,
Parag Bhatt
All Answers
You can create a process builder to achieve this.
1) Create the process builder on custom Object (Card program ).
2) Check the criteria The “Card Type” field is “Visa” and the “Card Processor Status” field is “Active".
3) Then update the Account(Parent) field Visa__c to TRUE.
Thanks,
Sarav
Sweet Potato Tec
I have done Exactly the same thing but the problem is it is Working only for 1 record.
Suppose i have 2 records in card program whose both field values are meeting the criteria ,so for one record when i am changing the value other thanCard Type= visa & Card Processor Status” field =active then it is changing the Visa in account with unchecked , that should not happen because we have one record in card program whose value Is Active & visa so the checkbox should get remained checked.
If both record values are changed than only the Visa checkbox get unchecked.
I will definately help you out finding solution to above problem.
I wrote a Trigger on "card Program" which will run on "after Insert and after Update" scenario. please find below :)
It is working as expected :)
Please let us know if this will help you.
Thanks,
Parag Bhatt
Your Code is working as per requirement but there is one small problem that is when i changed the value of both record then in Account the Visa__c checkbox is not geting Unchecked.
Actually i was not checking that condition previously in my code. If you see there i declared map but didn't use .
now as per your requirement I fixed the code and attested below please have a look :)
It is now working as expected :)
Please let us know if this will help you. and mark it as best answer
Thanks,
Parag Bhatt