Hot answers tagged

11 votes
Accepted

Possible to Set Access-Control-Allow-Origin in an SFMC Landingpage?

I found out a Solution. Its possible to Set the Header using Server-Side JavaScript within the Landingpage. Here is my Header and its working fine now. <script runat=server> Platform.Load("...
Ronald Koch's user avatar
10 votes
Accepted

How To Stop actionPoller After Set Duration?

You can tweak the example from the docs just slightly to check an isEnabled property. Controller public with sharing class Demo { final Long start = Datetime.now().getTime(); public Boolean ...
Adrian Larson's user avatar
  • 149k
7 votes
Accepted

AJAX load JSON from static resource

I've actually kind of figured it out. There is some issue with my use of $.getJSON, however $.ajax works fine. I'll explore why .getJSON wasn't working.. Either way, I've moved my code back into the ...
Matt and Neil's user avatar
6 votes
Accepted

Using AJAX in Salesforce

This can be done using the describeGlobal() method from the AJAX toolkit: <apex:page title="Object List"> <apex:pageBlock title="Object List"> <apex:pageBlockSection ...
Raul's user avatar
  • 18.7k
6 votes
Accepted

what happens behind the scenes of salesforce remoting

The AJAX Toolkit is a generic toolkit that is designed to be used anywhere: in a JavaScript button, on your own website, in a Chrome/Firefox/IE browser extension, desktop apps, NodeJS apps, etc. It's ...
sfdcfox's user avatar
  • 481k
6 votes

what happens behind the scenes of salesforce remoting

This question is really interesting, which also force me to think, what's there exactly, and how it works, here is the background: let's understand this process with an example, I created a Class with ...
user2809299's user avatar
5 votes
Accepted

CORS whitelisting not working as expected

Ok. I did some research on this and looks like we both interpreted the Salesforce CORS documentation wrongly. Salesforce CORS says that CORS is only for making requests to Supported Salesforce APIs, ...
javanoob's user avatar
  • 8,797
5 votes

visualforce page ActionFunction reRender not Working

You can absolutely rerender the <use>and <svg> tag by: The xmlns= on the div containing the SVG is a MUST as if you try to rerender without it the page will simply stall. Important trick ...
Eric's user avatar
  • 54k
4 votes
Accepted

Disable Custom Button in Standard Page Layout

Custom button this event point to window property in javascript so we can't use that to disable the button but as an alternative option we can search for that button using standard javascript ...
Himanshu's user avatar
  • 10.5k
4 votes

Refused to set unsafe header "User-Agent": connection.js

The XMLHttpRequest#setRequestHeader specifically states that User-Agent must not be set by a client script, and any attempt to set that header should be ignored. The connection.js script tries to set "...
sfdcfox's user avatar
  • 481k
4 votes
Accepted

Custom Search Lightning component cannot read property. (community)

Assuming that findAll is the remote method in your controller, I believe that your line in ContactListController.js: var action = component.get("e.c.findAll"); should be: var action = component.get(...
Stuart Greenberg's user avatar
4 votes

Lightning component lazy loading

You could put the request for the data of the picklist into the Renderer. Make an afterRender method that populates the picklist. https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/...
Luke Inman-Semerau's user avatar
4 votes
Accepted

Jquery AutoComplete in Visualforce Page

This is not really a SFDC question, but I’ll tackle it anyway. On your JavaScript, your return code searches for the controls to update by using the jQuery selector $ (as in id$=“conName”). This ...
Sebastian Kessel's user avatar
3 votes
Accepted

Set timeout always 10 seconds for remoteFunction

See Execution Governors and Limits (emphasis mine): Per-Transaction Apex Limits Maximum CPU time on the Salesforce servers5 Synchronous Limit: 10,000 milliseconds Asynchronous Limit: 60,000 ...
Adrian Larson's user avatar
  • 149k
3 votes
Accepted

Instantiating a field of an sObject with a string value passed through AJAX

The solution to this is to use sObject method put. public static String updateInputField(Id objectkId, String objectFieldName, Integer objectFieldValue) { String errorMsg = 'testerror'; ...
cropredy's user avatar
  • 69.9k
3 votes

Correct way of using apex:actionPoller

Give it inside: <apex:pageBlock title="New Cases"> <apex:actionPoller rerender="ncase" interval="15"/> </apex:pageBlock>
Priyalakshmi's user avatar
  • 1,456
3 votes

How do I load Bing Maps in Visualforce?

Keith C is right. <body onload= will not work. You can call your GetMap method from window.onload as below. I just updated your code and it is working. Also you need a key to use the Map. <...
Saroj Bera's user avatar
  • 14.6k
3 votes
Accepted

How do I load Bing Maps in Visualforce?

The problem is that Visualforce does not preserve your body onload replacing that with its own logic. (Worth using your browser's "View Source" or "Inspect" feature to look at the HTML that the ...
Keith C's user avatar
  • 135k
3 votes
Accepted

Assertion Failed on custom object - Lightning component

As discussed in comments, you should be using competitor instead of competitor__c from var="competitor". Another situation in which this same error comes, when you forget to put the "v" i.e value ...
Deepish's user avatar
  • 234
3 votes
Accepted

What is the standard way to save to the database after a Web Call?

Insecure endpoint sounds like you are using http instead of https. You can schedule time with someone on the AppExchange team to review your issues and get feedback.
Matt Kaufman's user avatar
3 votes
Accepted

run assignment rule from javascript button

Looks like AssignmentRuleHeader is case sensitive, Try changing it to assignmentRuleHeader. Your code would then be: sforce.connection.AssignmentRuleHeader = {} sforce.connection....
Raul's user avatar
  • 18.7k
3 votes
Accepted

ServiceAppointment sObject Type not supported in Java Script Button

ServiceAppointment object is available in API version 38.0 and later. So, use {!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")}
Santanu Boral's user avatar
3 votes
Accepted

POST Ajax method with Jquery to create new account contact and Opportunity

You can use the SObject Tree resource to create nested records. POST /services/data/v42.0/composite/tree/Account HTTP/1.1 Host: <instance>.my.salesforce.com Authorization: OAuth ... Content-...
sfdcfox's user avatar
  • 481k
3 votes
Accepted

Making API calls to third party API from Lightning component in client-side

Is there a way to hide URL and Authentication parameters securely in client side ? No. How to restrict the user to not to see this API call details in browser network logs ? A clever user can ...
sfdcfox's user avatar
  • 481k
3 votes
Accepted

Pageblocktable is not rendering

PageBlockTable is not rendered because when the page is loaded the value of boolean is null and your PageBlockTable renders only when the boolean's value is set to true. So this is how the flow would ...
Vijay Ganji's user avatar
  • 6,566
2 votes
Accepted

Need help with custom javascript button to update records

I'm assuming this is on a List view of cases, so you are not going to have access to the RecordTypeId of those records unless you query for it. Below is an example that should work for what you are ...
cricketlang's user avatar
  • 2,103
2 votes
Accepted

AJAX - Can I reference a method from the controller by url?

Check this post Rest API (POST method) with Jquery GET, POST AND DELETE Method using Jquery You can use stndard services or You can create own rest service and use in jquery If you want callout ...
Ratan Paul's user avatar
  • 22.5k
2 votes
Accepted

X-editable POST URL parameter and Visualforce

I've found an approach to do that, you can set manually the success function when the user edit a field, so, you must add for example the remoting callouts into this function. //Set inline editor ...
Pirata21's user avatar
  • 222
2 votes

Global AjaxStart and Stop event on visualforce page

The actionFunction has some useful attributes. onbeforedomupdate: The JavaScript invoked when the onbeforedomupdate event occurs--that is, when the AJAX request has been processed, but before ...
Sergej Utko's user avatar
2 votes

Manually Enforce CRUD and FLS in trigger handler and Ajax to pass salesforce security review

When rendering VisualForce pages, the platform will automatically enforce CRUD and FLS when the developer references SObjects and SObject fields directly in the VisualForce page. For example, if a ...
AtulRajguru9's user avatar
  • 9,110

Only top scored, non community-wiki answers of a minimum length are eligible