catalog scripts to work on 2 variables set or more
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 01:40 AM
this is my issue I had as per below.
1. I have created 2 variables set.
2. Variable set A has a Variable (requested_for).
3. Variable set B has a Variable (approver_manager).
I would like to know if a catalog script is possible to check as per below scenario.
1. the requester type the name in Variable Set A inside Variable (requested_for).
2. when the requester types the name of Variable Set B inside Variable (approver_manager) the catalog scripts must check Variable Set A (requested_for) first, if found the same name it will prompt an error message, if found not the same name it will not show any error message.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2023 04:12 AM - edited 01-06-2023 04:17 AM
When you write a Catalog Client Script that applies to the Catalog Item, there is no difference or limitations to accessing or triggering on a variable if it is defined in the Catalog Item or within a (single row) Variable Set. If your Catalog Item does not have any variables defined in it, only multiple (single row) variable sets, a Catalog Client Script (or Catalog UI Policy) can be written the same way as if some or all of the variables were defined in the Catalog Item.
So yes, you can create an onChange Catalog Client Script that Applies to the Catalog Item when the approver_manager variable changes to simply get the value of requested_for and compare them to see if they are equal, assuming both variables are of the same type. I would also recommend clearing the variable value when the error message is displayed so that the request/form cannot be submitted when both names are the same. Once you have this working you would also want a similar script when requested_for changes as a user is likely to populate and change variables in any order.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2023 06:28 AM
Yes it's Possible as I am having two variable set one for Requested for & Second for Date.
So I have used Script Include to Check the Field of Requested For Variable Set Field User is Contractor & if it returns true then I am setting Date Field as Mandatory which is from Second Variable set attaching screenshot for further reference.
Note : This is Similar to parent child relationship as a single Catalog item has 2 Variable set and we can access the child(Variable Set) from parent(Catalog Item) but vice versa is not possible.
Please let me know if anything more is required on same.
Thanks & Regards
Bhushan