New answers tagged

0

You can set the apex:Page attribute of cache = True. The browser will cache your page. https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm


0

You can do this via visualforce, whilst it is finicky, you can create a visualforce action and utilize renderas to render a PDF. This does take time, but you don't need to pay for a package,


0

i figured it out. removed the html-5 doctype and used actionregion and this resolved the issue. Looks like it was html5 that was causing an added layer of validation i even when actionregion was being used. Quick fix...don't use html5 for now.


3

window.postMessage takes a second argument for the targetOrigin. From MDN targetOrigin Specifies what the origin of targetWindow must be for the event to be dispatched, either as the literal string "*" (indicating no preference) or as a URI. If at the time the event is scheduled to be dispatched the scheme, hostname, or port of targetWindow's ...


1

You cannot place expressions inside expressions. You would want to remove the extra bits. Fees: <apex:outputtext value="{!If(abInsurance !=null,'Rs. ' & abInsurance.charges__c, If(xyInsurance!=null,'Rs. ' & xyInsurance.charges__c,'None')) }"/>


0

Since you want to display all contacts for all accounts in hierarchy you can change your code to find the Account at the top and go downwards from there. This way you can find Accounts in other branches of Account Hierarchy. Also be careful this code will run a lot of SOQL based on the depth of hierarchy. public with sharing class AccountHierarchyController {...


0

This seems to work when attempted independnetly, using execute anonymous via the sfdx CLI for example: >> Start typing Apex code. Press the Enter key after each line, >> then press CTRL+D when finished. > String enteredText1 = 'a610V0000015C5DQAU'; Id myId = Id.valueOf(enteredText1); > System.debug(myId); Compiled successfully. Executed ...


0

In addition to @AndrewFawcett and @Frederik, I added some useful examples too for you and or future devs Example Suppose that you have a VF Page and also a Custom Controller, and you want to sort your own 'viewModel' objects List The Apex Controller Class public with sharing class YourObjGridListController { public static String sortBy {get; set;} ...


0

Two things are missing in this code. Application needs to have ltng:outApp extended and VF Page should have the code block(some div with ID) to embed the body. Reference to official documentation - https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/components_visualforce.htm


2

This is a known issue documented here. The issue has been identified as a Chrome issue than the salesforce issue. The timing of the chrome issue and Salesforce release is a coincidence. You can follow the bug here Hopefully, this will be resolved with the next Chrome update.


2

Please check if the VF page and class have version > 46. There is a lookup to contact on Opportunity which is stamped to the primary contact of that opportunity. See here If you don't want the relationship to come in a describe call then, you will need to explicitly exclude it OR use the components with API version < 46 (It would be a security issue ...


1

We have ported the libphonenumber library to Salesforce (Apex) and it's available for free on the App Exchange. You can use it to validate the phone number. I'm one of the authors of the library, so I can help you out in case you'll have any questions.


2

For anyone's facing the similar issue, using named pages and selectors, combined with background image solved the issue. https://www.w3.org/TR/css-page-3/#using-named-pages @page last_page { background-image: url("{!$Resource.backgroundImage}"); margin: 0 0 0 0; } .last_page{ ...


1

Not a full answer but a hint, the Visualforce to PDF Capabilities are very limited when it comes to CSS. There is barely any support for page attributes. I would try it with an img tag to solve it. I hope this helps!


0

You can try to open the page with the same parameters passed to the page (if any) from inside the Salesforce when logged in. This will help you to see if there is any error occurring while trying to open the page. Secondly you must also see if the Resources you have used in the VF page are having the proper sharing settings.


2

My guess is that you have tried to follow the advice in this blog post in order to implement communication between Lightning and Visualforce. If so, you should probably forget it. This blog post includes hard-coded vfOrigin and lexOrigin values, and glibly states that "In a real-life application, you should obtain this value dynamically instead of ...


0

In your component I see this line <b>Emanifest Name: {!carrier.CarrierEmailParentManifest__c}</b> But in your controller I only see the normal {get; set;} for the property {!carrier}. But nowhere I see value being assigned to that property in controller. I think your query is to set the carrierRecord property not for carrier property thats what ...


0

After looking at https://developer.salesforce.com/forums/?id=9060G0000005ZzPQAU ad speaking with @Adrian Larson, I decided that the quickest and convenient way to accomplish this would be to create a custom formula field because even SF support had stated that they have no documentation on why formulas sometime work and when they don't. Thus they suggested ...


0

You can't use an actionFunction like this, because those methods don't have context: you can't tell which wrapper should be updated. Option 1 Use an apex:commandLink instead. <apex:commandLink onclick="{!c.toggleSelected}" value="{!c.selected}" > Inside your wrapper class, add the method: public void toggleSelected() { selected = ...


0

try this in vfpage <apex:outputPanel id="table2"> <div class="slds-pill_container"> <apex:repeat value="{!selectedAccounts}" var="c" id="repeatTable2"> <span class="slds-pill slds-pill_link"> <a href="javascript:...


1

I had the same problem. This was recently resolved here. The resolution (copied from that link) involves splitting the init() call into separate configure() and handshake() calls so that websocketEnabled can be disabled. Note: I was also getting an appendMessageTypeToURL error which the following code fixes by adding an additional requestHeader. $.cometd....


1

Instead of second pageblockTable with id "Table2" I will recommend you to use apex:repeat tag and wrap it with apex:outputPanel with the id of table2 so your reRender should also work.I was able to get the pills working with below code. <apex:page controller="AccountSelectClassController" sidebar="false" applyHtmlTag=&...


1

To get the label for a picklist value, you can use Apex: public String getPLVLabel(SObjectField fld, String val) Schema.DescribeFieldResult dfr = fld.getDescribe(); List<Schema.PicklistEntry> plvs = dfr.getPicklistValues(); for (PicklistEntry ple: plvs) { if (plv.getValue() == val) {return plv.getLabel();} } return null; } Because ...


0

Can you please tell me the property {!quantity} in your second pageblocktabel from where it is coming is there any getter setter set for the same in controller of this page ? You can create a wrapper class combining medicine object and an integer field called quantity. Then in table you can iterate over the list of that wrapper objects then if you set the ...


0

You should be able to to do this by using <apex:inputField > tag. This tag is metadata aware so it will automatically show standard lookup input with magnifying glass and all. Simply add this <apex:inputField value="{!cas.Product_lookup__c}" label="Search Lookup Product"/> in your search pageblocksection and you will have to ...


0

There is no name on content folder member. There is a content parentfolderid which links to the content folder


0

Here is a VF solution expanding on Mark's comment. The fourth argument to URLFOR is nooverride <!-- Display markup when running user is Switzerland, otherwise, use standard page --> <apex:page standardController="Foo__c" action="{!IF($User.Country__c = 'CH', NULL, URLFOR($Action.Foo__c....


1

You can set the tabIndex programmatically. While you do need to write a script, you can make it as simple or complicated as you'd like. Here's a quick example: <apex:page doctype="html-5.0"> <script> window.addEventListener('DOMContentLoaded',onload); function onload() { let tabIndex = 1; [...document....


2

Go to sharing settings and add a sharing rule to the object that is supposed to show up in the lookup field, in this case, location__c.


2

You're trying to call a JS function from within a Visualforce merge field, so Visualforce thinks you're trying to call a controller function/value. To fix this, you need to use the merge field just within the expression to evaluate on the server: oncomplete="returnToProposal('{!IF(riskRec.size > 0,riskRec[0].id,''}','{!closeTabFlag}')" You also ...


0

For anyone in future looking for answer, here is what I did after receiving a suggestion from Salesforce Developer Forum. Remove comma before FROM and add "false" to Database.update(caseList, false).


-2

There is a native Salesforce app/package called Maven Integration Platform providing GraphQL fully on Salesforce (by extending REST API). Listing on: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000G965nUAB Documentation: https://docs.mavenmule.com/maven-integration-platform


2

The short answer is that this sounds like something you should be building a report for, rather than trying to solve the problem with Apex/Visualforce. However, if that's not an option or you're doing this as a project to learn apex/visualforce, then the simple answer is pretty much the same as your question's title (at time of writing). You should use a ...


0

I think it would be possible, as long as thhe managed package component is implementing somewhere inside the apex:componentBody/ tag. Here is an example: <!-- Page: --> <apex:page> <apex:outputText value="(page) This is before the custom component"/><br/> <c:bodyExample> <apex:outputText value="...


0

The form needs to reload in order to detect the change in record type: <apex:inputField value="{!Case.RecordTypeId}"> <apex:actionSupport event="onchange" /> </apex:inputField>


1

Realistically, no. A modern VF page should not do this. The preferred design would be to use the appropriate tags for this: <apex:page doctype="html-5.0"> <apex:includeScript value="{!$Resource.jquery}" /> <apex:stylesheet value="{!$Resource.GC_Styles}" /> <apex:includeScript value="{!$...


2

You can just describe it: if(obj.getSObjectType().getDescribe().isUpdateable()) {


0

You can't point a Visualforce input field at more than one underlying data field. You'll need to either write Apex code to iterate over Case.Assets__r before you perform your update to assign the value to SerialNumber, or build business process automation (Apex trigger, or your declarative tool of choice) to apply this rule globally by populating all updates ...


0

Use rendered attribute. Your code will be <table border="1" cellpadding="6" width="100%" class = "table1"> <thead> <tr> <th title="Field #1">test 1</th> <th title="Field ...


1

It works as expected: your columns are vertically centered in your grid. What I think you want to achieve is to center the columns on the page. In this case, I suggest you expand your grid to fit the page. One way could be to use vh units in the outer div and a relative height in the inner ones. Example <html xmlns="http://www.w3.org/2000/svg" ...


0

There's an APEX method to populate formula fields on a record without needing to save it first. It's called recalculateFormulas(): CCR2.Primary_User__c = o.opportunityContactRoles.size() != 0 ? o.opportunityContactRoles[0].contactId : null; CCR2.recalculateFormulas(); CCR.add(CCR2);


0

With all changes suggested by sebastian(except outputtext to button), you need to have a constructor with standardcontroller, then only you'll be able to see VF button while creating button on object. Like below - public createaccount(ApexPages.StandardController stdController) { }


0

apex:outputText is not for buttons, it is for text. Use apex:commandButton for a button Also, This is visualforce, not LWC. You must use the "curly-bang" method. Instead of {makePostCallout}, write {!makePostCallout} So, in summary, your code should read <apex:page standardController="Account" extensions="createaccount" ...


0

One way to do this is to use an iterator: function checkSaveUnassignComplete() { var errorIdByErrorMsg = { <apex:repeat value="{!errorByAccountId}" var="key"> "{!key}": "{!JSINHTMLENCODE(errorByAccountId[key])}", </apex:repeat> }; } NOTE: JavaScript allows a trailing comma, so no extra logic is ...


0

The thing you're describing is the standard field history tracking feature, at least for the "show old and new values" part of it. It's a related list on whatever object(s) you have it enabled on, and you can display a related list in Visualforce using <apex:relatedList>


4

Just keep using the loop, it's the right tool for the job. Each map key here points to a List<String>, so when you call .values() you're getting a List<List<String>>. Apex does not have a way to reduce the dimensionality of a nested data structure (i.e. to go from a List<List<String>>, a 2-dimensional structure; to a List<...


0

I have run into the "oppossite" scenario to these multiple times (= how a rich text field sent over an email in Salesforce appears with double spacing), and it's confusing mainly because the text in the Salesforce UI (at least in Lightning Experience) looks different (nice, i.e. without extra spacing) than when that same text is sent over email ...


0

Try this : (SVG icon might not be visible as this is for my local machine but you can add your own image to make it work) <apex:outputPanel> <apex:outputText style="font-weight:bold;font-size:smaller;" value="{!$ObjectType.Contact.Fields.Type_I__c.label}" /> <span class="popover" id="netNewEngagement&...


2

You can't really default it without a little bit of Apex. What you can do is add a list with all the available listviews and let the user choose. The below example, taken from the docs, will help you with the latter. If you are ready for some apex, write an extension that defaults the filterId property to the listview of your choosing. <apex:page ...


0

For handling/processing/controlling any thing, can be done through FLOW. You need to check login flows and from flow you can do callouts. Showing a page, is a tricky part here. May be you can have a page which accepts URL as a param and you can show the same URL in Iframe.


Top 50 recent answers are included