• wayohan
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

Hi,

 

I am trying to create a apex page which creates a new Lead using the data input by a user. This is done through an ajax call which will not use any controller classes. My goal is to create a lead and redirect to another site. I have achieved this using the following code.

 

 

     var lead = new sforce.SObject("Lead");
     lead.lastName = "a";
     lead.company = "b";
     lead.status = "Open - Not Contacted";
     var result = sforce.connection.create([lead]);
     alert(result[0].id);
     window.location="http://www.google.com";

 

 

This works fine when executed in a page preview but throws an exception when the page is linked to salesforce sites.

Exception is follows.

 

Error: uncaught exception: {faultcode:'sf:API_CURRENTLY_DISABLED', faultstring:'API_CURRENTLY_DISABLED: API is disabled for this User', detail:{UnexpectedErrorFault:{exceptionCode:'API_CURRENTLY_DISABLED', exceptionMessage:'API is disabled for this User', }, }, }

 

Can anyone help me on this urgently?

 

Thanks

Hi,

 

I am trying to create a apex page which creates a new Lead using the data input by a user. This is done through an ajax call which will not use any controller classes. My goal is to create a lead and redirect to another site. I have achieved this using the following code.

 

 

     var lead = new sforce.SObject("Lead");
     lead.lastName = "a";
     lead.company = "b";
     lead.status = "Open - Not Contacted";
     var result = sforce.connection.create([lead]);
     alert(result[0].id);
     window.location="http://www.google.com";

 

 

This works fine when executed in a page preview but throws an exception when the page is linked to salesforce sites.

Exception is follows.

 

Error: uncaught exception: {faultcode:'sf:API_CURRENTLY_DISABLED', faultstring:'API_CURRENTLY_DISABLED: API is disabled for this User', detail:{UnexpectedErrorFault:{exceptionCode:'API_CURRENTLY_DISABLED', exceptionMessage:'API is disabled for this User', }, }, }

 

Can anyone help me on this urgently?

 

Thanks