4 Replies Latest reply on Jan 10, 2013 10:19 AM by Varndawl

    Script to enter specific value into a field

    Varndawl

      Title

      Script to enter specific value into a field

      Post

           Can I script a button to enter a specific value from a value list into a field?

           I have a field that auto-enters the creation acct name (which is the same as a list of values called Employees), but I need my employees to be able to change the info in that field to "Manager" without having full access to that field and it's value list. (I don't want them to be able to move records to another employee.)

           So my thought was I could make that field "view only" and then script a button (with full access privileges) to change the contents of that field to "Manager".

           Is this possible? Or is there a better/easier way?

           THANKS!

        • 1. Re: Script to enter specific value into a field
          philmodjunk

               You don't even need to use "run with full access privileges" if you are using a layout setting to deny access to the field.

               Set Field [Table::FieldYouWantToModify ; Table::DropDownListField ]

               This functions at the data level after using the layout to determine which record to modify. The "FieldYouWantToModify" does not even have to be present on the layout.

               Note: When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

          • 2. Re: Script to enter specific value into a field
            Varndawl

                 I think I'm missing something, or maybe I didn't explain clearly enough.

                 I have a field with a drop down box that contains employee names:
                 John Smith
                 Jack Smith
                 Jane Smith
                 MANAGER

                 John Smith can only see records when this Employee field contains "John Smith". He is not able to change this field. View only. So I want a button next to that field that says "Archive" that will remove that record from his list and move it to MANAGER. So essentially what I'm doing is changing the value of that field to MANAGER. Almost like a "Replace Field Contents With..."

                 I tried the Set Field script above, but in specifying the calculation, I don't see how I can force it to choose MANAGER specifically.

            • 3. Re: Script to enter specific value into a field
              philmodjunk

                   use "manager" in quotes as the calculated result.

                   Set Field [Table::dropdownField ; "MANAGER"]

                   I am assuming that "Manager" is the value in the drop down field, not some corresponding ID number.

                   And if you are using record level access controls in Manage | Security to limit the field to view only, you DO then need the "Run with full access privileges" option.

              • 4. Re: Script to enter specific value into a field
                Varndawl

                     QUOTES! I was trying to make this way more complicated than it was. :) THANKS PHIL!