1 of 1 people found this helpful
I guess you're picking the "0" since you are in the parent but since you don't share what you're doing I'm completely in the dark...
Anyway, one way to get the information you need even from a parent would be to try and use:
That will return an array with the existing child windowID (s).
Since it could return several IDs, you would have to test which one is good. For this you can do some tests, testing a field "type" on a field you know exists on the form you're working on, like:
If it returns "0" it means the field doesn't exist for this "test_window" value, so just continue with the next windowID until you find a correct "type".
For a character field for example it should reply "4".
So I guess the way to do it is to loop through the values until you find the correct windowID. You would do that once in your script to get the correct windowID and then use this value in the rest of your script.
This way you wouldn't be dependent on where the field is.
Did you have some time to try?
However, I still have a problem with getting the current windowID.getLogicalChildWindowIDs doesn't return anything. I am able to get a list of all windowIDs and thought that maybe the last ID would be the current one, but unfortunately that's not always the case.
Do you know any reliable methods of determining the current windowID? Also, when I try to just retrieve the "windowID" the console returns that there is no such variable. I would be grateful for any tips.
I was thinking about just looping through all available windowIDs, but I'm worried that this might override incident data that's just hidden (or cached) while saving the incident I'm actually trying to edit. I also want to be efficient and looping through all fields just doesn't look that appealing.
I think it happened to me once as well...
I ended up doing a loop and testing if the field existed. This way it's kinda fast since you only test if one specific field exist
Then you get your windowID and use it in your code.
The problem is the same when you try to get a ViewField ID, it's not exactly like other fields...
I've found a workaround, although it's not perfect.
This will return the windowID I need, but first any field in the currently opened form needs to be clicked.
I found out some old code I used last year, at the time I was just traversing the div objects, and it was very fast.
To force a focus maybe you could do an active link that does a focus on a field?
What I use in a run process (in an active link):
Sorry, i haven't explain very much, the appropiate window id can obtained with getCurrentWindowID_NS() if the flow is fired by the window where contain your field.