I would like to create a custom web service in my Salesforce organization to share some data when external application sends a request. The external application sends the request with some identifier. I need to respond with the related status.

Identifier can have 1 status(one-to-one mapping) Identifier can have multiple children (one-to-many mapping) How can I send this back to external application?

In 2nd case, I need to send both child I'd and statuses (map)

1 Answer 1


You can consider generating a JSON response or XML response depending on what your external application is capable of consuming.

I would personally prefer to use JSON as I have done this before and works well.

Your response should look like this:

    {"ID":"ABC", "Status":"New"},
    {"ID":"XYZ", "Status":"Completed"},
    {"ID":"PQR", "Status":"In-Progress"}

Once you get the ID and Status map in a List , you can generate the JSON response using the Salesforce JSON Generator. Please find the documentation here

You must log in to answer this question.

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