- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2024 09:13 AM
Hello,
We have a catalog request where someone can request services for one or many users. The catch is that all users have to have the same manager.
I have a multi Row variable set that has 1 variable that reference the sys_user table "user". Goal: for the first row all the users should be selectable. When the user makes the second selection, the sys_user table should filter to match only users with the same manager of the first row.
Here is what I have done:
We create a second variable in the MRVs called "active manger". We use an onload Catalog Client script to set the "active manager" by passing in the MRV as a whole using
Simplified Question:
Is there a mechanism that I can save the results of an onLoad client script and then access it in a ref Qualifier on a variable?
Note something we could not figure out, is we could not pass the MRVs as a whole into the Reference qualifier of the user variable:
Ex: javascript: new <script include>().getUsers(g_service_catalog.parent.getValue("<mrv set name>"));
g_service_catalog was undefined
I hope I am as clear as I can be.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2024 10:38 AM
Good work. Unfortunately you've run up against a few current limitations in the design of the MRVS. A few years/releases ago g_service_catalog was introduced as a way to get values from the parent form to use in the MRVS, but the reference qualifier remains outside of this due to the current.variables notation to pass a variable value to a Script Include. Also as you have discovered, hiding the MRVS variable through any means only hides it in the add/edit dialog window.
Something to try in your scenario that may just work is to set the value of the user variable in your onLoad script to the manager of the user from row 1, then use that variable in the reference qualifier. It will either not work due to the timing - the reference qualifier runs before the onLoad finishes, or maybe the list will be filtered correctly, but the manager's name still populated - even though that user wouldn't be one of the valid choices, or maybe the list will be filtered and the value cleared?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2024 10:38 AM
Good work. Unfortunately you've run up against a few current limitations in the design of the MRVS. A few years/releases ago g_service_catalog was introduced as a way to get values from the parent form to use in the MRVS, but the reference qualifier remains outside of this due to the current.variables notation to pass a variable value to a Script Include. Also as you have discovered, hiding the MRVS variable through any means only hides it in the add/edit dialog window.
Something to try in your scenario that may just work is to set the value of the user variable in your onLoad script to the manager of the user from row 1, then use that variable in the reference qualifier. It will either not work due to the timing - the reference qualifier runs before the onLoad finishes, or maybe the list will be filtered correctly, but the manager's name still populated - even though that user wouldn't be one of the valid choices, or maybe the list will be filtered and the value cleared?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 07:57 AM
I took some time to read this after I found my own workaround with session, but this works. The down side is that I have to show a manager field in the MRVs tables but I was doing that anyways. At least now I don't have to have an extra column for active manager.
After reading you suggestion, I reflected and this is just so clever. What would make this even better if Catalog variables had a dependent field like this do for platform variables. Then you can just set the manager field with an onload and then an auto filter would be applied to the user field.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 07:31 AM
Just an update to anyone that reads this. Another way to pass data from an onload script to a reference qualifier on a variable is to use the Session.
In the Script include:
...
var session = gs.getSession();
session.putClientData("active_manager", "bob");
...
in the Ref Qaulifier
session.getClientData('active_manager');
In the onload script you can make an AJAX call to a script include to set the value in the session and then in the reference qualifier you can read the session. Obvious down side is that if you have two entities that interact with the same session variable at the same time, they will overwrite the session value in certain timings.