Hot answers tagged

20 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
9 votes

Determine if instance has Multi-Currency Enabled

Boolean multiCurrencyEnabled = Schema.getGlobalDescribe().containsKey('CurrencyType'); If this check is true, it's safe to use CurrencyIsoCode fields and the CurrencyType object. I'd recommend using ...
sfdcfox's user avatar
  • 476k
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
  • 91.7k
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

Chimera Scanner testing server with no login credentials

If you don't provide credentials, we'll simply scan the site unauthenticated. If credentials are provided, we'll do our best to automatically login (this feature isn't perfect yet, but we're working ...
Tim B's user avatar
  • 76
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
  • 476k
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

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

Request was made to the incorrect endpoint

I believe the endpoints have changed. I can't post more than two links, but I had to use https://webservice.s6.exacttarget.com/etframework.wsdl on an s6 instance. If any of the endpoints in Kelly J ...
TMorgan's user avatar
  • 161
4 votes
Accepted

Cannot implicitly convert type 'Salesforce.Common.Models.SuccessResponse' to 'string'

CreateAsync method returns SuccessResponse. It has three properties: string Id, object Error, and string Success. So, this should work: var response = await client.CreateAsync("Account", a); string ...
Bart Juriewicz'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
4 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
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
  • 476k
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
  • 91.7k
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
  • 91.7k
3 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
3 votes
Accepted

Determine if instance has Multi-Currency Enabled

Thanks to sfdcfox for his answer in APEX. I was able to convert this into C# and here's what I got: var currencyType = sForce.describeGlobal().sobjects.Where(x => x.name == "CurrencyType")....
Lucas Anderson's user avatar
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

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

Create Sendable Data Extension using FuelSDK (C#)

I know this question is old; but I ran into the same issue and thought it might prove helpful for others. Your setting the SendableDataExtensionField to what is likely a raw FuelSDK....
user1794938's user avatar
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

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
  • 4,922

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