If you modify the first line of your script to read: (Substitute your portal's table occurrence name for the literal text)
If [ DayOfWeek ( GetField ( "YourPortalTableOccurrence::" & Get ( ActiveFieldName ) ) ) = 1 ]
It will work. GetField will attempt to return the value of a field from your layout's table occurrence not the portal's table occurrence unless you specify a different table occurrence name.
If you want to use the same script with different fields, pass the name of the field as a parameter instead of using get (ActiveFieldName)
Parameter expression: GetFieldName (Yourtable::YourField)
First line of your script would then be: If [ DayOfWeek ( GetField ( Get ( ScriptParameter ) ) ) = 1 ]