Dynamic value Apex

Currently have this line of code. <li><a href=”{!URLFOR($Action.Attachment.Download, ’00Pr0000ID00000′)}” target=”_blank” name=”Application” id =”{!ApplicationObj.id}”>Download</a></li> Is there a way to pass this Application.Obj.id to the controller? So that logic can be done so the 00Pr0000ID00000 attachment Id is not static? Answer You can just add the object inside the formula like you did in the id attribute. … Read more

JS Query variable binding

Trying to transfer an apex query to Javascript. Wondering if binding works in the same manner? Also is using result.length valid for the if statement? var accLike = ‘%’ + ‘Construction’ + ‘%’; var accId = ‘0E40040503F023FE’; result = sforce.connection.query(‘SELECT Id, Name FROM Account WHERE (Id =: accId) OR (Name LIKE :accLike)’); if(result.length > 0){ … Read more

Invalid field PageSize for SObject Contact

I am trying to add pagination to the list and refering this link: https://trailhead.salesforce.com/en/content/learn/modules/visualforce_fundamentals/visualforce_standard_list_controllers <apex:page standardController=”Contact”> <apex:form> Records per page: <apex:selectList value=”{! URLENCODE(Contact.PageSize) }” size=”1″> <apex:selectOption itemValue=”5″ itemLabel=”5″/> <apex:selectOption itemValue=”20″ itemLabel=”20″/> <apex:actionSupport event=”onchange” reRender=”contacts_list”/> </apex:selectList> </apex:form> </apex:page> I am getting “Invalid field PageSize for SObject Contact” error Answer There’s two key things missing that contribute … Read more

Getting different field label while accessing it in apex component

here the sObjectType is of Account type Map<String, Schema.SObjectField> fieldMap = sObjectType.getDescribe().fields.getMap(); for (String fName: fieldMap.keySet()) System.debug(‘Field Name ‘+ fName + ‘ Label ‘ +fieldMap.get(fName).getDescribe().getLabel() ); in Salesforce account object field name for phone is Phone and lable is also Phone but when I try to access it using above method it shows field name … Read more

Getting different field label while accessing it in apex component

here the sObjectType is of Account type Map<String, Schema.SObjectField> fieldMap = sObjectType.getDescribe().fields.getMap(); for (String fName: fieldMap.keySet()) System.debug(‘Field Name ‘+ fName + ‘ Label ‘ +fieldMap.get(fName).getDescribe().getLabel() ); in Salesforce account object field name for phone is Phone and lable is also Phone but when I try to access it using above method it shows field name … Read more

Visualforce Page : kindly read the info at the end of the code regarding pagination and Javascript function

Visualforce Page: <apex:page sidebar=”false” Controller=”Invoice_details” showHeader=”False” docType=”html-5.0″ readOnly=”true” > <html xmlns=”https://www.w3.org/2000/svg” xmlns:xlink=”https://www.w3.org/1999/xlink”> <head> <body> <apex:slds /> <style> .displayBlock { display:block; } .placeHolder { margin-left : 50 px; margin-top : 50 px; Width : 50rem; } .Showall { font-style: bold; margin-top : 120px; width : 100%; } .space { font-style: italic; font-size : 25px; margin-left : … Read more

Email address as a parameter in vf page

PageReference retURL = new PageReference(‘/OrderHistoryguest?orderNumber=’+sapOrderNumber +’&email=’+userEmailAddress); when i have passing email by apex class to vf page as a url parameter its value change like @ change to some other code So please help me for this Thanks Answer That’s expected. Some characters are reserved in URL schema, and therefore will be converted to other … Read more

How can I pass a GET query param into my server side APEX controller?

Background: I am trying to redirect a user from an external site to my salesforce visualforce page with a GET query param as part of the URL. (This is part of a managed package) I want that parameter to be passed to my apex code so that I can do stuff with it on the … Read more

VisualForce Page – Apex:Repeat & Map not showing any values

I have problem showing my map value to the visualforce page, in my controller I populate the maps and create below method public Map<String, Decimal> getmapTargetCurrentMonth(){ return mapTargetCurrentMonth; } that will be invoked in VF page in apex:repeat class. public with sharing class SignedRevenueTargetController{ //Set up all getter and setter method public transient List<User> liactiveusers … Read more