Skip to main content
I am new to Salesforce.  I posted this question (in error) to the "Success Community".

Using the web to case html generator, I have been able to use the "id keys" (as in '00N1a0000088TuL') to identify and send to Salesforce my data values ... as in:  

postData.Append("00N1a0000088Tv4=" + HttpUtility.UrlEncode(reportDate.ToString("MM/dd/yyyy")) + "&");

This code works in production.  The problem is my organization (rightly so) wants to test in sandbox before deployment.  The working code fails in the sandbox environment, and it's not as simple as the id's don't match or the wrong orgid is being used in the Sandbox environment.

I have determined the issue has something to do with failing on custom fields, if I try to submit ANY custom field.

            string sPost = postData.ToString();

            sPost = HttpPost("https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8", sPost);

The response I get back is simply: 

"The remote server returned an error: (400) Bad Request."

All of the Custom fields are in the Sandbox instance.  I don't have any clue what is different between a sandbox with and/or without partial data ,  and production.  As far as I can tell the custom fields/page layout for the case, etc... are all there and correct.

Thank you in advance for any suggestions to resolve this, or alternatively the methodology to decern the difference between Sandbox and Production at a level detailed enough to isolate what is different/missing.  (My company is concerned about running tools that expose their settings/data to the world.)

 - Charlie
9 respostas
  1. 11 de abr. de 2017, 07:20
    Hi Charlie,

    You should be able to take working code from production and test in a sandbox by changing two things (possibly three).

    1. Sandbox org ID - sounds like you have already checked this

    2. The submitted URL is different for sandboxes. It should be as follows:

        <form action="https://test.salesforce.com/servlet/servlet.WebToCase?           encoding=UTF-8" method="POST">

    3. And the possible third thing to check is custom field IDs - I'm not sure if you have checked this or not. You do say that all the custom fields exist in the sandbox, but if they were created independently from the ones in production (i.e. they were created in the sandbox after the sandbox was created or refreshed). then they will have a different ID and you will need to update that in the code.

    Thanks,

    Nagendra.