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
SeannoSeanno 

Count Products

Newbie here, and was wondering if there was a way to create an area on the Account Page that would list all of the products entered in Opportunities that were closed, with quantities or prices?

 

It's kind of hard to go to an account and know what they've ordered in the past, without looking in each opportunity. 

 

Any thoughts?

SargeSarge

Hi,

You can make use of Asset object to record the products purchased in past. (only from clsoed opportunities).

Code a trigger to do this. Usually a after update will suffice which will check if opportunity s closed or not. And based on that it inserts Asset record under account, which becomes a means to store all products purchased in past.

chezibchezib

Hi!

 

We implemented the same exact issue recently for one of our clients.

 

The idea is to create a trigger for the Opportunity that triggers when "Close Won" and copy's all products to a new Custom Object  ("account Product") which you should create with an Look-up to the account. Each product will create an instance of an Account Product. in the Account Product you can handle fields of  quantities and total prices.

 

In general the main functions are: 

        if (checkIfClosedWon())
	{
		getAllOpportunityProducts(OpportunityIds);
		getAllAccountProducts(AccountIds);
				
		updateAccountProducts();
		
		upsertAccountProductsToDB();
	}

 For more details, feel free to contact us!

 

Have a nice day!