In this video we will show you how to remove user from profile group in collaborators using API.
Please find script below:
global with sharing class RemoveProfileUserDemo {
@InvocableMethod
globalstaticvoidremoveUser(List<GenerateDocActionRequest> rm_user_req){
if (!rm_user_req.isEmpty()) {
for (GenerateDocActionRequestrmu : rm_user_req) {
makeCall(rmu.ftApiKey,rmu.userId);
}
}
}
@future(callout=true)
publicstaticvoidmakeCall(stringftAPIKey,stringuserId){
HttpRequestreq = newHttpRequest();
req.setEndpoint('https://mysubdomain.formtitan.com/api/v1/users/RemoveUserFromProfileGroups/'+userId);
req.setMethod('DELETE');
req.setHeader('ftAPIKey', ftAPIKey);
Httphttp = newHttp();
HTTPResponseres = http.send(req);
System.debug( 'ft res>>>> ' + res.getBody());
// return res;
}
globalclassGenerateDocActionRequest{
@InvocableVariable(required=true)
globalStringuserId;
@InvocableVariable(required=true)
globalStringftApiKey;
}
}