Hot answers tagged

9 votes
Accepted

Handle JSON array from REST call

You have an array of objects, so you should use: List<SalesData> resultList = (list<SalesData>) JSON.deserializeStrict( response.getBody(), List<SalesData>....
sfdcfox's user avatar
  • 481k
8 votes

How can I install GMagick on Heroku?

Are you trying to install the graphicsmagick library? If so, you might want to check out this buildpack: https://elements.heroku.com/buildpacks/xerpa/heroku-buildpack-graphicsmagick Also, if you ...
Jon McCartie's user avatar
5 votes
Accepted

Connect an apex trigger to an authorized user's account

Expanding my comment into an answer. I'd suggest you considered using the new Change Data Capture feature instead. Synchronization of Salesforce data to an external persistent store is exactly what ...
David Reed's user avatar
  • 92.1k
4 votes

(400) - Bad Request when requesting auth token using Wordpress

So I got it working. I had to change the Content-Type header to application/x-www-form-urlencoded, which I tried because of this answer. Unfortunately the docs don't tell you that. In fact they say ...
jabyess's user avatar
  • 71
4 votes

How to insert/pass NULL value into Date field

You need to use the fieldsToNull attribute, as noted in the update documentation. $createField["fieldsToNull"] = array("Date__c");
sfdcfox's user avatar
  • 481k
4 votes
Accepted

REST API - PHP - Salesforce- Update Account owner byName

if you know new OwnerId, just assign it to new variable $someOwnerId and put as key to map. $content = json_encode(array("Name" => $new_name, "BillingCity" => $city, "OwnerId" => $...
Oleksandr Berehovskyi's user avatar
3 votes
Accepted

SOAP API username and password

If you are using SOAP API for login functionality ,please note that the Username and Password are your user credentials . Also kindly note that password here is a combination of Password + Security ...
Mohith Shrivastava's user avatar
3 votes

session id or oath token, they not interchangeable?

Session Id values and Authorization tokens are indeed interchangeable. In fact, I often use Session Id values instead of a token when I'm mocking a quick JavaScript function in my browser. For example:...
sfdcfox's user avatar
  • 481k
3 votes
Accepted

The Triggered Send is not completely configured or in a new status

For Triggered Send emails, I would recommend against creating a new TriggeredSend for each email that is sent. A TriggeredSend should be created once to represent the campaign or specific type of ...
Mac 's user avatar
  • 2,452
3 votes
Accepted

Creating Case via PHPToolkit fails to activate email queue

You need to specify the EmailHeader in order to trigger emails (it defaults to false). This will cause the system to send out any notifications it would normally.
sfdcfox's user avatar
  • 481k
3 votes

Decrypt a string encrypted by the EncryptSymmetric() AMPscript function using PHP

I had the same question and thanks to the great work of @Kolohe with the mcrypt example I found a solution with openssl_decrypt and DES encryption. With the upgrade to php7 we replaced mcrypt with ...
fry2k's user avatar
  • 31
3 votes
Accepted

Modifying data using SOQL?

See the various examples in Getting Started with the Force.com Toolkit for PHP. You use SOQL to query: $query = "SELECT Id, FirstName, LastName, Phone from Contact"; $response = $mySforceConnection-&...
Keith C's user avatar
  • 135k
3 votes

how to integrate salesforce with php in a website?

As @Ratan already said, if you want to use the SOAP API you can go to the developer pages. If you're looking to use the REST API, you can look at this Salesforce Cookbook page. If you're using a PHP ...
Dan Jones's user avatar
  • 7,147
3 votes
Accepted

PHP Salesforce Toolkit Parameterized Queries/ SQL Injection Prevention

I've not used the PHP toolkit but often methods exposed via API require you to do your own escaping like you suggest. The parameterisation is only available via Apex I believe. If you're really ...
Matt Lacey's user avatar
  • 25.4k
3 votes
Accepted

How to input data into a lookup field through php

The actual field's API Name is AccountId. I know the UI says Account but with pretty much any standard lookup, you actually append Id to the end of the name. There are dozens of examples of this ...
Adrian Larson's user avatar
  • 149k
3 votes

Fields missing from API request

In Salesforce you need to check that your API User has Read Access permission to the fields you are requesting. Setup -> Profiles -> API User -> Field-Level Security
getBalian's user avatar
3 votes
Accepted

Create and Perform a query with PHP SOAP API in ExactTarget

You can't just perform the QueryDefinition using the CustomerKey, you must use the ObjectID for the Query definition. You can find the ObjectID by performing a retrieve on the QueryDefinition Object....
Abhi Reddy Musku's user avatar
3 votes

Can I get a refresh_token using cURL from the command line, or in Salesforce.com itself?

I think you'll be better off using JWT for oAuth. It's more predictable behavior. Here is a PHP github library that I've used that has a lot of the code - https://github.com/adhocore/php-jwt To ...
PartOfTheOhana's user avatar
2 votes
Accepted

Query Result: Where does "any" come from?

You need to wrap the response in a QueryResult object which'll do the work of decoding the any array for you. e.g. $response = $mySforceConnection->query($query); $queryResult = new ...
superfell's user avatar
  • 7,900
2 votes
Accepted

how to submit a geolocation field via the API create command?

You need to set the latitude and longitude separately; the main field is a compound field that can only be read, similar to how Account.ShippingAddress combines all of the address fields. Sample: ...
Mike Chale's user avatar
  • 13.3k
2 votes
Accepted

how to send an email by setting the templateid using php tool kit --->Single email method

while sending email using setTemplateId you need to consider following points When you use templateId you need targetObjectId as well. As per the documentation Targetobjectid can be only record id of ...
Himanshu's user avatar
  • 10.5k
2 votes

What is the maximum number of records I can send per RESTful API call?

As of v42.0 you can use Composite Collections to INSERT/UPDATE/DELETE up to 200 records at a time. These will be handled in a single execution context. You can also use Composite & Composite ...
NSjonas's user avatar
  • 10k
2 votes

Call <link rel="stylesheet" href=""> On A Specific Part Of My Page Without Overriding My Current CSS Style

I really doubt that this question belongs here. The CSS conflicts can be resolved by adding a namespace to your css file. You may use this namespaced bootstrap from SalesforceFoundation. The above ...
manjit5190's user avatar
  • 7,973
2 votes
Accepted

Salesforce REST API with PHP, INVALID_SESSION_ID after successful authentication

I found the answer, I had the wrong syntax for setting the curl headers. I tried to pass the values as an associative array, but the correct way is like this: curl_setopt($ci, CURLOPT_HTTPHEADER, ...
newUserName02's user avatar
2 votes

How to use the apexrest with C#

A .NET tool kit was announced by salesforce. "The Force.com Toolkit for .NET provides an easy way for .NET developers to interact with the Force.com REST API using a native libraries." https://...
Mohith Shrivastava's user avatar
2 votes
Accepted

Unable to set subscriber status via the PHP API

I finally figured it out, this is what did it for me. Pretty simple actually and then you just need to pass the client object to the function after you've connected. function reActivateSubscriber($...
Stan Alachniewicz's user avatar
2 votes

SSL certificate problem: unable to get local issuer certificate, curl_errno 60

Just insert some piece of code under the demo_rest.php Line no 11 below curl_setopt($curl,CURLOPT_SSL_VERIFYHOST => false) curl_setopt($curl,CURLOPT_SSL_VERIFYPEER => false)
lovely mano's user avatar
2 votes

Pushing data from salesforce org to PHP server

You can make a callout from Salesforce to your PHP application. In this way Salesforce can actively send information to a secondary system. Check out the callout section in the documentation. Keep in ...
user254875486's user avatar
2 votes

invalid security token

I was experiencing the same error until I noticed that ExactTarget will return this error if the created timestamp passed to it is in the future as per ET's own current time. Adjusting the time of the ...
Sanil's user avatar
  • 21
2 votes
Accepted

Can I Upload Remote PDF File to Account via PHP?

I am hoping that you are using Force.com PHP SDK. You can directly call attachment SOAP API with following code. $url = "$instance_url/services/data/v20.0/sobjects/Attachment/"; $...
Himanshu's user avatar
  • 10.5k

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