You can place a Select Window step after the Go To Related Records step to bring a different window to the front.
I tried but couldn't figure out how to assign the layout name from the project file. I tried to use the specify but I got a calculation that I didn't know how to do. I also tried to enter "layout name" ; file name but it didn't work
Select window selects a window name not a layout name. I don't have the business productivity pack so posted an answer based solely on the information in your first post. When using your system, WHen you pull down the windows menu (also check the Show> sub menu) do you see other windows listed? These are the names that select window can specify and thus pop to the front of the other windows.
If you are working with just one file and the script is not selecting the correct layout, then it will help to see more of your script.
From your original post:
goto related rocord [from table: "contacts"; external; using layout<current layout>]
goto relatedrecord[table: "Projects 2"; External;using layout: "form view- projects" (projects)]
The first line doesn't specify a layout by name the way the second one does. That could be a clue.
Also, Go To Related Record can leave you on your original layout if there are no related records to "go to".
Go To Related Records is a very useful tool, but which is very poorly documented. To learn more about GTRR, click the following link:
The Complete Go To Related Record
Thats' the whole script, one line, well now two B/C I addded the select window. but it still doesn't work.
If I understand the syntax of select window is
window name "filename"
do I need the path too if it's in the same path?
For expedience, I let the script go and simply assigned the button to "go to related record" as follows
GTRR [from table:"tasks":using layout:form view]
As I understand it, from prior studying, it's generally a bad idea to have buttons assigned to steps all over your solution in case something changes your stuck trying to locate and change 100 buttons whereas if its in a script you just change the script and you're done. This seems logical.
Why would the direct button setup, as above, work fine but the same syntax in a script not work? is it me?
The default name of a window is it's filename. That may not be the actual name of the window if a script renames a window or uses new window to open a new window for the current file and specifies a different window name. That's why I suggested checking the names listed in the window menu to be sure you are specifying the correct window by name. If this is a window from a different file, make sure you clear the "current file only" option.
"Why would the direct button setup, as above, work fine but the same syntax in a script not work? is it me?"
It's hard to say without examining your files. The only possibility that comes to mind is that the script will behave differently under two circumstances:
- If a different layout is current.
- If there are no matching related records. (This will leave you on the current layout.)
When using Go To Related Records, you should either first check for the presence of related records in the related table or check for error codes immediately after. The link I posted earlier gives you detailed examples of both methods.