1 2 Previous Next 18 Replies Latest reply on Jan 18, 2010 12:38 PM by johnhorner

    User defined script not working.

    CarrieB.

      Title

      User defined script not working.

      Post

      I have a button that I only want a couple of people to have access to pushing. In another table, I had the same issue and created the script to first [Get (PrivilegeSetName)] and it worked great. I tried the same thing in another database and it won't work. It works for me, as the full access user, but not for the other privilege set, that is not full access. The only difference with this one, is that the action is deleting a portal row. I've tried making the script run with full access privileges, but that didn't work either. Could it be related to the fact that it is deleting a portal row? 

       

      I truly appreciate all the help everyone gives here in this forum! I'm lost without you!! =) 

        • 1. Re: User defined script not working.
          TSGal

          CarrieB.:

           

          Thank you for your post.

           

          You can either specify the script to evaluate the PrivilegeSetName or AccountName.  That is,

           

          If [ Get ( PrivilegeSetName ) = <privilege name> or Get ( AccountName ) = <specific account name> ]

             Delete Portal Row [ No dialog ]

          End If

           

          That way, if a user or privilege name matches, the portal row can be deleted.

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: User defined script not working.
            CarrieB.
               I tried both those options and neither work. I can't figure it out. I'm gonna go try again and see if I am missing something ....
            • 3. Re: User defined script not working.
              CarrieB.
                

              After further testing ... it doesn't seem to want to work on users that are not full access, even if I check the "run with full access privileges" box. 

               

              Any ideas? 

              • 4. Re: User defined script not working.
                etripoli
                   Post your script?
                • 5. Re: User defined script not working.
                  CarrieB.
                    

                  If [Get ( AccountName ) = "username1" or Get ( AccountName ) = "username2"]

                     Delete Portal Row []

                  End If 

                   

                   

                   

                  The second user has full access privileges and it works for them, but not for the first user. I've tried many different combinations and can't get it to work.

                   

                  ?? 

                  • 6. Re: User defined script not working.
                    TSGal

                    CarrieB.:

                     

                    If it isn't working for the first user, then change your script to as follows:

                     

                    Set Error Capture [On]

                    If [ Get ( AccountName ) = "username1" or Get ( AccountName ) = "username2" ]

                       Delete Portal Row []

                       Set Field [ <any field in the current table> ; <any field in the current table> & Get ( LastError ) ]

                    End If

                     

                     

                    This will put the LastError encountered at the end of one of your fields.  You can then look iup the error code and determine what is the problem.

                     

                    TSGal

                    FileMaker, Inc. 

                    • 7. Re: User defined script not working.
                      CarrieB.
                        

                      Tried that, but it didn't work. I still get the same error message that user1 doesn't have access privileges to perform the action, and my field wasn't modified with the last error. 

                       

                      Still lost ..... 

                      • 8. Re: User defined script not working.
                        TSGal

                        CarrieB.

                         

                        I would like to see the file so I can determine what is causing the error.  I have sent you a private message (top of this page - right side - X Messages) with instructions where to send the file.

                         

                        TSGal

                        FileMaker, Inc. 

                        • 9. Re: User defined script not working.
                          CarrieB.
                            

                          I finally figured it out! It's so simple .... I forgot to check "allow deletion of portal rows" in the portal. Oops! Works fine now.

                           

                          Although, maybe you could help me with something else. I put a little red x icon in the portal row to allow the deletion of rows, almost exactly like the one in the Contact Management template that comes standard with FileMaker. Although, in my portal, there is always a red x in the last row (that isn't a record). Or, if there are no records, the top portal row has a red x in it, even though it is empty. I notice that it doesn't do that in the Contact Management template, but I cannot figure out why. My settings look the same as the ones in the template. Any ideas??

                           

                          Thanks!!

                          • 10. Re: User defined script not working.
                            philmodjunk
                              

                            If your "x" is text, you can use conditional formatting to hide or fade it out on the last row.

                             

                            Your conditional format expression might read:

                             

                            isempty(portaltable:: portalkeyfield)

                             

                            Then select a text color matching the background of your portal to make it invisible or a text color that fades it out to provide a "disabled button" look.

                            • 11. Re: User defined script not working.
                              CarrieB.
                                

                              It's not text. It's an image I took from the Contact Management template. Just wondering how they got theirs to not show up until there was a record in the portal.

                               

                              I could try the text route though ....

                              • 12. Re: User defined script not working.
                                philmodjunk
                                  

                                If you store your image in a container field you can set up a calculation field that returns type container.

                                 

                                If ( not isempty ( Portaltable:: Portalkeyfield ) ; table::containerfield ; "" )

                                 

                                Make this field your delete portal row button.

                                • 13. Re: User defined script not working.
                                  CarrieB.
                                    

                                  Thanks. Think I'll just go with the text route. Works fine.

                                   

                                  Thanks again everyone for all your help here!

                                  • 14. Re: User defined script not working.
                                    johnhorner
                                      

                                    phil, i had a follow up question on your method for alternately hiding or showing a container field on the last (empty) portal row.  i tried incorporating your calculation but for some reason it is always evaluating the key field as not empty and therefore placing the contents of the global container field into the calculated container (there is alway a red "x" in the empty row).  my situation may be somewhat complicated by the fact that the portal is what i think you call a "sef-join" relationship meaning that i have a to do table on which the main layout resides and then a few portals to show "active" items, "completed" items, and "all" items.  so i wrote the calculation as follows:

                                     

                                    If(IsEmpty(TO_DO_Active::Status) ; "" ; RedX_G)

                                     

                                    can you tell me what i am doing wrong?  i thought maybe because i noticed that i didn;t use the "not" isempty method but flipped the results but i tried it the other way and it was the same (which makes me wonder why you add theseemingly extra "not" isempty instead of writing it the way i had it.

                                     

                                    any help would be greatly appreciated.  thanks in advance.

                                    1 2 Previous Next