3 Replies Latest reply on Feb 16, 2012 9:54 AM by philmodjunk

    Delete Account With Script



      Delete Account With Script


      Trying to use this script to delete account that only have a active = to No


      The script I have is


      Go to layout [("Tecnician")]

      Enter Find Mode[]

      Set Field [Teschnician::Active = "No" & Get (AccountName)]

      Delete Account [Acount name:Get(AccountName)]


      But what it does is delete the account I signed in on.


      I want is to delete the account that has the [Active] field listed at [No]

      Technician::Active = "No" 


      I will use a button to activate the script.



        • 1. Re: Delete Account With Script

          Set Field [Teschnician::Active = "No" & Get (AccountName)]

          isn't valid syntax for a set field step. I am guessing that you have two set field steps like this:

          Set Field [Technician::Active ; "No"]
          Set Field [Technician::AcountName ; Get (AccountName)"]

          If so, then you should remove the second set field step so that you aren't specifying your account name in the find. Then your next step would be:

          Delete Account [Technician::AccountName]

          • 2. Re: Delete Account With Script

            Thanks for you help but it did not work when I click on the button it just went to the technician page


            This how I re-wrote the script


            Go to layout ["Technician" ("Tecnician")]

            Enter Find Mode[]

            Set Field [Technician::Active; "No"]

            Delete Account [Acount Name:Technician::UserName]

            Perfon Find[]


            What I want to do is delete all accounts with a Active = No

            in the security section of FM


            So that user can no longer log in.

            • 3. Re: Delete Account With Script

              Perform Find should take place bofore Delete Account.

              Note that your script will then delete a single account. If you have multiple users flagged as no longer active, you'll need to put a loop in place after performing the find that loops through your records deleting accounts for each one. This script also leaves the technician records in place. Once you get the basics working here, you'll need to modify this set up so that you don't keep finding and deleting the same inactive technician's account over and over again.