Guest User


a guest
Jul 25th, 2011
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //This Javascript should grab the Id URL parameter, and update the "Taken By" field, setting it to empty.
  2. //This code is designed to be placed in a button on the Feature__c detail page.
  4. {!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit
  5. var url = parent.location.href; //string for the URL of the current page
  6. var recordOnPage = window.location.href.replace('https://' + + '/', '');
  7. var updateRecords = []; //array for holding records that this code will ultimately update
  9. if (id == null) {
  10.     alert("Please select at least one record to update."); //alert the user that they didn't make a selection
  11. } else { //otherwise, there was a record selection
  12.     var update_Feature = new sforce.SObject("Feature__c"); //create a new sObject for storing updated record details
  13.         update_Feature.Id = recordOnPage; //set the Id of the selected record
  14.     update_Feature.Taken_By__c = ""; //set the value for Taken By field to an empty string
  15.     updateRecords.push(update_Feature); //add the updated record to our array
  16.         console.dir(updateRecords);
  17.     result = sforce.connection.update(updateRecords); //push the updated records back to Salesforce
  18.         //ERROR: Refused to set unsafe header "User-Agent"
  19.         console.dir(result);
  20.     //parent.location.href = url; //refresh the page
  21. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.