New answers tagged

2

Is there a better way to implement polling in my case, instead of using count variable, since it has no purpose in my usecase? You don't need the counter. You don't even need an action. Your poller could look like: <apex:actionPoller reRender="counter" interval="5"/> Also, the code that I have would it cause governor limit issue? No, each ...


5

Polling every 5 seconds is bad imo and waste of resources. Polling generally slows things down as well. From what I can see if all you want is a notification for newly created, deleted case. Once you get the notification you can do a query and get the latest data. And, the best candidate here is Streaming API, Just Implement the VF client for streaming ...


1

A pattern that can work better is to create a wrapper class that handles the parent/child relationships: public class Node { public SObject sob {get; private set;} public Node parent {get; private set;} public Node[] children {get; private set;} public Node(SObject sob) { this.sob = sob; this.children = new Node[] {}; }...


3

jQuery uses normal CSS selectors-like syntax. It doesn't know that "i" is a variable that should be used, nor can it directly know this. Instead, you can use a template string: $(`.dummytableid th:eq(${i})`).css(... Note that we use backtick instead of apostrophe or quotation marks, and the ${variable} notation. This should result in each table being ...


1

There's two key things missing that contribute to this error. The first is that your <apex:page> tag is missing the recordSetVar attribute that marks it as using a StandardSetController. The second is the attempt to bind to a property Contact.PageSize. The Apex standard controller (non-set version) doesn't offer a property PageSize that you can bind ...


0

Alright, I figured it out. I had multiple problems here. The main one being that the DOM wasnt yet fully loaded when the function called. Which still kind of confuses me because window.onload should trigger when the document is ready, no? Cheers


0

The issue seems to be with this line List<Quotedesk__c> lstQuote = [Select id, Additional_information__c from Quotedesk__c where id =: ApexPages.CurrentPage().getparameters().get('id') limit 0]; You have to pass the Id parameter to the visualforce page when viewing this page or you have to ...


0

You should build your own custom list controller, to bring the records that you want and create your own "list view" perhaps using an apex:pageBlockTable List controller: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_custom_list_controller.htm Page Block Table: https://developer.salesforce.com/docs/atlas.en-us.220.0.pages.meta/...


1

OK, so we didn't find a direct way to do it. However, we believe that the following approach should work for normal and community usage. In essence we implemented a component with navigation mixin then used something like: this[NavigationMixin.GenerateUrl]({ type: 'standard__navItemPage', attributes: { apiName: "customTabName", ...


-1

VF page : <apex:page controller="Applications" lightningStylesheets="true"> <apex:sectionHeader title="Application For Employment"/> <apex:form > <apex:pageBlock > <apex:pageBlockSection columns="1" showHeader="true" title="Application For Employment"> <apex:inputField value="{!createapplication.Full_Name__c}"/> ...


1

You cannot modify your direct Contact query Select Id, Name FROM Contacts WHERE '+ where_cond+ ' to select a specific number of Contacts per Account. Instead, limit your outer query with filters on the Account: SELECT Id, (Select Id,Name FROM Contacts WHERE '+ where_cond+ ' LIMIT : numberOfContacts) FROM Account WHERE <some condition> to ...


1

Figured it out, the list of field api names must be a list, it cannot be a set, so I changed public Set<String> fieldsToPopulate {get; set;} to public List<String> fieldsToPopulate {get; set;} And it resolved the issue.


1

I believe you are getting an exception that you are masking due to absence of apex:pageMessages. <apex:selectList value="{!exerciseNames}" size="1"> <apex:selectOptions id="SelectedOption" value="{!Options}"></apex:selectOptions> </apex:selectList> <apex:SelectList value=".."> needs to be bound to a singleton ...


1

Like all of Salesforce customization, Visualforce pages are metadata that you can retrieve via API. You could build something that connects to the org, takes a snapshot, and then commits to Git. This is a fairly complicated process, so there are many vendors that have jumped in to offer this service. A google search of Salesforce Metadata Backup returns many ...


1

For this use case Salesforce made available the Lightning Experience Stylesheets. If you change the <apex:page> tag to: <apex:page standardController="Contact" lightningStylesheets="true"> it should work. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/vf_dev_best_practices_slds_lightningstylesheets.htm


0

You could use github or gitlab for backup. For more info refer: Git and GitHub Basics Also, refer this video: Getting Started with Git on Salesforce


1

SSO means Single Sign on ...means require platform where someone needs to sign in (login)... but your current platform is public Salesforce site which do not require login...standard SSO will not work along with guest user...If you want something like parametrized redirection/authentication... you need to build custom solutions: Use VF page as home page of ...


0

Have you taken a look at the Streaming API? It let's you stream events and therefore react to the data updates.


3

Apex is a case-insensitive language. The identifiers pgm and PGM are the same as far as the compiler is concerned. In addition, there is a key logical error in the code populating this variable. Let's look at what's happening here: PublicGroupsMembers pgm = new PublicGroupsMembers(); This local variable shadows the instance variable PGM. You now cannot ...


2

The PDF renderer supports (some) CSS. You can modify the page size just by adding a CSS style inline in your page, as you would in ordinary HTML destined for page-based layout: <head> <style type="text/css"> @page { size: a4; } </style> </head> This generates an A4-sized PDF.


0

Why you need to use Visualforce Page to show Opportunities related to a product. You already have a related list called Opportunities on Product record Page layout which shows you the Opportunity related to current product record.


0

In your saveData() method, after inserting the account just create a PageReference instance and return it. insert acc; Pagereference pageRef = new PageReference('/' + acc.Id); return pageRef; And change the return type from void to PageReference.


0

Once you have created a visualforce page having a standard controller(In your case, it would be equal to Contact), You will start viewing Visualforce option in left-hand side on top of the page layout editor. Page layout editor does not show visualforce option until you don't have to add anything on the page. Or if you are in Lightning and want to use ...


0

You can use Javascript remoting directly call apex method to get loggedin user details directly from Javascript. Controller public with sharing class MyController { @RemoteAction public static User getLoginUserDetails() { return [SELECT Id, Name FROM User WHERE Id = :UserInfo.getUserId()]; } } Visualforce <apex:page controller="...


0

I haven't tested it but this should work. You didn't share your controller code but you can change the getAccsList method like this: public List<SelectOption> getaccsList() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('Account 1','0011t000008jprOAAT')); options.add(new SelectOption('...


2

Documentation <apex:outputlink rendered="{!result != null}" value="/{!acct.id}" target="_blank" >{!acct.Salesforce_Account_ID__c}</apex:outputLink>


1

When unit testing standardsetcontrollers, one doesn't normally construct the URL parameters because the VF controller has access to what is provided in URL params using methods. Apex doc getSelected() and setSelected(SObject[] sobjects) getFilterId() getListViewOptions() // returns available filters for use in setFilterId() The unit test method should mock ...


0

The <apex:actionFunction> command creates a JavaScript function you can call which invokes a controller action. Placing <apex:param> elements there has no effect on the action invoked via your page's action= attribute. As an aside, use of the action attribute is discouraged because it exposes your application to CRSF attacks. The only way I'm ...


0

For anybody looking for this. I fugured out that de filter ids are the same across sanbox and production.


0

You can change your Controller to this: public class OpportunityController { public static List<Opportunity> action() { List<Opportunity> opp = [SELECT Id, Name, CreatedDate, StageName, Description, CloseDate, NextStep, Account.Name, Account.BillingPostalCode, Account.BillingStreet, Account.BillingCity FROM ...


0

PageReference pageref = OpportunitiesControllerObj(); This line of code causes the error, you are trying to set as method the actual object instance.


2

You're free to include multiple <apex:pageMessages /> components, positioned wherever on the page you want. <apex:form> <apex:pageBlock> <apex:pageMessages /> <apex:pageMessages /> <apex:commandButton action="{! addErrors }" title="Test" value="Test"/> </apex:pageBlock> </apex:form> ...


3

The only thing you need to do is retrieving body of the post request, this can be done like in the example below: @HttpPost global static void processPost() { Map<String, Object> requestBody = (Map<String, Object>) JSON.deserializeUntyped(RestContext.request.requestBody.toString()); //do something with the resulting map - this is the ...


0

The typical way of coding this would be using an output field and rendered attributes: <div class="slds-truncate" title=""> <apex:inputField style="width:90px;" value="{!schedule.Start_Date__c}" rendered="{!schedule.Products_Offer__c != 'Product_B'}"/> <apex:outputField style="width:90px;" value="{!schedule.Start_Date__c}" rendered="{!...


2

You can use the filter attribute to add additional filters. A minimal change looks like this: <apex:page standardController="Custom_Object__c" > <analytics:reportChart reportId="00Oi0000005fPDb" filter="[{ column:'Color__c',operator:'equals',value:'{!Custom_Object__c.Color__c}'}]"> </analytics:reportChart> </apex:page> Have a ...


2

Good question. From the documentation https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm: A Boolean value that specifies whether the Salesforce tab header is included in the page. If true, the tab header is displayed. If not specified, this value defaults to true. Note: In Lightning Experience and the Salesforce ...


0

Outputlink is nothing but anchor tag of html at the end, and the value attribute of apex:outputlink is nothing but href of an anchor tag in plain HTML. By default, Outputlink reloads the page on single click and that is the issue here. Using value="javascript:void(0)" should solve your problem. Why use it: To prevent the page reloading upon a single ...


0

Visualforce remoting, remoteFunction, are used to call Apex on the Platform. If you wanna call any third party site from javascript then do a normal AJAX call. Also, as it will be a cross-origin request from javascript so make sure the end-server supports CORS from SF domain.


2

You can use: <apex:outputPanel layout="none"> ... </apex:outputPanel> to make multiple tags appear like one tag and apex:pageBlockSectionItem allows a field and label to be put together manually. So try something like this: <apex:pageBlock title="title"> <apex:pageBlockSection> ... <apex:...


1

Because, by definition, if the HTML disabled attribute exists at all, the field is disabled. It's not a boolean. I suppose you could put two consecutive instances of <apex:inputField>, one disabled with rendered="{! !allowChoice}" and the other enabled with rendered="{!allowChoice}". That way VF will only ever render one of them at a time. Or make the ...


2

The reason you are getting nothing for relatedToType="Contact" is because Contacts, Leads, and Users can't be used in relatedTo (equivalent to the WhatId) See Apex Developer Guide outbound Apex email method setWhatId The value must be one of the following types: Account Asset Campaign Case Contract Opportunity Order Product Solution Custom ...


3

Visualforce indeed does not have built-in support for this but you can use javascript to fetch the timezone from the browser. Some suggested approaches are mentioned here: https://stackoverflow.com/questions/6939685/get-client-time-zone-from-browser E.g. the following is a very simple approach: In javascript (new Date()).getTimezoneOffset()/60 will return ...


0

Try using firstname or lastname instead of name. Also you can depend on recipient data as well instead of relatedTo.


2

This pretty obviously calls for a CSS approach but stackoverflow was only partially helpful as stackoverflow radiobutton examples didn't mimic the way Visualforce renders an apex:selectRadio component. Using Chrome Developer Tools (or Firebug), one inspects the generated HTML and then one can manipulate using CSS styling. The generated HTML looks like ...


0

I found a fix, you gotta use a outputLink instead of a commandLink For the commandLink: <apex:commandLink value="{!Order.Name}" onclick="window.top.location='/{!Order.id}';"/> I used this outputLink: <apex:outputLink onclick="window.top.location=('/{!o.id}');" value="/{!o.Id}">{!o.Name}</apex:outputLink> The reason I have onclick is ...


0

i used force:inputField for look up inside lightning:recordEditForm but i just tested in standaloneapp only, please try below code and let me know cmp <aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes"> <aura:attribute name="newContact" ...


1

This Map constructor pattern: Map<String,Account> accCont = new Map<String,Account>([ SELECT Id,Name,duplicate__c FROM Account where Id In (Select AccountId from Contact) ]); always takes the Id value from the query and uses it as the key. So while you can use Map<String,Account>, better to make it Map<Id,Account>. ...


0

Phew my user just gave me the correct user for me to debug Today. My bad. I just realized that this VF want to get the task ID without using standardController, so I added standardController="Task" and capture the task ID : var url = window.location.href; var captured = /id=([^&]+)/.exec(url)[1]; var cek =...


2

You need to query for the Opportunity Contact Roles in your controller extension. So here's how the controller extension might look: OpportunityContactRoleExtension public class OpportunityContactRoleExtension { public List<OpportunityContactRole> contactRoles {get; set;} private final Parent_Opportunity__c parentOpp; // put any fields ...


1

You can try putting target="_blank" property in apex:commandLink. <apex:commandLink value="{!Order.Name}" target="_blank" onclick="window.top.location='/{!Order.id}';"/> You can also try using URLFOR to protect from implementation detail. <apex:commandLink action="{!URLFOR($Action.Order.View, o.Id)}" value="{!o.Name}" target="_blank" />...


Top 50 recent answers are included