🗺️ Workday Studio maps
In Workday Studio, it's common to need to support mapping between a Workday object name or reference ID and a vendor's value using an integration map service. This post briefly walks through adding a simple map and looking up its corresponding value in Workday.
Create the Map Service & Deploy the Integration.
- Create an integration map service on the
StartHere
entry point for the studio. - Add a simple entry to the maps
Name: Visa type Internal Type: CRF -> Visa ID Type External Type: text
- Deploy the integration. Don't forget to configure some entries on the integration map to test with.
Add mvel expressions to look up the map values.
There are two general approaches for map lookups in Studio.
MapLookup
, you provide the internal value and it returns an external value.ReverseMapLookup
, you provide the external value and it returns an internal value.
Here's what the expressions look like:
// Lookup internal value when the external value is a string
props["internalValueList"] = intsys.integrationMapReverseLookup("map_name", "external_value", bool useDefault)
// Lookup external value when the external value is a string
props["externalValueList"] = intsys.integrationMapLookup("map_name", "internal_value", bool useDefault)
// OR
// Lookup internal value when the external value is a Workday Object
props["externalValueList"] = intsys.integrationMapLookup("map_name", "referenceIdType", "key")
For this example, we're going to stick with integrationMapReverseLookup
. If you just use the above statements, you get back either a list or null if there is no corresponding map value. So there are a few more expressions I frequently reach for:
// Get a T/F value indicating if the map value exists or not
props["hasValue"] = intsys.integrationMapReverseLookup("map name", "external_value") != null ? true : false;
// Get the Workday Reference ID of the first matching map lookup object
props["externalValue"] = intsys.integrationMapReverseLookup("map name", "external_value").get(0).getReferenceData("External_Ref_ID_Type");
// If the map value isn't found, fall back on the default map value:
props["internalList"] = intsys.integrationMapReverseLookup("map name", props["external_ID"]);
// If a map value for stock grant was found, use it. Else, get the default value
props["value"] = (props["internalList"] != null ? props["internalList"].get(0).getReferenceData("Obj_Reference_ID") : intsys.getIntegrationMapDefaultValue("map name"))