0

I am currently building an external application that utilises SalesForce's REST APIs and have it complete except that I need to be able to display the solutions attached to a case.

I can attach a solution to the case via the CaseSolutions object however I am unable to retrieve any information of records from this Object nor can I find this information elsewhere.

CaseSolution, CaseComment and Attachment objects all return blank record results when queried and a 404 if the case ID is queried along with the object.

Does anyone know if attached solutions can be retrieved via the REST API?

Any help with this matter would be greatly appreciated.

The code I'm using to add a solution to the case is below:

$.ajax({
     type: 'POST',
     url : 'https://eu11.salesforce.com/services/data/v37.0/sobjects/CaseSolution',
     data : json,
     headers : {
        'Authorization' : 'Bearer '+sx.access_token,
        'Content-Type' : 'application/json'
     },
     success : function(response){
        confirmation_message('success', "'" + question + "' has been successfully attached to this case");
     }
})  

This works and I can log into my SalesForce account and can confirm that the solution has been successfully added.

In regards to retrieving solutions attached to the case:

$.ajax({
     type: 'GET',
     url : 'https://eu11.salesforce.com/services/data/v37.0/sobjects/CaseSolution',
     headers : {
        'Authorization' : 'Bearer '+sx.access_token,
        'Content-Type' : 'application/json'
     },
     success : function(response){
     }
})  

or

$.ajax({
     type: 'GET',
     url : 'https://eu11.salesforce.com/services/data/v37.0/sobjects/CaseSolution/'+sx.current_record,
     data : json,
     headers : {
        'Authorization' : 'Bearer '+sx.access_token,
        'Content-Type' : 'application/json'
     },
     success : function(response){
     }
})  

I have tried Attachments, CaseComments as well instead of CaseSolution without any luck.

2
  • Can you share any code that you're using right now? Cool name by the way! – Dan Jones Nov 11 '16 at 12:46
  • Post edited to reflect some of the code I'm using or have tried. We're a dime a dozen it seems. – Daniel Jones Nov 11 '16 at 13:04
0

I've found a solution, I can get the case solutions attached to the case by using the SOQL query API.

var query = 'SELECT+caseid,solutionid+from+CaseSolution';

   $.ajax({
        type: 'GET',
        url : 'https://eu11.salesforce.com/services/data/v37.0/query/?q='+query,
        headers : {
            'Authorization' : 'Bearer '+sx.access_token,
            'Content-Type' : 'application/json'
        },
        success : function(response){

        },
        error : function(jqXHR, textStatus, errorThrown){
            var error = $.parseJSON(jqXHR['responseText']);
            confirmation_message('error','Sorry your request failed due to an error:<br>'+error[0]['message'] + '<br>' + error[0]['errorCode']);
        }
    }) 

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.