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
V1nitV1nit 

Alternative to Roll-up summary field

Hi,

 

On my accounts object, I have a picklist field called Type with two values(Type1, Type2).

i have accounts with Type1 and accounts with Type2.

There is a lookup field called parent account.

Now, from the lookuop field I can select a Type2 account.

So, each Type1 account will have a Type 2 account associated to it.

I will need to count the number of accounts with Type1 under each Type2 account.

 

Any idea how I can do this ?

Note that we are dealing with just one object Account. So, I cannot use roll-up summary fields

 

thanks,

Vineeth.

 

Alok_NagarroAlok_Nagarro

Hi,

 

Trigger is the only solution to do that, you need to create trigger on Type1 object.

V1nitV1nit

Any ideas on how to implement the trigger ?

I have no idea how to write a trigger.

Alok_NagarroAlok_Nagarro

Hi,

 

The basic syntax to write a trigger is as follows :

 

trigger Mytrigger on Account (before insert,before update)

{

 // body of trigger

// here you can write any apex script

}

 

Plz go through the following PDF to know mare about triggers -

http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf

Borek Straka 1Borek Straka 1
Have a look at https://github.com/afawcett/declarative-lookup-rollup-summaries