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
Jerry_jJerry_j 

How to create field using SOQL, criteria, etc?

I need a field on the Account layout that will aggregate specific types of Service Contracts. In other words if an account has 20 contracts, 16 of which are active, and of those 16 active contracts, there are 6 of them of a particular type, I'd like the field to say 6.

In pseudo soql code, something like like " select count(quantity) from service_Contracts where item_category='Licenses' and today() between start_date and end_date and account_id = &account_id"  where &account_id is the account_id of the account being viewed.

Is there an easy way to do this?

thanks