Thank you for your post!
For the first issue, you might find Get(ActiveLayoutObjectName) useful. If not, you might include the script you are working with.
However, after the script is executed, the username randomly jumps to another username in the drop-down list.
-Can you give us some more information on what's happening in this script?(maybe a screenshot?)
-Is the Value List hardcoded or based off of another Table?
I thought about Get(ActiveLayoutObjectName) too, but not sure where to put it.
Do I create a separate script and set it up as script trigger as OnObjectEnter for the popover?
Then insert this script into the main script?
I can post a screenshot later today.
I believe the Value List is hard coded.
It isn't global fields.
You could either put GetActiveLayoutObjectName in your parameter expression to pass it as a script parameter or use set variable to assign this object name to a variable at the beginning of the script.
I want this to be a generic script, so I'm going to try the first option tonight.
It would be generic with either approach as you are not specifying anything data or layout specific with this expression in either case.
For the 2nd method, is it like this: set variable: $button; GetActiveLayoutObjectName ?
Then: go to object: $button
If there is any code that might change the focus to a different layout object between the start of the script and go to object, yes. If there is no such possibility, you can use GetActiveLayoutObjectName as the Go to object parameter.
But note that in the second case, either approach works.
Also note that if you are doing this because your script needs to modify data/create records in a different table and you are changing layouts to do so, this is not necessary. It is possible to create/edit records in a different table without changing layouts if you employ the MagicKey method. This then keeps your popover open without the need to use go to object to re-open it.
You need the set variable step that is currently disabled in your script. And you must use the inspector to assign an object name to the popover panel (not the button).
Nevertheless, you need it.
What do you do to run this script?
The action that performs the script, (mouse click, keystroke...) may be changing the focus before you can capture the object name in the script.
And there are much simpler and better ways to create a record in a related table.
Apologies, I should have realized that the rules for what gets the focus after a mouse click are the same for buttons and popover buttons: Neither get the focus from a mouse click. My tests show that neither the button nor the panel becomes an active object from clicking the popover button.
Either you work out the way to get the object name of a field inside the popover (going to it will re-open the popover) or use something like the Magickey method to create the related records without having to change layouts.
If I specify the object name in the GoToObject:, then the popover panel opens.
Will it work if I place a button over the popover button?
Get(ActiveLayoutObjectName) of the button and pass it as parameter.
I'm not sure if Magic Key is work for my case.
As I said before, clicking a button does not make the button the active layout object.
If you set up a relationship that matches by service ID or use ExecuteSQL, you can access the needed data without changing layouts and performing a find. You can then use MagicKey to create the new portal record without going to a portal row.