AnsweredAssumed Answered

Help to set up script for delete button in Portal...

Question asked by hanstrager on Jan 4, 2013
Latest reply on Jan 5, 2013 by philmodjunk


Help to set up script for delete button in Portal...


     I have a portal, where I have button that adds records into the portal. I've tried to make a button that will delete a record in the portal. I've been lucky enough to get some help allready with some script that should be attached to a button and it should delete a record, but it dosen't seem to work for me, im quite new to filemaker, and scripting is absolutely not my strong side... Help please... the script is as follows, and I have activated "allow deletion of portal records" in the portal setup:

     Set Variable [ $RowExists; Value:GetValue ( Get ( ScriptParameter ) ; 1 ) ]
     Set Variable [ $Label; Value:GetValue ( Get ( ScriptParameter ) ; 2 ) ]
     If [ $RowExists ]
     #Highlight the portal row to be deleted.
     Go to Portal Row [ Get ( ActivePortalRowNumber ) ]
     [ Select; No dialog ]
     #Confirm that button was not clicked by mistake.
     Show Custom Dialog [ Title: "Confirm Row #" & Get ( ActivePortalRowNumber ) & " Deletion"; Message: "Delete " & $Label
     & "?"; Buttons: “Cancel”, “OK” ]
     If [ Get ( LastMessageChoice ) = 2 /* OK was clicked */ ]
     Delete Portal Row
     [ No dialog ]
     #Commit releases the focus from the portal row so that it no longer is highlighted.
     Commit Records/Requests
     End If
     End If
     #Created by Phil Caulkins