This article is exclusively for UKG Pro.
The GetCodeDescription Method is used to get the description for a UKG business rule.
The UKG API does not automatically return the business rule description when you reference a business rule code. Therefore, we need to explicitly state the specific UKG business rule, so that we can return the UKG business rule description.
This is especially useful for custom platform-config fields that are setup with a type of business rule.
Example
1. Assuming that we have created a custom business rule called ShoeSizes (underlying business rule code = _SHOESIZES), with the following values:
- S - Small
- M - Medium
- L - Large
2. We have defined a platform-config field called ShoeSize and its setup as a data type business rule - ShoeSizes (see above)
If your mapping references the platform-config field ShoeSize, then your expression would be:
PlatformConfig.Person.ShoeSize
The above expression, would only return the ShoeSizes business rule code (S, M or L) and not the description (Small, Medium or Large).
In our example here, we don't want the ShoeSize code, we need the ShoeSize description, so we need to extend the expression so that we can extract the correct description, based on the code:
PlatformConfig.Person.ShoeSize.GetCodeDescription("_SHOESIZES")
By adding the .GetCodeDescription("_SHOESIZES") expression, we are explicitly stating that we must reference the ShoeSizes (_SHOESIZES) business rule and extract the correct description based on the code.
This expression, will return the related ShoeSizes description (Small, Medium or Large).
Comments
0 comments
Please sign in to leave a comment.