I have about 20 text and picklist fields from a web-to-lead form that I am looking to concatenate into one long text field on the lead record on insert. So for instance, I would want the field to look something like this: Product Name: dksjfkldsfjsldk; Product Type: jsdfkdjfkds; Product Size: fjdfjsdk;
However, I'd ideally like to only display the text if the field is filled in on the web form. So for instance, if product type were left blank, then product type would not appear in this concatenated field.
My apex skills are rudimentary though I think this should be a rather simple trigger. Is it enough to do a series of If statements, something along the lines of below?
trigger UpdateMiscLeadInfo on Lead (before insert) { List Leads = new List{}; miscstring; for (Lead l: Trigger.new) { If (l.Other_Manufacturer__c != Null) { miscstring += 'Other Manufacturer: ' + l.Other_Manufacturer__c + '; '}; If (l.product_name__c != Null) { miscstring += 'Product Name: ' + l.Product_Name__c + '; '}; .....
Any advice is much appreciated--thank you!