0

I have created object using javascript itself without using controller. It is done by using

var cas = new sforce.SObject("Case"); cas.Type = document.getElementById("Type").value; (mapping the value into the corresponding field var a = sforce.connection.create([cas]);

case is created when we use insdie salesforce. But when I publish this page in the sites , it is not working.. Please provide me a solution .. Thanks in advance !!

2
  • Are you using a public site and trying to create a case?
    – manjit5190
    Sep 29, 2015 at 6:30
  • yes !!! I am doing that only Sep 29, 2015 at 6:31

1 Answer 1

0

I think that is because when you are using public site, no SessionId is generated. You can verify this by Adding {!$Api.Session_ID} on a visualforce page which will print NULL.

Salesforce AJAX toolkit require a session-id to be generates for authentication & authorization of the the request.

If you want to create a case without session Id, you will have to create a controller or a public rest service.

Also you will have to provide the site user profile access to create cases.

If you want to go for rest service, here is a good article on that: Creating Public Rest Service.

There was one more detailed article that I read yesterday however I am not able to find the link, I will post the link when I find it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .