script to go to a record based on the account name
I am trying to write a script that will Get( AccountName ), then look for a record with that account name in a specific field, then go to that record.
How do I do this? Thanks!
Thanks for the additional information.
In order to search for special characters (@, #, $, etc.), you need to precede it with a backslash (\). For example, if the username is email@example.com, the find would need to be a\@b.com. Therefore, change the second line of the script as follows:
Set Error Capture [On]
Set Variable [ $name; Substitute (Get ( AccountName ) ; "@" ; "\@" ) ]
Enter Find Mode 
Set Field [ < field you want to search> ; $name ]
Perform Find 
If [ Get (FoundCount) = 0 ]
Show Custom Dialog [ "Warning" ; "No Records Found" ]
Set Error Capture [Off]
You should now be able to find the full email address.
Thank you for your post.
One way to do this in a script is as follows:
Set Variable [ $name; Get ( AccountName ) ]
Set Field [ <field you want to search> ; $name ]
First, we set the error capture "on". I'll explain this later... Next, we grab the AccountName and put it into the variable $name. Then, we enter Find mode and put the contents of the variable $name into the field you want to search and perform the find. This is where the error capture comes in. If no records are found, an alert usually comes up. The error capture captures this message and displays "No Records Found". Otherwise, the found records are displayed and we turn the error capture to off.
This should get you pointed in the right direction. If you need clarification for any of the steps above, please let me know.
Well, it's not quite working yet. Before I would always go to the first record, now with this new script, I am getting no records.. which doesn't make sense if it is truly doing a find.
Each AccountName is in a field that is in a record. What could I be missing?
Well, I'm not sure where the problem lies. Pull down the Records menu and select "Modify Last Find". This will show you the contents of $name in the field you are searching. Is this what you would normally enter?
What I've found to work sometimes instead of using Substitute() to escape specific symbols, is to use the Quote() function when setting a search field. The Quote() function escapes special characters appropriately.
Enter Find Mode Set Field [ < field you want to search> ; Quote( SomeTable::UserEnteredTextField ) ]Perform Find 
I am having a similar problem with Get ( AccountName ).
At present I have just the one computer but I have set up three accounts: Admin, User, [Guest]. I was expecting Get ( AccountName ) to return a different account name depending on which user I logged in as but it will only return "admin". What am I doing wrong.
Retrieving data ...