Customize the data retrieval script include in non-scoped HR

You can modify the default script includes to get additional data from Workday, in the non-scoped version of HR.

Before you begin

Role required: admin

Procedure

  1. Navigate to Integration-Workday > Script Includes.
  2. Open the workday_Factory script.
  3. Modify the script as necessary. Use any of the following examples.

    The following customization of the workday_Factory script calls the newly created cust_workday_worker_retriever class.

    workday_Factory.getWrapperType=function(scriptName){
         var overridenWrapperType = workday_Factory.registeredClassesInternal[scriptName];
         if(overridenWrapperType){
              return overridenWrapperType;
         }else{
              switch(scriptName +""){
                   case workday.WORKER_RETRIEVER:
                        return cust_workday_worker_retriever;// This is the name of the new script include that extends workday_worker_retriever;
                   default:
                        return workday_BaseFactory.getWrapperType(scriptName);
               }
           }
    };

    The following example is a customized version of the worker_retriever script named cust_workday_worker_retriever. In this example, the createUser function and the getUserName functions are customized. The createUser function sets the company value to a specific sys_id. The getUserName function returns a trimmed version of the source's user name to show only the first name and the last name with a period (.) between them, such as john.doe.

    var cust_workday_worker_retriever =Class.create();
     
    cust_workday_worker_retriever.prototype= Object.extendsObject(workday_worker_retriever,{
                createUser:function(source, userName){var destRec = workday_worker_retriever.prototype.createUser.call(this, source, userName);
     
                    if(destRec){
                        destRec.setValue('company','92f199bd0a0a3cba010e1fcc114bf137');
     
                        return destRec;}},
                getUserName:function(source){return source.u_wd_pref_first_name.trim()+'.'+ source.u_wd_pref_last_name.trim();},
                type:"cust_workday_worker_retriever"