Workday Integration - exclude certain types of workers

lpomeroy0613
Kilo Contributor

We would like to make some changes to our Workday integration with ServiceNow. I reviewed the documentation that I could find on the HI portal and community. I also reviewed what we have set up from the Workday side. I can’t find anything related to how you would exclude certain types of workers Ex: We have a few contract workers that are loaded into Workday purely for administration purposes and should not flow over to ServiceNow. We also have some workers that we track in Workday due to our being a part of a joint venture, but they are not actually our employees.

Does anyone have any resources they can share or can point me in the right direction? I also couldn’t determine whether it could be done on the Workday side or if it would need to be done in ServiceNow.

Additionally, based on some changing requirements since we went live, we may need to start mapping additional fields from Workday. Is there documentation somewhere related to how to do this? Thanks in advance for your feedback.

4 REPLIES 4

Erik Stolberg
Tera Guru

Note: these modifications may require some working knowledge of XML/XPath and Workday's WSDL/API. You should be familiar with transform maps and script includes as well.

 

Depending how you differentiate these workers (I'm assuming a "worker type" field that labels as contractor or contingent), you will need to see if that field is currently being brought into ServiceNow by the integration. Underneath the Workday menu > Transform Maps, find the Workday_Data_Transform and look through the Field Map related list to see if the field may exist already.

If you aren't sure if the source field contains the right data, Workday menu > Script Includes > workday_worker_xpath_map. This what the integration uses to match data from the SOAP repsonse XML schema. An example:

colToXPathMap.wd_position_type = "wd:Worker_Data/wd:Employment_Data/wd:Position_Data/wd:Worker_Type_Reference/@wd:Descriptor";

 

If the field contains the data you're looking for, then you can just go back to the previous page and add a Transform Script to check that source field and skip the entire transform (i.e. does not create the user) if it meets your logic. Example:

//onBefore Transform Script
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if(source.worker_type == "contingent") {
ignore = true;
}
})(source, map, log, target);

 

If the field or data doesn't exist or match what you're looking for, you will need to add a new variable and line with full XPath within workday_worker_xpath_map to find the data. You may find the following valuable:
https://community.workday.com/sites/default/files/file-hosting/productionapi/Human_Resources/v30.0/H...

You would then need to add a new entry on the transform mapping, as well as add the above Transform Script. I can't remember but you may need to modify a couple of the other script includes as well.

 

I have added several new fields that we needed data from Workday, and I took the route of extending the "workday_future_retriever" script include to apply my logic (that's another option if you prefer). Let me know if you get confused on any part of it, and I'll try to help.

Please remember to mark as helpful or correct answer if I've answered your question.

lpomeroy0613
Kilo Contributor

Hi Erik,

 

I am just finally getting a chance to test this today. I am trying to exclude contractors at this points so I attempted to use what you provided above for that, but it doesn't seem to be working for me. I was told the transform piece of the script wasn't really necessary so I left it out (although I have since tested it with that and found it still didn't work).

When the original code you provided didn't work, I edited the source field name to match the field we have in the transform field map and the value it would return for contractors:

find_real_file.png

 

This is what I am doing currently:

In the Workday Data Transform:

/**
 *
 *
 * Please extend, the workday_worker_retriever script and override logic rather than modifying the logic here.
 *
 *
 **/
//Start edit by Liz 05/31/2018
if(source.wd_position_type == "contractor") {
ignore = true;
}
//End edit by Liz 05/31/2018
if (source.process_type == 'future') {
 //gs.log('Processing the future code ');
 workday_Factory.wrap(workday.FUTURE_RETRIEVER).transform(source, target);
} else {
 //gs.log('Processing the current code ');
 workday_Factory.wrap(workday.WORKER_RETRIEVER).transform(source, target);
}

 

Do you have any insight on what I am doing wrong or is there somewhere else I should be adding this code?

Sorry for the delay. So the code you modified was directly on the 'Wokday_Data_Transform' transform map script? I heeded the comment directly above your edit, and instead extended the "workday_worker_retriever" script include. Essentially you are overriding the logic defined in the original file, so you need to use the same function names and such. Something like this should do the trick I think.

 

Name: cust_workday_worker_retriever

Script:

var cust_workday_worker_retriever = Class.create();

cust_workday_worker_retriever.prototype = Object.extendsObject(workday_worker_retriever, {
	shouldSkipTransform: function(source, target) {
		if(source.wd_position_type == "contractor") {
			return true;
		}
	},

	type: 'cust_workday_future_retriever'
});