You need to sign in to do that
Don't have an account?
Bob Poliquin 9
Converting visualforce page to lightning web component
I do not know how to covert my VF pages to a lightning web component and need some help. Below is the code for my vf page and apex class. If anyone can show me how to covert this to LWC I would appreciated it.
Apex Class:
VF Page:
Apex Class:
// Used on the account page updated 1-31-2020 Public Class VF_SiteServicePartnerAllController{ private Account acc; public List<Site_Service_Partner__c> sspList {get;set;} public VF_SiteServicePartnerAllController(ApexPages.StandardController sp){ acc = (Account)sp.getRecord(); sspList = new List<Site_Service_Partner__c>(); sspList = [SELECT Id,Name,Site_Account__c,Primary_Field_Contact__c,Service_Partner__c, Service_Partner_Owner__c,Service_Partner_Owner_Mobile__c,Service_Partner_Owner_Email__c, Primary_Field_Email__c,Primary_Field_Mobile__c,Service_Partner_Site_Status__c, Contracted_Services__c,Secondary_Field_Contact__c,Secondary_Field_Email__c,Secondary_Field_Mobile__c, Service_Partner_Start_Date__c,Service_Partner_End_Date__c,Service_Partner_Main_Phone__c,Service_Line__c,Supported_Service_Lines__c FROM Site_Service_Partner__c WHERE Site_Account__c =: acc.Id AND Service_Line__c IN ('Land', 'Snow', 'Land;Snow','Janitorial','Land;Snow;Janitorial') AND Service_Partner_Site_Status__c = 'Active']; Set<Id> bidId = new Set<Id>(); for(Site_Service_Partner__c bs:sspList){ bidId.add(bs.Id); } } }
VF Page:
<apex:page standardController="Account" extensions="VF_SiteServicePartnerAllController" lightningStylesheets="true" > <style> .ht{ height:0px; vertical-align:middle; } </style> <apex:form > <apex:pageBlock > <apex:pageBlockTable cellpadding="1" width="100%" columns="2" value="{!sspList}" var="item"> <apex:column rendered="{!IF(item.Service_Partner_Site_Status__c = 'Active',true,false)}" > <apex:outputPanel rendered="{!CONTAINS(item.Service_Line__c, 'Land')}"> <apex:outputPanel rendered="{!IF(item.Service_Partner_Start_Date__c != null,true,false)}"> <apex:outputField value="{!item.Supported_Service_Lines__c}"/><br></br> <apex:outputLabel value=""><b>Service Partner Assigned to Site</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner__c}"/><br></br> <apex:outputLabel value=""><b>Service Partner Primary Contact</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Primary_Field_Contact__c}"/><br></br> <apex:outputLabel value=""><b>Primary Field Cell</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Primary_Field_Mobile__c}"/><br></br> <apex:outputLabel value=""><b>Primary Field Email</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Primary_Field_Email__c}"/><br></br> <apex:outputLabel value=""><b>Secondary Contact</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Secondary_Field_Contact__c}"/><br></br> <apex:outputLabel value=""><b>Secondary Cell</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Secondary_Field_Mobile__c}"/><br></br> <apex:outputLabel ><b>Secondary Email</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Secondary_Field_Email__c}"/><br></br> <apex:outputLabel ><b>Latest Work Order</b></apex:outputLabel><br></br> <apex:outputField value="{!Account.Latest_Work_Order__c}"/><br></br> <apex:outputLabel ><b>Latest Work Order Submitted</b></apex:outputLabel><br></br> <apex:outputField value="{!Account.Latest_Work_Order_Submitted__c}"/> </apex:outputPanel> </apex:outputPanel> </apex:column> <apex:column styleClass="ht" rendered="{!IF(item.Service_Partner_Site_Status__c = 'Active',true,false && CONTAINS(item.Service_Line__c, 'Land') )}" > <apex:outputPanel rendered="{!CONTAINS(item.Service_Line__c, 'Land')}"> <apex:outputPanel rendered="{!IF(item.Service_Partner_Start_Date__c != null,true,false)}"> <apex:outputLabel ><b>Service Partner Owner</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner_Owner__c}"/><br></br> <apex:outputLabel value=""><b>Service Partner Owner Cell</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner_Owner_Mobile__c}"/><br></br> <apex:outputLabel value=""><b>Service Partner Main Phone</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner_Main_Phone__c}"/><br></br> <apex:outputLabel value=""><b>Service Partner Owner Email</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner_Owner_Email__c}"/><br></br> <apex:outputLabel value=""><b>Service Provider Start Date</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner_Start_Date__c}"/><br></br> <apex:outputLabel value=""><b>Service Provider End Date</b></apex:outputLabel><br></br> <apex:outputField value="{!item.Service_Partner_End_Date__c}"/> </apex:outputPanel> </apex:outputPanel> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
I recommend reviewing the following resources that will help you in converting VF pages into LWC
https://developer.salesforce.com/event/convert-visual-force-to-lwc
http://www.apexhours.com/converting-visualforce-page-to-lightning-web-components/
For reference please check this too (https://developer.salesforce.com/docs/component-library/documentation/en/lwc/migrate_introduction)
Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you