Skip to content

Instantly share code, notes, and snippets.

@gsherman
Created May 3, 2017 15:45
Show Gist options
  • Save gsherman/656a2c1e6aa48a5e06b98c1850ceb14f to your computer and use it in GitHub Desktop.
Save gsherman/656a2c1e6aa48a5e06b98c1850ceb14f to your computer and use it in GitHub Desktop.
ClearBasic code to allow a new option (such as SMS) as a valid Notification Preference within the Clarify Classic Client
' Form 703 - Employee form
'
' Allow a new option (such as SMS) as a valid Notification Preference
Option Explicit
Dim normalBizHigh As String
Dim normalBizMid As String
Dim normalBizLow As String
Dim afterBizHigh As String
Dim afterBizMid As String
Dim afterBizLow As String
Sub SetModuleVariables()
Dim recEmployee As record
Set recEmployee = cobj_EMPLOYEE.Contents
normalBizHigh = recEmployee.GetField("normal_biz_high")
normalBizMid = recEmployee.GetField("normal_biz_mid")
normalBizLow = recEmployee.GetField("normal_biz_low")
afterBizHigh = recEmployee.GetField("after_biz_high")
afterBizMid = recEmployee.GetField("after_biz_mid")
afterBizLow = recEmployee.GetField("after_biz_low")
End Sub
Sub form_load()
Me.DoDefault
Call SetModuleVariables
End Sub
Sub Form_Save1(bs As BulkSave)
Dim recEmployee As Record
Set recEmployee = bs.GetRecordByIndex (0, "employee")
recEmployee.SetField "normal_biz_high", normalBizHigh
recEmployee.SetField "normal_biz_mid", normalBizMid
recEmployee.SetField "normal_biz_low", normalBizLow
recEmployee.SetField "after_biz_high", afterBizHigh
recEmployee.SetField "after_biz_mid", afterBizMid
recEmployee.SetField "after_biz_low", afterBizLow
End Sub
Public Sub Message(ByVal num As Long, ByVal info As String)
'MsgBox "employee form received message " & cstr(num) & " with info of: " & info
Select Case num
Case cbFirstMessage + 1
normalBizHigh = info
Case cbFirstMessage + 2
normalBizMid = info
Case cbFirstMessage + 3
normalBizLow = info
Case cbFirstMessage + 4
afterBizHigh = info
Case cbFirstMessage + 5
afterBizMid = info
Case cbFirstMessage + 6
afterBizLow = info
Case cbCloseMessage
Me.Close cbCloseChildren
Case Else
Me.DoDefault
End Select
End Sub
' Form 707 - Employee 2 of 2
' Employee Form - More Info
'
' Allow a new option (such as SMS) as a valid Notification Preference
Option Explicit
Const NormalBusinessHours As String = "Normal Business Hours"
Dim normalBizHigh As String
Dim normalBizMid As String
Dim normalBizLow As String
Dim afterBizHigh As String
Dim afterBizMid As String
Dim afterBizLow As String
Sub SetHighMediumLowDropDowns()
If Cobj_BIZ_HRS.Contents = NormalBusinessHours Then
High_pri.Value = normalBizHigh
Med_pri.Value = normalBizMid
Low_pri.Value = normalBizLow
Else
High_pri.Value = afterBizHigh
Med_pri.Value = afterBizMid
Low_pri.Value = afterBizLow
End If
End Sub
Sub SetModuleVariables()
Dim recEmployee As record
Set recEmployee = cobj_EMPLOYEE.Contents
normalBizHigh = recEmployee.GetField("normal_biz_high")
normalBizMid = recEmployee.GetField("normal_biz_mid")
normalBizLow = recEmployee.GetField("normal_biz_low")
afterBizHigh = recEmployee.GetField("after_biz_high")
afterBizMid = recEmployee.GetField("after_biz_mid")
afterBizLow = recEmployee.GetField("after_biz_low")
End Sub
Sub form_load()
Me.DoDefault
Call SetModuleVariables
Call SetHighMediumLowDropDowns
End Sub
Sub form_activate()
Me.DoDefault
Call SetModuleVariables
Call SetHighMediumLowDropDowns
End Sub
Sub BUS_HRS_Click()
Call SetHighMediumLowDropDowns
End Sub
Sub High_PRI_Click()
Me.DoDefault
If BUS_HRS.Value = NormalBusinessHours Then
Me.NotifyParent cbFirstMessage+1,High_pri.Value
Else
Me.NotifyParent cbFirstMessage+4,High_pri.Value
End If
End Sub
Sub Med_PRI_Click()
Me.DoDefault
If BUS_HRS.Value = NormalBusinessHours Then
Me.NotifyParent cbFirstMessage+2,Med_pri.Value
Else
Me.NotifyParent cbFirstMessage+5,Med_pri.Value
End If
End Sub
Sub Low_PRI_Click()
Me.DoDefault
If BUS_HRS.Value = NormalBusinessHours Then
Me.NotifyParent cbFirstMessage+3,Low_pri.Value
Else
Me.NotifyParent cbFirstMessage+6,Low_pri.Value
End If
End Sub
' Form 721 - Preferences for
' Desktop - Setup - My Preferences
'
' Allow a new option (such as SMS) as a valid Notification Preference
Option Explicit
Const NormalBusinessHours As String = "Normal Business Hours"
Dim normalBizHigh As String
Dim normalBizMid As String
Dim normalBizLow As String
Dim afterBizHigh As String
Dim afterBizMid As String
Dim afterBizLow As String
Sub SetHighMediumLowDropDowns()
If Cobj_BIZ_HRS.Contents = NormalBusinessHours Then
High_pri.Value = normalBizHigh
Med_pri.Value = normalBizMid
Low_pri.Value = normalBizLow
Else
High_pri.Value = afterBizHigh
Med_pri.Value = afterBizMid
Low_pri.Value = afterBizLow
End If
End Sub
Sub SetModuleVariables()
Dim recEmployee As record
Set recEmployee = cobj_EMPLOYEE.Contents
normalBizHigh = recEmployee.GetField("normal_biz_high")
normalBizMid = recEmployee.GetField("normal_biz_mid")
normalBizLow = recEmployee.GetField("normal_biz_low")
afterBizHigh = recEmployee.GetField("after_biz_high")
afterBizMid = recEmployee.GetField("after_biz_mid")
afterBizLow = recEmployee.GetField("after_biz_low")
End Sub
Sub form_load()
Me.DoDefault
Call SetModuleVariables
Call SetHighMediumLowDropDowns
End Sub
Sub BUS_HRS_Click()
Call SetHighMediumLowDropDowns
End Sub
Sub High_PRI_Click()
Me.DoDefault
If BUS_HRS.Value = NormalBusinessHours Then
normalBizHigh = High_pri.Value
Else
afterBizHigh = High_pri.Value
End If
End Sub
Sub Med_PRI_Click()
Me.DoDefault
If BUS_HRS.Value = NormalBusinessHours Then
normalBizMid = Med_pri.Value
Else
afterBizMid = Med_pri.Value
End If
End Sub
Sub Low_PRI_Click()
Me.DoDefault
If BUS_HRS.Value = NormalBusinessHours Then
normalBizLow = Low_pri.Value
Else
afterBizLow = Low_pri.Value
End If
End Sub
Sub Form_Save1(bs As BulkSave)
Dim recEmployee As Record
Set recEmployee = bs.GetRecordByIndex (0, "employee")
recEmployee.SetField "normal_biz_high", normalBizHigh
recEmployee.SetField "normal_biz_mid", normalBizMid
recEmployee.SetField "normal_biz_low", normalBizLow
recEmployee.SetField "after_biz_high", afterBizHigh
recEmployee.SetField "after_biz_mid", afterBizMid
recEmployee.SetField "after_biz_low", afterBizLow
End Sub
@gsherman
Copy link
Author

Also remember to add SMS as an option to all of the static lists in forms 707 and 721.
You can do this using UI Editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment