You need to sign in to do that
Don't have an account?
Alex P
Test class for Quote Line Item VF component
Trying to test my first component for pulling quote line items into a VF email template. Any help greatly appreciated!
VF Component:
VF Component:
<apex:component access="global" controller="SortedLineItemsController"> <apex:attribute name="value" type="Quote" assignTo="{!quote}" description="TODO: Describe me"/> <apex:repeat var="li" value="{!sorted}"> <tr> <td>{!li.Part_Name__c}</td> <td>{!li.Technology_Pick__c}</td> <td>{!li.Rev__c}</td> <td>{!li.Material__c}</td> <td>{!li.Description_Summary__c}</td> <td>${!li.UnitPrice}</td> <td>{!li.Quantity}</td> <td>${!li.TotalPrice}</td> </tr> </apex:repeat> <!-- Needed to work around limitation that the standard controller cannot "see" the linkage between the value attribute and the opportunity property --> <apex:variable var="oli" value="{!value.QuoteLineItems}" rendered="false"> {!oli.Part_Name__c} {!oli.Technology_Pick__c} {!oli.Rev__c} {!oli.Material__c} {!oli.Description_Summary__c} {!oli.UnitPrice} {!oli.Quantity} {!oli.TotalPrice} </apex:variable> </apex:componentApex Controller:
public class SortedLineItemsController { public Quote quote { get; set; } public QuoteLineItem[] getSorted() { if (quote == null || quote.quoteLineItems== null) { return null; } QuoteLineItem[] result = new QuoteLineItem[1]; for (QuoteLineItem item : Quote.quoteLineItems) { result.add(0, item); } return result; } }
It looks like our team of experts can help you resolve this ticket. We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!
https://jbshelpdesk.secure.force.com
Thanks,
Jarvis SFDC team
Follow the suggestions as mentioned in the below blogs,
https://developer.salesforce.com/forums/?id=906F000000092J5IAI
https://developer.salesforce.com/forums/?id=906F000000093D3IAI
https://developer.salesforce.com/forums/?id=9060G000000XZuUQAW
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.