In my case the requirement was: Create an activity which runs for all the operators in the application and compares their skills with the skills of the operator to select and create a pagelist of the operators who has skills same or more than the same skills as of the operator scheduling the absence.Here are the steps in the activity I wrote.
Step 1: Create a new Page where we can list all the operators eligible to work as substitute to original operator.
Step 2: Retrieve list of all the operators present in the application
Step 3.0: Loop over all the operators present in the application one by one and for each substitute operator sets the property Local.AllSkillsPresent as true and Local.IndexCount as the current index of the loop.
Step 3.1: Inner loop which iterates for each skill present for the original operator. In precondition 1 (@(Pega-RULES:Utilities).IsInPageList (OperatorID.pySkills(<CURRENT>).pySkillName,pySkillName,operators.pxResults (Local.IndexCount) .pySkills)) it checks if the operator’s skill is present in the skills of the substitute operator. If not present then set Local.AllSkillsPresent as false.
Step 3.2: Copy the details of the valid substitute operator to OperatorsFilter page. In precondition 1 (Operators.pxResults(<CURRENT>).pyUserIdentifier!= OperatorID.pyUserIdentifier) it checks if substitute operator is not the original operator. In precondition 2 (Local.AllSkillsPresent is true) which means all the skills the original operator has is also possessed by the substitute operator.
I did this in Pega 6.2. There may be a better way to do it in PEGA 7.
We also had no luck withdrawing the rules, they still appeared in the dropdown for the users to add (we have a custom UI to display the operator update but it still used the OOB skill add). What worked for us was just copying the pySkillName property to an application rule set and then changing the UI control. We then used the Auto Complete control in the UI (pyOperatorSkillsUpdate saved to the application rule set as well) and sourced it from a report that displayed the Skills only from our application. That worked just fine.