Hi All,
I'm trying to run a business rule via javascript SData call and finally got the script to parse, but the resulting URL call does not look correct:
https://localhost:3333/SlxClient/slxdata.ashx/slx/dynamic/-/Opportunities/%24service/ACDGetProductVersion?_includeContent=false&format=json&_t=1489765853760
Internal Server error (500)
The end goal here is to iterate over each grid row to insert a custom value:
//fetch rows
grid.store.fetch({
onComplete: function (items) {
dojo.forEach(items, function (item, index) {
var oppProdId = item.$key;
//Build request URI
var service = Sage.Data.SDataServiceRegistry.getSDataService('system'),
request = new Sage.SData.Client.SDataServiceOperationRequest(Sage.Data.SDataServiceRegistry.getService(service))
.setResourceKind('Opportunities')
.setOperationName('ACDGetProductVersion'),
entry = {
request: {
'OpportunityId' : currentEntityId,
'oppProductId': oppProdId
}
};
request.uri.pathSegments[1].text = 'dynamic';
//feed this via sData to server-side function
request.execute(entry, {
success: function(response){
console.log('yay it worked!');
},
failure: function(){
console.log('no it failed!');
}
});
}) //end dojo.forEach
} // end onComplete
//End fetch
});
As of now I'm only receiving the failure function logging to the console "no it failed!"
Further analysis of the error message returns:

I've verified that the business rule is available via SData as follows:
localhost:3333/.../$template
<http:httpStatus>200</http:httpStatus>
<sdata:payload>
<slx:OpportunityACDGetProductVersion>
<slx:request>
<slx:entity xsi:nil="true" />
<slx:OpportunityId xsi:nil="true" />
<slx:oppProductId xsi:nil="true" />
</slx:request>
<slx:response xsi:nil="true" />
</slx:OpportunityACDGetProductVersion>
</sdata:payload>
The method signature on the C# business rule itself looks like this:
public static void ACDGetProductVersion(string oppProductId, out int version) {
version = 2017;
}
So it looks like it could be something wrong with the parameters while building the request in javascript, though I'm having trouble finding proper documentation. Any help would be great! Thanks in advance.