Advanced Change approval workflow

Overview


CodeBot for SAP SuccessFactors now supports the implementation of Change Approval Process (CAP) workflows. This enhancement provides administrators with greater visibility and detailed insights into configuration changes, enabling them to review and approve changes before they are implemented. It also helps enforce governance and control by restricting unauthorized users from performing automated configuration changes within SAP SuccessFactors.


Setup Advance Change Approval Workflow


  1. Navigate to the Company Admin Dashboard and select the instance you want to configure the approval workflow for.


  1. Scroll all the way down and expand the Advanced Change approval workflow: 


  1. In the workflow URL, setup the URL for the system you want to integrate you will have your request on the server you integrate codebot with.


  1. To view the logs, navigate to the side menu, expand the Others section, and select View Company Logs. This will open a dedicated window displaying detailed information about each initiated change request. The logs provide comprehensive details, including the username, timestamp, environment, build number (iteration number), and change request number (Depending on the configuration). Additionally, they capture the change execution start and end dates and times, the execution result, and details of the requested changes, providing administrators with greater visibility and traceability of configuration changes.



You can also select a different view for the details log. 



In the above scenario we have integrated CodeBot with ServiceNow. However, if you need to setup any other system, it needs to be configured manually.  


To setup the workflow approval, kindly share your Endpoint, request & response with us and we can set it up for you, or please feel free to schedule a call with our support team and we would be happy to guide you through the process.


Sample Script:


(function process( /RESTAPIRequest/ request, /RESTAPIResponse/ response) {


var obj = {};
retmsg = "";
var reqBody = request.body.data;
if (reqBody.startTime != "") {

msg = "False";
    // var strID = GlideGuid.generate(null);
    // var strID = gs.generateGUID();
    var strID = generateUUIDv4();

    var strCR = reqBody.cr.replace("INC000","").replace("CR000","");
    var strStartTime = reqBody.startTime.replace("T", " ").replace("Z", "");
var strEnd = strStartTime;
var gdtStart = GlideDateTime(strStartTime);
var gdtEnd = GlideDateTime(strEnd);

var hours = 60 * 60 * 1;

    if (strCR > 25 && strCR <=35)
    {
      hours = -hours;
      gdtStart.addSeconds(hours*2);
    }

    gdtEnd.addSeconds(hours);

    changeStart = gdtStart.toString()+"Z";
    changeEnd = gdtEnd.toString()+"Z";


    if (strCR <18 || strCR >35)
    {
      changeStart = null;
      changeEnd = null;
    }


// var msgReason = getBlockReason(reqBody.startTime);
var msgReason = getBlockReason2(strCR);

// obj.id = "dd83fcf5-1634-4f45-89c2-eb255b19adb3";
obj.id = strID;
obj.deploymentServiceVersion = "1.3.4";

obj.result = msgReason;
obj.blockReason = msgReason;
obj.changeStart = changeStart;
obj.changeEnd = changeEnd;

retmsg = JSON.stringify(obj);
retmsg = JSON.parse(retmsg);

}

return retmsg;

// implement resource here

})(request, response);

function getBlockReason2(strCR) {

retVal = "Block";

  if (strCR <18)
    retVal = "Block";    
  else if (strCR >= 18 && strCR <=35)
    retVal = "Proceed";
  else
    retVal = "Technical Error";

return retVal;

}
function getBlockReason(str) {

retVal = "Block";
str = str.replace("T", " ").replace("Z", "");
var gdt = GlideDateTime(str);
var timeOnly = gdt.getTime();
var timeStr = timeOnly.getByFormat('HH:mm:ss');
var datePart = timeStr.split(":");

var num = parseInt(datePart[1]);
if (num % 2 == 0)
retVal = "Proceed";

return retVal;

}
function generateUUIDv4() {
var chars = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.split('');
for (var i = 0; i < chars.length; i++) {
switch(chars[i]) {
case 'x':
chars[i] = (Math.random() * 16 | 0).toString(16);
break;
case 'y':
chars[i] = (Math.random() * 4 + 8 | 0).toString(16);
break;
}
}
return chars.join('');
}






How it works?


Scenario 1:


When the change request number is incorrect.


Confirm and start Button - Disable




Scenario 2:


When the change request number is valid/correct number.


Confirm and start button gets enabled.



Scenario 3:


When the change request number is outside from a specific time frame.


Confirm and start button - Disable



To run the changes, a user must enter the correct change request number and must run an action within the specified time frame.

Updated on: 03/11/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!