Skip to main content
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
  • 151k
7 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
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.8k
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
  • 497k
6 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
  • 54.2k
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,907
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

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
  • 497k
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

Execute Javascript after ActionFunction completes

When calling Javascript after the action function completes you would use the oncomplete property of the actionfunction: <script> function myJSFunction(){ alert("hi"); } </script> &...
Eric's user avatar
  • 54.2k
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

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
  • 151k
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.8k
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
  • 497k
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
  • 497k
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,656
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,120
2 votes

Can't get Custom Object ParentID for Attachment save

You cannot perform any DML in the constructor. If you really want to create a new parent on the fly for this page, use the action attribute on your page tag. <apex:page controller="MyController" ...
Adrian Larson's user avatar
  • 151k
2 votes
Accepted

Visualforce Picklist from Javascript Query

You could create select within JavaScript <apex:page > <script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script> <script src="../../soap/ajax/36.0/...
Ilya Lepesh's user avatar
  • 4,125
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
Accepted

Sforce Query Returns only Id and Type

You are querying for only the Id in the SOQL query. Change the query by adding more field API names to it. Example var query = sforce.connection.query("SELECT Id, Name,RecordTypeId, Phone FROM ...
Karthikeya Pammi's user avatar
2 votes
Accepted

Display time remaining before apex:actionPoller refresh

Its possible but not easy though, Used some JavaScript code from here. Oncomplete of action poller, can write a function which resets the counter. Class: public class ActionPollarRemainingTime { ...
Raul's user avatar
  • 18.8k
2 votes
Accepted

Get id of an record on click of checkbox

In your javascript method pass the Id as parameter check('{!row.acc.Id}'); and in the method get this function check(accId){ debugger;
Tushar Sharma's user avatar
2 votes

Rest api response error json

You have this payload: {query: "..."} You need to change it to: {"query": "..."} Which, since you have it wrapped in double quotes, is: "{\"query\": \"...\"}" I believe you also need to change ...
Adrian Larson's user avatar
  • 151k
2 votes
Accepted

Response status is '0' in jquery ajax

A Status Code of 0 means "the browser refused to honor the request." Generally, this might happen because of a Content Security Policy, a pre-flight check failure, or because the site is not in the ...
sfdcfox's user avatar
  • 497k

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