Tariq Sanjakdar
07/05/2020, 11:00 PMdefine(
'AJG.apie192.apieModule.ServiceController'
, [
'ServiceController', 'ApieBackend.Model'
]
, function(
ServiceController, ApieBackendModel
)
{
'use strict';
return ServiceController.extend({
name: 'AJG.apie192.apieModule.ServiceController'
// The values in this object are the validation needed for the current service.
, options: {
common: {
}
}
, get: function get()
{
var abmr = ApieBackendModel.setApiePaymentMethod()
return 'Hello Service! ' + abmr;
}
Service.ss:
function service(request, response)
{
'use strict';
try
{
require('AJG.apie192.apieModule.ServiceController').handle(request, response);
}
catch(ex)
{
console.log('AJG.apie192.apieModule.ServiceController ', ex);
var controller = require('ServiceController');
controller.response = response;
controller.request = request;
controller.sendError(ex);
}
}
Calling function in View:
var service_url = Utils.getAbsoluteUrl(getExtensionAssetsPath('services/apieModule.Service.ss'));
$.get(service_url).done(function(result){
console.log('GET RESULT', result);
}).fail(function(e){
console.log('GET FAIL', e);
});
UPDATE: I attempted to recreate the ServiceController function myself and store it with the other suitescript files of my extension (which didn't work out) but when I reverted my code to using the default ServiceController I started receiving the error: The TAX_OVERHAULING feature is not available to your company, with an error code of 400.Steve Goldberg
07/06/2020, 1:41 PMTariq Sanjakdar
07/06/2020, 10:10 PMApplejack Group
07/08/2020, 10:24 PMTariq Sanjakdar
07/09/2020, 4:01 AMdefine('ApieBackend.Model'
, ['Application', 'Utils', 'SC.Model']
, function(App, Utils, SCModel){
'use strict';
return SCModel.extend({
name: 'ApieBackend',
validation: {},
setApiePaymentMethod: function(){
nlapiLogExecution('DEBUG', 'setApiePaymentMethod', 'STARTED');
return 'COMPLETE - APIE RETURNED';
}
});
}
);