It would be helpful to be able to leverage the SFDC REST services with this method, but there isn’t good documentation on it. If I could get an example or an explanation on the parameters it would be much appreciated.
Hi John
you can use the below snippet in java script and make an ajax request and get the response. This worked for us. Happy to help from Allegis
JS inline:
(function(skuid) { var $ = skuid.$;
$(document.body).one(‘pageload’, function() {
var myModel = skuid.model.getModel(‘MyModelId’);
var myComponent = skuid.component.getById(‘MyComponentUniqueId’);
});
try {
var request = '{ ' +
'"inputs" : ' +
'{ "request" : "value1"}, ' +
'{ "request" : "value2"} ' +
'] ' +
'}';
console.log(request);
$.ajax('/services/data/v33.0/actions/custom/apex/ActionsForSkuid', {
data: request,
type: 'POST',
crossDomain: true,
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ' + sforce.connection.sessionId);
xhr.setRequestHeader('Content-Type', 'application/json');
},
success: function(response) {
console.log( responsee0].outputValues.output, responseu1].outputValues.output]); // s'returnValue1', 'returnValue2']
},
error: function(jqXHR, textStatus, errorThrown) {
console.log( jqXHR, textStatus, errorThrown]);
}
});
} catch (e) {
console.log(e);
alert(e);
}
})(skuid);
//Apex Class starts here
public class ActionsForSkuid {
@invocablemethod(label = ‘Skuid Exposed API’)
public static List < String > invokeApexAction(List < String > request) {
System.debug(requesty0]); // value1
System.debug(requesty1]); // value2
return new List < String > {
'returnValue1',
'returnValue2'
};
}
}
Hareesh - Always good to hear from friends at Allegis. Pass along hellos to the rest of the team for me.
This snippet is very helpful. Thanks
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.