Hot answers tagged

15

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 packageNames parameter on And it really is that simple. I made a test changeset in a sandbox with a single component: Note the "Change Set Name" of TestCS. Then ...


13

Since you are just building a string, you need to wrap the Id in single quotes. SOQL = "select AuthorId,Name, Description,Type from Document where AuthorId='" + id + "'"; As was suggested in a comment, you should also escape any potentially harmful strings found in Id. I'm not familiar with the C# functions, but there should be some sort of URLEscape ...


12

The protocol used will depend on the .NET version you are using. If running under .NET 3.5 it will support TLS1.0 by default and fall back to SSL3 if it fails. With .NET 4+ the default is also TLS1.0 falling back to SSL3 (at least when I checked the initial value in a .NET 4.5.1 application). When Salesforce disables SSL3 the fall back option will be ...


11

The Replication API is the most reliable method for data replication. It includes two functions, getUpdated and getDeleted; the former describes newly created and updated records, while the latter indicates records that have been deleted. You can use this API to accurately replicate data in your remote system without worrying about determining specific ...


11

As joshbirk mentioned in another answer, OAuth is the preferred mechanism for authenticating users. The refresh token gives you a persistent value you can save (securely - treat it like a password!) and re-use to obtain new access tokens (equivalent to session id). Having said that, if you're using SOAP, you'll still need to be able to create your binding ...


8

I imported the Partner v26 WSDL into a Visual Studio 2012 console application as a Web Service Reference (not a WCF service reference). Then with a bit of painful cutting and pasting from the PDF I brought the C# example code in from the SOAP API developers guide pg 27 referenced by Jordan in his answer. It looks like their example is designed for use with ...


8

TL;DR If your C# decimal has a large number of significant figures (approximately 18 or more) then they can be truncated when sent to Salesforce via the Partner API in a SOAP message. Oddly, the same is not true of the SOAP representation Salesforce returns for values that has been set via Apex. You can receive back significantly more digits than will fit ...


7

There are a couple ways you can do this in Apex: UserInfo.isCurrentUserLicensed(namespace) from the UserInfo class, which will allow you to determine if the package is installed and the current user has a licensed "seat". Also: if (Type.forName('ns__KnownObjectInPackage__c') != null) {...} which is agnostic to whether the user has a license or not, but ...


7

You need to check what location your MC instance is on. Find this in the URL mc.[ ].ExactTarget.com Use the matching endpoint connection your development environment: S1 Instance https://webservice.exacttarget.com/Service.asmx S4 Instance https://webservice.s4.exacttarget.com/Service.asmx S6 Instance https://webservice.s6.exacttarget.com/Service.asmx ...


6

A quick Google search for 'c# salesforce attachments' returns results like: https://stackoverflow.com/questions/12525032/add-attachment-for-new-contact-in-salesforce-using-c-sharp http://www.joshuapyle.com/2012/09/add-attachment-for-new-contact-in-salesforce-using-c/ These all cover adding / updating an attachment. Retrieving will work the same as ...


6

The BCC functionality needs to be enabled on your account first. Talk to your account rep for details. You can see the note about it on the bottom of this page: http://help.exacttarget.com/en-US/technical_library/web_service_guide/objects/triggeredsenddefinition/


6

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 on it constantly!). Hope this (and Chimera) helps! Just as a heads up, automated web scanners like what Chimera use aren't always that useful on API-only ...


6

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/Product2/ProductID__c/%23%20H6%20SHORT%20BARREL%20NUT Characters other than A-Z, 0-9, #, and _ need to be URL-encoded. As it was, the URL was written in a way that ...


6

#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 directives aren't understood by the Apex compiler but by the Visual Studio Code editor.


5

Not sure what your current flow to get the session var is, but you might consider using OAuth with a refresh token flow: http://wiki.developerforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com You could either append this to your existing login screen, or to add even more security use it conjuction with login.salesforce.com. With a refresh token, ...


5

Resetting Values to null To reset a field value to null, you add the field name to the fieldsToNull array in the sObject. You cannot set required fields (nillable is false) to null. Source: https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_update.htm


5

Add the ProgramID to the Properties list when making the retrieve. The Automation object has a few issues with it.


5

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 a static variable so it can be initialized just once per transaction.


4

One username can be logged on from multiple places at the same time as each machine has a separate session. What you need to be wary of however, is that if User A and User B in this scenario are two people using one set of credentials, you'll need to make sure that you're not breaking the terms of your licence. If the credentials are being used for an ...


4

If they are using the same Salesforce username, they can both be logged in a the same time on different computers with different OAuth tokens, and each of them will have a separate session. Unless I misunderstand, this shouldn't cause a direct conflict.


4

Seems you are using SOAP APIs, where by default the max records returned are 500, which could be uplifted to 2000. Best would be to use "queryMore" to load the records. Here is a post from salesforce docs with good code samples for the same: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_querymore.htm


4

Looking at the request in Fiddler, I noticed that the headers and body that I set using RestSharp with the code above were not being set. After some experimentation and research, the following code ended up working: public AuthToken GetAuthToken(string code) { var client = new RestClient("https://login.salesforce.com/services/oauth2/token"); var ...


4

Here's an example: http://wiki.developerforce.com/page/Consuming_Force.com_SOAP_and_REST_Web_Services_from_.NET_Applications Tip: here's how to check for success and call synchronously. Just add ".Result" to the end of the call //call endpoint sync HttpResponseMessage response = httpClient.SendAsync(request).Result; ...


4

Try the following: String queryString = 'SELECT Id FROM ts2__Application__c WHERE ts2__Job__c = ' + ssSearchesId + ' AND ts2__Client__c = ' + ssContactId + ' LIMIT 1'; List <ts2__Application__c> ts2Applications = Database.query(queryString); if (ts2Applications.size() > 0) { ts2__Application__c ts2Application = ts2Applications[0]; ...


4

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 Andrews' answer don't work, try changing the Service.asmx to etframework.wsdl


4

If you just want all the results in a single variable you could create a List and use the addRange method. List<SaveResult> allSavedResults = new List<SaveResult>(); allSavedResults.addRange(SfdcBinding.update(oppList.ToArray())); allSavedResults.addRange(SfdcBinding.update(pHUpdateList.ToArray())); allSavedResults.addRange(SfdcBinding. create(...


4

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 Id = response.Id; Your example code worked in the past, but when you take a look at THIS COMMIT, you'll see that - thanks to wadewegner - the return type of ...


4

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 define and push change sets. Here is a blog post by Andy Fawcett detailing the process: http://andyinthecloud.com/2015/06/28/custom-metadata-custom-uis-packaging-...


4

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 check below screenshot .The last checkbox "Allow Users To Related Multiple Contacts To Events and Tasks"should be checked Once you enable that ,you should be ...


4

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 to the specified endpoint. The message includes a session ID so you can call the API while processing the message.


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