1

I'm making a callout to a REST Resource using the sforce.connection.remoteFunction() and getting a strange result.

My RestResource returns a String.

@RestResource(urlMapping='/demo/*')

global class DF_RestDemo {

    @HttpPost
    global static String doPost(Id contactId) {
        return 'testing';
    }
}

But in my onSuccess function the String has been double double quoted: Chrome debugger result

Is this a known issue? I can't seem to find anything about it online.

1

When apex rest request to /services/apexrest/[namespace/]demo is made it is returning the response of type string which results "testing" not this testing and this response in javascript treat as string which will again append the response within "" which results the output ""testing"".

So workaround of this is to return the response use wrapper class in the form of json instead of string.

I hope this information will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.