
The booster tool eases the creation of your subaccount and your subscription to SAP Intelligent RPA.
Software Center
First we create a new Project
Then we add a new automation
Then we add the username and password of type String as global credentials for our web service call
Now we need to encode the credentials using the encoding String activity
We then use the expression editor on step 1 to bind the username and password from start step 0
Now we need the csrf token for the web service call. We will use the custom script for this:
async function fetchToken() {
const token = {
resolveBodyOnly : false,
method: 'GET',
url: 'https://apisalesdemo4.successfactors.com/odata/v2/RBPRole',
headers: {
'Accept' : 'application/json',
'Content-Type': 'application/json',
'Authorization' : 'Basic ' + cred,
'x-csrf-token': 'fetch'
}
};
try {
const response = await irpa_core.request.call(token);
return response;
} catch (error) {
const csrfToken = error.response.headers['x-csrf-token'];
return error;
}
}
let response = await fetchToken();
return response.headers;
Next we will need to script our POST request using a second custom script activityAdd the output parameter 'payload' of type Any. Then add the following Input Params and bind them to the token values retrieved in the previous step as follows:
cookie of type String bound to cookie value from the token
cred of type String bound to cred from step1
var i = 0;
var temp ="";
var cookieField ="";
if(cookie!=""){
for(i=0;i<cookie.length-1;i++)
{
temp = cookie[i].split(";");
cookieField = cookieField + temp[0] + "; ";
}
temp = cookie[i].split(";");
cookieField = cookieField + temp[0];
}
var data = {
"__metadata": {
"uri": "RBPRole",
"type": "SFOData.RBPRole"
},
"roleDesc": "test123",
"roleName": "test123"
};
var payload = {
resolveBodyOnly : true,
method: 'POST',
url: 'https://apisalesdemo4.successfactors.com/odata/v2/upsert',
headers: {
'Authorization': 'Basic '+ cred,
'Cookie' : cookieField,
'Content-Type': 'application/json',
'x-csrf-token' : csrf_token
},
ignoreClientCertificate: true,
body: JSON.stringify(data)
};
return payload;
After this step we add the 'Call Webservice' activity with input parameter as the payload from step 3
Now we are ready to call the webservice but before this we need to also capture execution logs for monitoring. For this we will add the 'Log Message' activity with input parameter as the object from previous step here:
After the run you will see the Role was added and the test console has a success message
We can confirm the same in the SuccessFactors instance OData audit logs
Also the same in Manage Permission Roles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
6 | |
6 | |
6 | |
4 | |
3 | |
2 | |
2 | |
2 | |
2 |