Hot answers tagged

9 votes
Accepted

How to be sure API calls are using TLS 1.2

Check your Login History (under Setup). It now includes a TLS version column. There is also an equivalent field on LoginHistory called TlsProtocol. Another option is to change the API endpoint for a ...
Daniel Ballinger's user avatar
9 votes
Accepted

Salesforce email says I'm connecting via TLS 1.0 but that protocol does not appear in login history

An interesting comment from twitter on receiving the email: Raised a case with [Salesforce Support]. They said they are sending it to everyone. @pranayjaiswal Case # 16169927 That would suggest ...
Daniel Ballinger'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
  • 481k
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

How to capture the nested fields on a lead object?

You will also need an Opportunity class with the fields that you have queried from ConvertedOpportunity. Something like (untested): private class Lead { public const String SObjectTypeName = "...
Daniel Ballinger'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
  • 481k
4 votes

Push data from a website developed in .net to salesforce

If you have not gone through this Apex Web services Trailhead, then it is the best time to complete that. You need to create your Apex Class as a Web Service @RestResource(urlMapping='/Cases/*') ...
Santanu Boral's user avatar
4 votes

How to check whether Apex class with specific name exists or not using C#.Net?

You can querry the ApexClass using the RestEndpoint and provide your class name in where clause. If it returns record you can say that class exists. You can also query the class code in the body ...
Pranay Jaiswal's user avatar
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
  • 92.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
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
  • 601
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
Accepted

Bulk Upsert with Salesforce .NET API

The Salesforce .NET Toolkit is a wrapper around salesforce standard REST API. Up until recently the Standard Salesforce REST API was only supporting single record actions per call and I believe that'...
Vamsi Krishna Gosu's user avatar
3 votes
Accepted

Accessing salesforce data from a VS console app

After adding the Salesforce Connected Services to a .NET console application you have a couple of things: It will have brought in the Force.com .NET toolkit from nuget It will have created a ...
Daniel Ballinger's user avatar
3 votes
Accepted

Cannot Set LoginResult.serverUrl - UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

//LOGIN PART sforce.SoapClient sc = new sforce.SoapClient(); sc.Endpoint.Address = new System.ServiceModel.EndpointAddress("https://test.salesforce.com/services/Soap/u/34.0"); ...
pnoytechie's user avatar
3 votes

Bulk API client for .NET

If you don't want to manually perform the Bulk API calls from code you can use the Data Loader. This includes a command line interface that you could use to automate the process as required.
Daniel Ballinger's user avatar
3 votes
Accepted

Custom objects not accessible via REST API

Whenever using (directly or indirectly) the Force.com Describe API calls (REST or SOAP), if the running user doesn't have READ access to the object, then the object, standard or custom, won't be ...
cropredy's user avatar
  • 69.9k
3 votes

The Id field should not be specified in the sobject data

In Salesforce, record Id's are generated when you insert any record. Once record id's are generated they become Read Only fields. Hence they cannot be modified. In above code, you're trying to make ...
Rohit Mourya's user avatar
  • 3,851
3 votes

Subscribing to a Channel with an Invalid ReplayId?

Best practice is to store replay ID value in your target system. You can then use it on resubscription to retrieve events from SF that are missing from your target. This works for short failure ...
identigral's user avatar
  • 7,261
2 votes
Accepted

salesforce .net toolkit relationship query serialization

I assume you are using the Force.com Toolkit for .NET for this? In this case your SFLocation class should have a property of type Account that it called Account__r. And the Account class would have ...
Daniel Ballinger's user avatar
2 votes
Accepted

Relationship Query issue

double check your endpoints Working against v34 and generate an wsdl with v35 (accidentally) will not work properly I do not understand why some querys will work, some not and the api response is so "...
ohaucke's user avatar
  • 31
2 votes
Accepted

Generated SforceService.cs file from enterprise.wsdl is enormous. How to condense?

Salesforce provides two main WSDLs for accessing your orgs data via SOAP. Enterprise WSDL This is a strongly typed WSDL that is bound to the specific org it was generated from. It will have elements ...
Daniel Ballinger's user avatar
2 votes

Linking custom object to Lead using Force.com Toolkit for .NET

The following console application ran for me and created the ResourceView__c record associated with the Lead. Note that: The Lead Id was assigned as a string. I needed to add my namespace prefix of &...
Daniel Ballinger's user avatar
2 votes

How do I call ForceClient.UserInfo() synchronously

Update based on comments. You need to use Task.ConfigureAwait(false); to prevent blocking the UI thread context. See Don't Block on Async Code I made the call synchronously using the following: ...
Daniel Ballinger's user avatar
2 votes
Accepted

"Authentication Error" Response Using Salesforce .NET Toolkit Error

TLS 1.1 or 1.2 is required to access salesforce [always for sandbox, for prod depends on if the critical update is turned on]. Unfortunately the default TLS version for many versions of .NET is 1.0, ...
superfell's user avatar
  • 7,900
2 votes

Asp.Net integration with salesforce ApI and Post data into salesforce lead

It looks like you are using the using the SOAP Partner API. You basically carry on like you did with the describeGlobal call. Make sure the binding has the serverUrl and SessionHeaderValue set with ...
Daniel Ballinger's user avatar
2 votes

Make Salesforce alert my program when a certain change happens

You can use a callout in your trigger (conditions apply, read: HTTP Callout from Triggers), to send data to a external server, which you can host your c# code on. Its unlikely that theres any method ...
battery.cord's user avatar
  • 8,767
2 votes

Make Salesforce alert my program when a certain change happens

Outbound messages or a trigger based callout are common solutions based on you hosting a web service for Salesforce to callout to when something changes. Another option is the Streaming API. With this ...
Daniel Ballinger's user avatar
2 votes
Accepted

TLS 1.2 Using Partner wsdl

You can force you C# application to only use TLS 1.2 by adding the following line before making the connection to Salesforce: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; In ...
Daniel Ballinger's user avatar
2 votes
Accepted

Call REST API From .net application

The URL is case sensitive. Note the capital you have in your URL: /services/data/v37.0/sObjects/Account Instead you want: /services/data/v39.0/sobjects/Account If in doubt, Workbench is a ...
Daniel Ballinger's user avatar

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