Hi
I am having an issue with validation within a rule. I have three validations being performed in one rule. The attached document details the part of the script I am having problems with. The HR_teacherSelectionComponent is a picker field and the first textField validation and the second rule, CAT_topicAssignCREDetailsV2 work each time the field is cleared. However, the second rule, CAT_validateCollegePosition, only works in the first instance, ie if I select someone who doesn't have a position in the college then it returns an error, but if I clear the field and then select someone who does, the error is still returned. Vice versa, if I select someone who has a position in the college first then an error is not returned, but these if I clear the field and select someone who doesn't have a position then an error is not returned. I have tried debugging by passing the values for the inputs and they appear to change correctly but do not validate.
Would anyone have any suggestions as to how I can get this working?
Thanks
Irene Best
rule!HR_teacherSelectionComponent( teacher: local!selectedTeacherDetails, topic: null, teacherFan: local!selectedTeacherFan, validTeacherFan: ri!selectedCasual, additionalSaveInto: {}, topicCoordinator: local!tcFan ), a!textField( readOnly: true, value: " ", validations: { if( and( rule!CAT_isNullOrEmpty( ri!editIndex ), rule!CMN_isNeitherNullNorEmpty( ri!selectedCasual ), or( rule!CMN_isNeitherNullNorEmpty( ri!casualDetails ), rule!CMN_isNeitherNullNorEmpty( ri!selectedTopicCasualDetails ) ) ), if( contains( touniformstring( reject( rule!CAT_isNullOrEmpty, { ri!casualDetails.fan, ri!selectedTopicCasualDetails.fan } ) ), ri!selectedCasual ), "Casual Academic has already been added to this topic", {} ), {} ), } ), rule!CAT_validateCollegePosition( fan: local!selectedTeacherFan, college: ri!topic.college, selectedTeacherDetails: local!selectedTeacherDetails ), rule!CAT_topicAssignCREDetailsV2( local!selectedTeacherFan, local!selectedTeacherDetails ), rule!CAT_additionalContactEmailAddressSection( showWhen: rule!CMN_isNeitherNullNorEmpty( local!selectedTeacherFan ), value: rule!CMN_getValueForName( nameValuePairs: ri!casualsAdditionalEmailAddresses, name: local!selectedTeacherFan ), saveInto: { a!save( target: ri!casualsAdditionalEmailAddresses, value: rule!CMN_addNameValuePair( nameValuePairs: ri!casualsAdditionalEmailAddresses, name: local!selectedTeacherFan, value: trim( save!value ), replaceIfNameAlreadyPresent: true ) ) } ), a!sectionLayout_17r1( label: "Create Work Schedule" ), rule!CAT_sectionToSetCasualWorkScheculeStartAndEndDate( payPeriodDetails: ri!payPeriodDetails, startDates: ri!startDates, endDates: ri!endDates, flagToAddCasual: ri!flagToAddCasual, casualWeeks: ri!casualWeeks, casualWorkSchedule: ri!casualWorkSchedule, selectedCasual: ri!selectedCasual, index: ri!editIndex, tempStartDate: ri!tempStartDate, tempEndDate: ri!tempEndDate, flagStartDateChanged: ri!flagStartDateChanged, flagEndDateChanged: ri!flagEndDateChanged ) rule!CAT_validateCollegePosition with( local!selectedCasual: ri!fan, local!college: ri!college, a!sectionLayout( label: "", contents: { a!textField( readOnly: true(), value: " ", validations: { if( rule!CMN_isNeitherNullNorEmpty( ri!selectedTeacherDetails ), if( not( contains( rule!HR_WS_getCollegeDescForUser( fan: local!selectedCasual ), local!college ) ), "This person does not currently hold a casual position within this college and must be engaged within the college via Workday before proceeding.", {} ), {} ) } ) } ) ) rule!CAT_topicAssignCREDetailsV2 with( local!creRenewalDate: rule!CAT_ENG_getUniqueCRERenewalDateByFan( ri!selectedTeacherFan ), a!sectionLayout_17r1( label: "", firstColumnContents: { if( rule!CAT_isNullOrEmpty( ri!selectedTeacherDetails ), {}, if( rule!CAT_isNullOrEmpty( local!creRenewalDate ), { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem_18r1( text: ri!selectedTeacherDetails.firstName & " " & ri!selectedTeacherDetails.lastName & " does not have a current ", style: "STRONG" ), a!richTextItem_18r1( text: "Working with Children Check", link: a!safeLink( uri: cons!CAT_ENG_WWCC_URL, text: "Working with Children Check" ), style: "STRONG" ), a!richTextItem_18r1( text: ", (DCSI) Child-Related Employment screening clearance or Teacher’s registration. Please contact ", style: "STRONG" ), a!richTextItem_18r1( text: "employment.screening@flinders.edu.au", link: a!safeLink( uri: cons!CAT_ENG_CRE_SCREENING_EMAIL, label: "employment.screening@flinders.edu.au" ), style: "STRONG" ), a!richTextItem_18r1( text: " to arrange a Working with Children Check prior to the employee commencing work.", style: "STRONG" ) } ) }, { a!richTextDisplayField( labelPosition: "COLLAPSED", value: { a!richTextItem_18r1( text: ri!selectedTeacherDetails.firstName & " " & ri!selectedTeacherDetails.lastName & " has a ", style: "STRONG" ), a!richTextItem_18r1( text: "Working with Children Check", link: a!safeLink( uri: cons!CAT_ENG_WWCC_URL, text: "Working with Children Check" ), style: "STRONG" ), a!richTextItem_18r1( text: ", (DCSI) Child-Related Employment screening clearance or Teacher’s Registration that is valid to " & local!creRenewalDate & ".", style: "STRONG" ) } ) } ) ) } ) )
Discussion posts and replies are publicly visible
Thanks for all who answered my query.
The resolution was in nested scripts within the CAT_validateCollegePosition rule. These had load() instead of with() statements so was only validating the first fan passed. These have now been fixed.