AnsweredAssumed Answered

Script Trigger, Date Validation

Question asked by ChristofferRexen_1 on Aug 29, 2017
Latest reply on Aug 29, 2017 by ChristofferRexen_1

Hey all,

 

Hope you can help me out with this, since I'm having a brain fart over this simple script trigger (On Validation).

 

Two dates:

$dateHired

$dateInput (datePension)

 

Intention is letting the users be notified if they type in a Pensiondate which is earlier than the Hire Date, which would not be possible.

$dateHired ; 01.06.2017

 

Say I then input $datePension ; 01.01.2017, the script trigger would then validate and notify the user.

 

Although, when inserting $datePension ; 01.01.2018, the script ALSO notifies the user that it is not possible -- which of course is possible, since the date is later than 01.06.2017.

 

How come?

 

Set Variable [ $dateHired; Value:Pension_medarbejder::Ansættelsesdato ]

 

Set Variable [ $type; Value:GetValue ( Get ( ScriptParameter ) ; 1 ) ]

Set Variable [ $dateInput; Value:GetValue ( Get ( ScriptParameter ) ; 2 ) ] If [ $type = "Pension" ]

 

If [ IsEmpty ( $dateInput ) ]


If
[ $dateHired > $dateInput ]

 

Show Custom Dialog [ Title: "Advarsel"; Message: "Indtrædelsesdato i Pensionsordning kan ikke være mindre end Ansættelsesdato."; Default Button: “OK”, Commit: “Yes” ]

Set Field [ Pension_medarbejder::Indtrædelsesdato_Pension; "" ]

Go to Field [ Pension_medarbejder::Indtrædelsesdato_Pension ] [ Select/perform ]

 

Else If [ $dateInput > $dateHired ]

 

Show Custom Dialog [ Title: "Advarsel"; Message: "Ost"; Default Button: “OK”, Commit: “Yes” ]

End If

 

End If

Exit Script [ ]

Outcomes