Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs
22 votes

Salesforce Metadata Api/ Tooling Api to build changesets

It turns out you can directly retrieve and update changesets directly with the Metadata API. Via Sean Harrison‏: Pro tip: U can retrieve the contents of a change set incl. manifest with the ...
Daniel Ballinger's user avatar
15 votes

Does Apex have an equivalent to the C# object initializer?

The correct answer is it depends. Currently salesforce only accepts that for sObjects. Other Objects (1) cannont be initialized that way. You can however, create custom constructors like: public ...
Fernando Gavinho's user avatar
8 votes
Accepted

Does Apex have an equivalent to the C# object initializer?

This is the syntax Student student = new Student(FirstName = "Jane",LastName = "Doe");
Santanu Boral's user avatar
8 votes
Accepted

Apex Code - Region for as C#

#region and #endregion define a code folding unit. The Apex extensions for Visual Studio Code added support for these directives in 2018. The directives must be located in comments; #region ...
David Reed's user avatar
  • 93.1k
7 votes

Return more than 2000 records (SOQL)

I'm using simple_salesforce for python and ran into the same issue where there was a limit on the number of records returned. But that's because I was running sf.query(my_SOQL_query) instead of sf....
SYLVIA TRAN's user avatar
7 votes

How can I encrypt a string in Apex in a way that an external system can decrypt using C#?

David is absolutely right and I'd like to add some extra information and provide code examples regarding Apex-encryption/C#-decryption. To encrypt some String in Apex using the AES256-CBC algorithm ...
Oleh Berehovskyi's user avatar
7 votes
Accepted

Cannot download large files from Salesforce URL using C#

The root cause of your problem is when you try to fetch image data from /sfc/servlet.shepherd/document/download/{ContentDocumentId} resource, you receive the next response, and only after that a ...
Oleh Berehovskyi's user avatar
6 votes

Determine if instance has Multi-Currency Enabled

Another possible way is via UserInfo Class. Boolean multiCurrencyEnabled = UserInfo.isMultiCurrencyOrganization();
Christian Szandor Knapp's user avatar
6 votes
Accepted

Trying to upsert product2 - Method not allowed?

To use PATCH, you need to make sure you're encoding the ID. Assuming the URL in your question was generated literally, that's problematic. The URL should look like: /services/data/v41.0/sobjects/...
sfdcfox's user avatar
  • 493k
6 votes

Bulk API v2 Get Job Status Failing - InvalidBatch : Field name not found

