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
Celia Astheimer 10Celia Astheimer 10 

Concatenate field from Opp Line Items to Opp

Hello! I think this is probably an easy one for the coders out there; I'm a beginner so looking to the experts for a little help and advice :)

I have a text field Product_Groups__c on the opportunity that is meant to hold a deduplicated, concatenated list of Product_Group__c (picklist) from all of the Line Items on an Opp. So if an opp has 3 line items each with something different in Product_Group__c:

Item 1 | Shirts
Item 2 | Pants
Item 3 | Shoes

The field would populate with "Shirts;Pants;Shoes"  Likewise, if Item 1 and 2 were both Shirts and Item 3 is Shoes, the field would read "Shirts;Shoes" 

We'll be populating this on opps going forward through our integration with our quoting tool... so I just need to be able to populate this on all existing opp records. I only have to do this once, I thought maybe it could be done using anonymous apex? However I'm not sure what the code would be... and I'm also curious about the following:

1. using execute anonymous, would this still register an edit on the record (ie. would last modified change to my name and the date I run this?)
2. can this be done to bypass/ignore triggers and workflows?

I do have a (very large) spreadsheet of our opp ids with a deduplicated list of the Product Groups... but weeding through that to concatenate started to feel a bit more cumbersome than having the system do it for me. Any thoughts/ideas would be a great help!

Thanks
Terence_ChiuTerence_Chiu
Celia, the below link might help you concatenate your rows via Excel so that you can run a mass update via a tool like  Data Loader. Any updates to records will result in the last modified by and last modified date to reflect the user account that updated the record. You can deactivate workflows and validation rules before running the update but be sure to make a list so that you can re-activate any rules you de-activated. Triggers, however, cannot be deactivated from production.

http://www.exceltactics.com/combine-data-multiple-rows-one-cell/#Examine-the-Data-and-the-Objective
Celia Astheimer 10Celia Astheimer 10
Thanks, Terence! I was hoping to not have to do this in Excel, but actually that resource is the first one I've seen that might help get this done if I can't do it programmatically. Thanks for the link!
duisoa udisoduisoa udiso
I want to use the script for my shoe blog, Is there any plugin available to use on the WordPress website (https://finishlinefever.com/2016/04/hoka-one-one-clayton-review.html).
gsadg asrgsadg asr
Please attempt to test the project from some other browser - I failed to control to bypass inside Google Chrome however it labored straight away once I logged into trailhead from Microsoft Edge link (https://bestshoesfornurses.net/best-shoes-for-male-nurses/)!