0

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)

0

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:

{"Response":[
    {"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

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.