Problem resolved! { "operation": "insert", "createdDate": "2019-03-28T19:40:38.000+0000", "systemModstamp": "2019-03-28T19:41:34.000+0000", "state": "JobComplete", "...
Steve D.'s user avatar
  • 121
5 votes
Accepted

Rest API Save multiple contacts to Task

To enable the feature of associating Tasks with Multiple Contacts in SFDC we enable a feature known as "Shared Activities". This setting can be found in the Activity Settings via Set up Menu . Please ...
Mohith Shrivastava's user avatar
5 votes
Accepted

OAuth implementation in SOAP API (C#)

I recently had some challenges adding a SOAP Header when creating a Universal Windows Platform (UWP) application in .NET against the SOAP based APIs. The problem was that the WCF tooling for ...
Daniel Ballinger's user avatar
5 votes

Apex Code - Region for as C#

Expanding on David's answer with an example. In VSCode, you start the folding region with //#region and end it with //#endregion. public static void createAccounts(Integer amount) { List<...
Daniel Ballinger's user avatar
4 votes

Salesforce Metadata Api/ Tooling Api to build changesets

You can use salesforce Metadata API for this purpose . If you are familiar with ANT tool ,you will find that there is force.com migration tool in SFDC which uses ANT commands to help extract metadata ...
Mohith Shrivastava's user avatar
4 votes
Accepted

Salesforce Metadata Api/ Tooling Api to build changesets

Yes its possible. But rather than writing the application drom scratch in another language, consider keeping it on platform! You can use the open source Apex Metadata API and custom metadata to ...
frup42's user avatar
  • 414
4 votes

Bulk delete data extension rows

You have to loop and capture the RequestID from the Response to churn through the rows in blocks of 2500. Here's the important part from a PHP implementation: var_dump($results); while ($results-&...
Adam Spriggs's user avatar
  • 30.7k
4 votes

Make Salesforce alert my program when a certain change happens

Yes, you'll want to read Setting Up Outbound Messaging for more info. Basically, you set up a workflow rule that triggers when the record is Closed Won, then Salesforce will send a SOAP-based message ...
sfdcfox's user avatar
  • 493k
4 votes
Accepted

JWT Token always expires after 'exp' provided in the claims

RFC7523, which defines JWT authentication, specifies in section 3.4 that The authorization server MUST reject any JWT with an expiration time that has passed, subject to allowable clock skew ...
David Reed's user avatar
  • 93.1k
4 votes

c# .NET Example of using JWT OAUTH flow with salesforce

Maybe a bit late, but recently I came across the same requirement and rolled my own implementation. Youn could find it here: ForceDotNetJwtCompanion on github Brief description of the implementation: ...
claboran's user avatar
4 votes

How can I encrypt a string in Apex in a way that an external system can decrypt using C#?

The data I would think an external systems developer would need are: The algorithm: AES256. The cipher mode: Cipher Block Chaining (CBC), as documented for the Apex Crypto class. The padding mode: ...
David Reed's user avatar
  • 93.1k
3 votes

DescribeAsync Method usage using C# .Net API

Thank you Daniel, I've followed your recommandations and it works. What I needed in my C# .Net application was to get the Labels and Field names for custom objects, but also the content of the ...
Olivier Crivelli's user avatar
3 votes

FIELD_INTEGRITY_EXCEPTION Must specify a nameField of type Text or AutoNumber

TL;DR: cf.typeSpecified = true; Clarifying the question: The other answer mistakenly assumes there is an existing Custom Object and we are getting an error when creating new records for it. The ...
Usas's user avatar
  • 31
3 votes

Get all automations that exist using SOAP using C#

I have coded it with the same result, but I have found some interesting thing, you can call Retrieve method filtering by "isActive" parameter and "true" value, and after repeat the call filtering by "...
Jacob's user avatar
  • 31
3 votes

Does Apex have an equivalent to the C# object initializer?

You can create a sObject and initialise its properties using the following examples. // Create a Student instance and set some property values Student student = new Student( FirstName = "Jane", ...
TSmith's user avatar
  • 5,032
3 votes

Does Apex have an equivalent to the C# object initializer?

If you would like similar functionality for custom classes, you can add a constructor that takes a Map<String, Object> and assign using that. public class Student { private String ...
IllusiveBrian's user avatar
3 votes

Simple SOAP Example in C#

C# has a SOAP bug with a WSDL. I vaguely remember that everything needs an attribute being the cause. Bug information is listed below. You can edit your WSDL to the following to fix the issue: ...
Halfwarr's user avatar
  • 609
3 votes
Accepted

Data extension does not exist error message after new Business Units have been added to instance

Since you have added new Business Units to the account and you are using an API username and password that likely have access to both business units (MIDs) you need to specify which business unit you ...
Joe Kuemerle's user avatar
3 votes
Accepted

Enterprise WSDL and polymorphism

This is the in-variant vs co-variant scenario on Generic Lists. See Covariance and Contravariance in Generics. That's the computer science explanation, but I find an example easier to work through. ...
Daniel Ballinger's user avatar
3 votes

System.IndexOutOfRangeException: Index was outside the bounds of the array

You've run into the query result paging where the size of the SOQL query result size will be greater than then number of records returned in the current QueryResult. When dealing with Attachments it'...
Daniel Ballinger's user avatar
3 votes
Accepted

ETClient (401) Unauthorized with SDK C#

please add the following line and try again: parameters.Add("authEndPoint", "https://auth.exacttargetapis.com/v1/requestToken?legacy=1");
Sharif Ahmed's user avatar

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