function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ArnoldFBArnoldFB 

Timed Trigger to create Account Team member records based on Sales Territory.....possible?

I'm an admin, not a developer in my org.  Before seeking out a develper, I'm interested to know if it's possible to write a trigger which will run on a daily basis, iterate through our list of accounts and create account team member records based on a list of territory rules defining who should be assigned to these accounts based on Billing state.  I'm hearing from somone on my team that you can't create account team members with Apex.  I understand the Account team member object is a fickle beast in Saleforce as it's not really a standard object, but would like to know if what I'm proposing truly is impossible.  I really don't want to give up on this as in our org Account Team membership is a big deal & I spend all kinds of time on it that I could buy back with a well written trigger.   I've found a thread here referencing people doing something like this in Apex.   All input welcome. 

Thanks a million!
Subhash GarhwalSubhash Garhwal
Hi ArnoldFB,
Yes it is possible to create Account Team Member using apex code.
one more thing Apex triggers are not fire(run) on daily basis they are run on event that you define in trigger Like : before insert, after insert etc.
Ex. Trigger on account
trigger Trigger_Account on Account (after insert) {}
this trigger is fire when you insert a new account record.

If you want to check data on daily basis and create new Account Team Member records than you need to go with Apex Batch and schedule it.

Thanks