-
30. Re: Re: javascript or jquery help with bmc remedy
Laurent MatheoAug 25, 2014 4:54 AM (in response to lior tencher)
1 of 1 people found this helpfulI 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:
getLogicalChildWindowIDs()
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:
F(test_window,123456789).G().type
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.
-
31. Re: javascript or jquery help with bmc remedy
Laurent MatheoAug 28, 2014 4:26 AM (in response to Laurent Matheo)
Hi
Did you have some time to try?
-
32. Re: javascript or jquery help with bmc remedy
Kevin Kucharczyk Sep 30, 2014 12:40 PM (in response to Laurent Matheo)Hey, I had the same problem with populating incident fields via JavaScript and your tip to use the built-in S function helped me immensely.
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.
Thanks again!
-
33. Re: javascript or jquery help with bmc remedy
Laurent MatheoOct 2, 2014 2:25 PM (in response to Kevin Kucharczyk)
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...
-
34. Re: Re: javascript or jquery help with bmc remedy
Kevin Kucharczyk Oct 3, 2014 4:48 AM (in response to Laurent Matheo)I've found a workaround, although it's not perfect.
FocusMgr.mCurFocusWindowID
This will return the windowID I need, but first any field in the currently opened form needs to be clicked.
-
35. Re: javascript or jquery help with bmc remedy
Laurent MatheoOct 5, 2014 6:47 AM (in response to Kevin Kucharczyk)
I see.
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?
-
36. Re: javascript or jquery help with bmc remedy
Juan Jose Martinez Parra Feb 16, 2016 9:26 AM (in response to lior tencher)What I use in a run process (in an active link):
javascript: ARACTSetMenu(getCurrentWindowID_NS(), $col_dvh_FieldID$ , "$col_dvh_MenuValue$")
-
37. Re: javascript or jquery help with bmc remedy
Juan Jose Martinez Parra Feb 16, 2016 9:29 AM (in response to Juan Jose Martinez Parra)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.