You need to sign in to do that
Don't have an account?
API disabled when sforce.connection.query is used
Hi,
Requirement:
I want to call a our site url which is used to save Lead details into database. I've a custom javascript button in Lead section.
Using that I want to pull all selected Lead Id's with its basic information (e.g. firstname, lastname, etc ) and push it to our site by executing the url.
On click of it, I'm executing following code (given in brief)
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")} //adds the proper code for inclusion of AJAX toolkit {!REQUIRESCRIPT("/soap/ajax/26.0/apex.js")} var url = parent.location.href; //string for the URL of the current page var records = {!GETRECORDIDS($ObjectType.Lead)}; //grabs the Lead records that the user is requesting to update var updateRecords = []; //array for holding records that this code will ultimately update var selectedIds=''; if (records[0] == null) { //if the button was clicked but there was no record selected alert("Please select at least one record to sync."); //alert the user that they didn't make a selection } else { //otherwise, there was a record selection for (var a=0; a<records.length; a++) { //for all records updateRecords.push(records[a]); //add the updated record to our array } try { if (updateRecords.length > 0) { var SelectedIds=''; for(var i=0;i < records.length; i++) { SelectedIds+="'"+records[i]+"',"; } SelectedIds=SelectedIds.substring(0,SelectedIds.length - 1); var strQuery = "SELECT Id, Email, FirstName, LastName, Phone, Title, Company, Industry, LeadSource FROM Lead WHERE Id IN ("+SelectedIds+")"; var openablerecords = sforce.connection.query(strQuery); alert(updateRecords.length +' lead(s) successfully synched!'); } } catch(e) { alert('could not update leads' + e); } }
Above code works fine in Developer Edition but does not work in Group and Professional Edition because of sforce.connection.query.
Is there a work around for the same so I can acheive the desired functionality in Group and Professional Edition?
Do let me know,
Thanks!
You might have to check with Salesforce support to see if it can be enabled.
Hope this helps.
Regards,
Satish Kumar
The API is enabled by default for Unlimited, Enterprise, and Developer Editions.
Some Professional Edition organizations may also have the API enabled but you need to contact your Account Executive.
Enabling the API for Group edition is probably not possible.
Yes, API feature is disabled for GE/PE. It can be enabled if your connected app is whitelisted.
But I wanted to know, is there any work around for the same so that I can achieve same functionality without using such code which does not get supported in PE/GE.
Thanks
I'm afraid not