2 Replies Latest reply on Feb 10, 2012 10:41 AM by user14040

    Username Script Help

    user14040

      Title

      Username Script Help

      Post

      Hi

      I need to be able to have a user log in and it goes to a layout and shows their information on the layout.  I found this script but I need for someone to login and the script knows who logged in.  The script below you have to enter the name I tried removing the name and just using the field name (If [Get(AccountName)="Technician::UserName"])  but when it does a search it shows a error saying The provided find criteria is not valid.  Enter a valid request before proceeding.

       

      Any help would be appreciated.  Below is the original script  (the Else If in the script i am not using because i am using two layouts (Main Interface & technician layout).

      ORIGINAL SCRIPT

      Go to Layout ["Welcome layout"] 

      Pause/Resume Script [Duration (seconds); 3]

      If [Get( AccountName )= "Lynn"] 

           Go to Layout ["Simple layout"]

      Else If [Get( AccountName )="Ann"]

           Go to Layout ["Complex layout"]

      End If

      Enter Find Mode[]

      Insert Calculated Result [Select; "Sales::temp user name";

      Get( AccountName )]

      Perform Find[]

       

      SCRIPT I AM USING

       

      Go to Layout ["Main Interface"]

      Pause/Resume Script [Duration (seconds); 3]

      If [Get( AccountName )= "Technician::UserName"]

           Go to Layout ["Technician"]

      End If

      Enter Find Mode[]

      Insert Calculated Result [Select; "Technician::UserName";

      Get( AccountName )]

      Perform Find[]

       

      Thanks

        • 1. Re: Username Script Help
          philmodjunk

          Get( AccountName )= "Technician::UserName"

          compares the current AccountName such as "Fred" to the literal text "Technician::UserName" instead of the text stored in the username field. So you need to remove the quotes for start. Also, this script assumes that you are automatically on the correct record for "Fred". You might have a dozen records, one for each user and this If test will not return true unless the current record happens to have the matching data.

          If the if step does not return True, you don't go to the layout for Technician and this may keep Insert Calculated from putting any value in your field, which will produce the error message you report.

          I think you need this script:

          Go to Layout ["Technician"]

          Enter Find Mode[]

          Set Field [Technician::UserName ; Get ( AccountName ) ]

          Perform Find[]

          (I used set field instead of Insert calculated. Insert steps require that the field receiveing the inserted data be physically present on the current layout. Set field steps do not have this limitation.)

          • 2. Re: Username Script Help
            user14040

            Thank you it worked perfectly