Shared Tasks and API Versions

I was recently testing a SOQL query for tasks and depending on the tool I used, I got different results. This seemed really odd until I realized it had to do with API versions. According to the documentation, “Query(), delete(), and update() aren’t allowed with tasks related to more than one contact in API versions 23 and lower.” One of the tools I was using was Explorer which uses API version 19. If I used a different tool such as SoqlXplorer, then I could see all my tasks, including those that were related to more than one contact.

This got me to thinking that people with older code in Salesforce might be running into issues if they have code that queries, updates or deletes tasks and they’ve enabled shared activities in Salesforce. Other areas that might be affected would be third party tools like CongaComposer which gets passed a server URL with the API version. If you copy their sample code, it passes in an older version of the API server and your query results could be inaccurate. Always check your code and other tools after Salesforce upgrades. You never know when something might break!

Post Salesforce Data to Non-Salesforce Forms

I had a requirement to look up some information related to a customer in another system. The other system had a simple form where you would enter the data you wanted to lookup and it would give you the details from the other system. I needed a button on the record in Salesforce that when clicked would post the data to the external form and show me the results. I found this great solution on StackExchange and modified it to fit my needs.

First I needed a detail button that executes JavaScript:Crerating Custom Button

The JavaScript would look something like below. It consists of a function which does the post to the form. I then do a simple call to the function, passing in the endpoint plus all the IDs of the form elements that need to be filled and their values. In this case, I’m looking for two phone numbers and passing in the account’s phone and fax numbers

function post_to_url(path, params, method) {
  method = method || 'post'; // Set method to post by default, if not specified.
  var form = document.createElement('form');
  form.setAttribute('method', method);
  form.setAttribute('action', path);
  form.setAttribute('target', '_blank');
  for(var key in params) {
    if(params.hasOwnProperty(key)) {
      var hiddenField = document.createElement('input');
      hiddenField.setAttribute('type', 'hidden');
      hiddenField.setAttribute('name', key);
      hiddenField.setAttribute('value', params[key]);
              phone2: '{!Account.Fax}'});

One caution when using this technique: if the target form ever changes, you’ll need to modify the JavaScript to match.

Mass Editing Profiles in List Views

Here’s an oldie, but goodie tip I picked up a while back. It came in use today, and I thought I’d share it. We had a new custom object deployed to production and needed to give permissions to Create, Edit, Update and Delete records. This wasn’t done when the custom object was deployed, so I needed to assign these permissions profile by profile. Using the edit in list view functionality built into Salesforce, I was able to update all my profiles in one fell swoop.

1. Create a list view showing the permissions you want to change:

Creating a custom list view

2. Select the profiles you want to make the changes to:

Select Multiple Profiles

3. Double click on the field you want to change and select what you want the new value to be as well as which records to apply the change to:

Mass Edit Permissions

And there you have it! I could have also created a permission set with the additional permissions, but in this case I felt it was better to be at the profile level.