You need to sign in to do that
Don't have an account?
Rick Rossi
Trigger account question
Hello,
I am trying to come up with a trigger but no luck. The logic is on the account object which parent accounts cannot have parent accounts and child accounts cannot have child accounts.
Any help would be great!
Thank you
I am trying to come up with a trigger but no luck. The logic is on the account object which parent accounts cannot have parent accounts and child accounts cannot have child accounts.
Any help would be great!
Thank you
Hi Rick,
This is very confusing. Can you please simplify your description?
Regards,
Priya Ranjan
Thanks for getting back to me. So basically if an account is a parent account, they cannot be a child in any account hierachy. A child account also cannot be a parent account if it is a child in any account already.
Hope this makes sense :) Any help would be great.
Yes, you can create this type of trigger
you can understand from this trigger :
trigger triggerOnContact on Contact (after insert, after update) {
Map<Id,String> map1 = new Map<Id, String>();
for(Contact con:trigger.new) {
map1.put(con.AccountId, con.update_Check__c);
}
List<Account> listUpdatedAccount = new List<Account>();
for(Account acc:[Select id, update_Check__c From Account Where Id IN :map1.Keyset()]) {
if(map1.containsKey(acc.id)) {
listUpdateAccount.add(new Account(Id = acc.id, update_Check__c=map1.get(acc.id)));
}
}
update listUpdateAccount;
}
You can get help from this :
https://developer.salesforce.com/forums/?id=9060G000000I5MBQA0
https://developer.salesforce.com/forums/?id=906F0000000B2z2IAC
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi