Skip to content

Instantly share code, notes, and snippets.

@albarivas
Created November 20, 2020 09:00
Show Gist options
  • Save albarivas/3d33e6894c72d76b795cdfe694a70e94 to your computer and use it in GitHub Desktop.
Save albarivas/3d33e6894c72d76b795cdfe694a70e94 to your computer and use it in GitHub Desktop.
public with sharing class DataloadSwitchController {
@AuraEnabled
public static String toogleValidationRule(String validationRuleId, Boolean state){
System.debug('Toggle apex method called');
System.debug('validationRuleId: '+ validationRuleId);
System.debug('state: ' + state);
HttpResponse resp = new HttpResponse();
resp.setStatusCode(204);
resp.setBody('empty body');
return serializeHttpResponse(resp);
}
private static String serializeHttpResponse(HttpResponse httpResponse)
{
Parameters parameters = new Parameters();
parameters.add('body', httpResponse.getBody());
parameters.add('status', httpResponse.getStatus());
parameters.add('statusCode', String.valueOf(httpResponse.getStatusCode()));
return parameters.serialize();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment