2 Replies Latest reply on Nov 5, 2015 8:08 AM by cocolia42

    Scripting in IWP

    cocolia42

      Hi all,

      I have a client using FM12. They have their users connecting via IWP. I have 2 buttons on a layout that run scripts that are virtually identical.

      One button is for adding users who have permission to view a record. The other button is for adding users who do not have permission to view a record.

      Literally, the only difference in the scripts is the table/layout where the new record is being created.

      Everything works fine from within FileMaker. But when I use IWP, the button that allows users works while the button that blocks users does not. I get to the point where I select a user to block, but the blocked user record is not being created.

      I've double checked everything. The tables, the fields, the layouts, the scripts, the button set ups, the security settings.

      Obviously I'm missing something. Any suggestions?

      Here are the script being used:

       

      Script: CaseAddAllowedUser

      Set Error Capture [On]

      Set Variable [$CaseID; Value:Case::kp_caseID]

      Perform Script ["PeoplePicker"]

      Set Variable [$UserID; Value:Get(ScriptResult)]

      If [$UserID <> ""]

      Go to Layout ["CaseAllowedUsers" (CaseAllowedUsers)]

      New Record/Request

      Set Field [Case::g_CaseScreen; Get(CurrentPrivilegeSetName)]

      Set Field [CaseAllowedUsers::_kf_PeopleID; $UserID]

      Set Field [CaseAllowedUsers::_kf_CaseID; $CaseID]

      Go to Layout [original layout]

      Go to Object [Object Name: "Admin"]

      End If

       

      Script: CaseAddBlockedUser

      Set Error Capture [On]

      Set Variable [$CaseID; Value:Case::kp_caseID]

      Perform Script ["PeoplePicker"]

      Set Variable [$UserID; Value:Get(ScriptResult)]

      If [$UserID <> ""]

      Go to Layout ["CaseBlockedUsers" (CaseBlockedUsers)]

      New Record/Request

      Set Field [Case::g_CaseScreen; Get(CurrentPrivilegeSetName)]

      Set Field [CaseBlockedUsers::_kf_PeopleID; $UserID]

      Set Field [CaseBlockedUsers::_kf_CaseID; $CaseID]

      Go to Layout [original layout]

      Go to Object [Object Name: "Admin"]

      End If

       

      Script: PeoplePicker

      New Window [Name: "Choose User"; Style: Document]

      Go to Layout ["People_Picker] (People)]

      Show All Records

      Show Omitted Only

      Loop

      Pause/Resume Script [Indefinitely]

      Set Variable [$Action; Value:Get(ScriptResult)]

      If [$Action ="Choose"]

      Set Variable [$UserID; Value:People::kp_peopleID]

      Exit Loop If [1]

      Else If [$Action = "Cancel"]

      Exit Loop If [1]

      End If

      End Loop

      Close Window [Current Window]

      Exit Script [Result: $UserID]