function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SimrinSimrin 

Custom button to share with user

Hello,

I wrote a code on button, when a user clicks on the button, the recod is shhared with employer.

User-added image
 

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var url = parent.location.href; 
var split = url.split("/");
var recordID = split[3];
var objSharing = new sforce.SObject("EFX_Evalution__share");
objSharing.ParentId = recordID;
objSharing.AccessLevel = 'Read';
objSharing.UserOrGroupId = '{!EFX_Evalution__c.EmployeeId__c}';
var result = sforce.connection.create([objSharing]);

It worked good for & month, now the testing throws a popup error which is like below,

User-added image
 
Best Answer chosen by Simrin
ManojjenaManojjena
Hi Simrin ,

Andy is right , Please check this blog it has detail with image .

http://www.fishofprey.com/2012/07/salesforce-apicurrentlydisabled-api-is.html  

http://www.infallibletechie.com/2013/09/api-currently-disabled-error.html  

Let us know if it helps !!
Thanks 
Manoj

All Answers

Andy BoettcherAndy Boettcher
There is an option on the Profile for that user that allows them access to the API.  Odds are that was disabled.
SimrinSimrin
I don't get any option on the user profile for API
ManojjenaManojjena
Hi Simrin ,

Andy is right , Please check this blog it has detail with image .

http://www.fishofprey.com/2012/07/salesforce-apicurrentlydisabled-api-is.html  

http://www.infallibletechie.com/2013/09/api-currently-disabled-error.html  

Let us know if it helps !!
Thanks 
Manoj
This was selected as the best answer