You need to sign in to do that
Don't have an account?
![Thomas Graves 1 Thomas Graves 1](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
Iterate over Product2 in QuoteLineItem from a Quote Field
Hi Everyone,
I have a custom Quote Field, lets call it 'Count'. I want the value of Count to come from looking at all the names of the products in the Quote Line Items and generating a value. I've figured a few things out on my own but my resources are running dry. Below is everything I've figured out
QuoteLineItem - the name of the object containing each product
Product2 - the product name that is displayed in QuoteLineItem
Count - this should be a custom formula field. the formula should look something like what I have below ->
count = 0;
For (all QuoteLineItem:x in Quote object){
If (x.Product2 = 'ABC')
count = count + 5;
If (x.Product2 = 'DEF')
count = count + 10;
If (x.Product2 = 'GHI')
count = count + 5;
}
Am I thinking about this right? Can someone help me pull this thing together.
Thanks!
T
I have a custom Quote Field, lets call it 'Count'. I want the value of Count to come from looking at all the names of the products in the Quote Line Items and generating a value. I've figured a few things out on my own but my resources are running dry. Below is everything I've figured out
QuoteLineItem - the name of the object containing each product
Product2 - the product name that is displayed in QuoteLineItem
Count - this should be a custom formula field. the formula should look something like what I have below ->
count = 0;
For (all QuoteLineItem:x in Quote object){
If (x.Product2 = 'ABC')
count = count + 5;
If (x.Product2 = 'DEF')
count = count + 10;
If (x.Product2 = 'GHI')
count = count + 5;
}
Am I thinking about this right? Can someone help me pull this thing together.
Thanks!
T
I figured this out. Here is what I had to do.
I made a formula QLI field (x1) to determine the individual count associated with each QLI.
Then I made a number QLI field (x2) that was populated with the value of x1 by a workflow field update rule.
Then I made a Roll Up Summary Quote field (y1) to calculate the total sum of x2 across all QLIs.
You have to use this method because you aren't allowed to have a Roll Up Summary field that is based on a formula field
Hopefully this helps someone out there.
--Thomas
All Answers
1. Create count formula field on the QuoteLineItem with above logic and get the count based on Product per QuoteLineItem .
2 Create a Rollup summary field on the Quote with Sum(Count at QuoteLineItem level)
Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.
Thanks for the response. The Rollup summary will not meet my needs. I need to increment the value of count based on the title of the product.
So if the Product was called "ABC", count will increment by 5 - if Product was called "DEF", count will increment by 10 - etc.
I also have a knowledge gap related to writing a formula that iterates through all QuoteLineItems and grabs the Product2 field (Product2 is the name, correct?).
Thanks,
T
I figured this out. Here is what I had to do.
I made a formula QLI field (x1) to determine the individual count associated with each QLI.
Then I made a number QLI field (x2) that was populated with the value of x1 by a workflow field update rule.
Then I made a Roll Up Summary Quote field (y1) to calculate the total sum of x2 across all QLIs.
You have to use this method because you aren't allowed to have a Roll Up Summary field that is based on a formula field
Hopefully this helps someone out there.
--Thomas