File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Catalog Client Script/Get MRVS Values from Parent Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ function onLoad ( ) {
2
+
3
+ /*
4
+ * work out the parent form based on platform and return the given MRVS data
5
+ * This could go in a global UI script but that wouldn't work for Portal,
6
+ * would love anyone to suggest an alternative for portal :)
7
+ */
8
+ function getMRVSDataFromParent ( mrvsName ) {
9
+ var parent_g_form = g_service_catalog . parent ; // default for backend/platform
10
+ if ( parent . angular ) {
11
+ // this is portal so get a different way
12
+ var parentItem = parent . angular . element ( parent . $ ( '#sc_cat_item' ) . find ( 'sp-variable-layout' ) [ 0 ] ) . scope ( ) ;
13
+ parent_g_form = parentItem . getGlideForm ( ) ;
14
+ }
15
+ var vmData = parent_g_form . getValue ( mrvsName ) ;
16
+ // on portal we get back an empty string rather than an empty array so convert
17
+ return vmData == '' ? [ ] : JSON . parse ( vmData ) ;
18
+ }
19
+
20
+ var vmJSONData = getMRVSDataFromParent ( 'virtual_machine' ) ;
21
+ console . log ( "JSON " + JSON . stringify ( vmJSONData , '' , 3 ) ) ;
22
+ }
Original file line number Diff line number Diff line change
1
+ # Get Multi-row Variable Set Values from parent form
2
+
3
+ Sometimes you need to query the current set of values for a MRVS from the actual MRVS or another MRVS.
4
+ This requires getting the data from the parent form, the method to retrieve and the format of the data is different
5
+ when running on the platform or portal.
6
+
7
+ This script gives a way of getting the values regardless of the platform in use.
8
+
9
+ On the platform (backend) this could be moved to a global UI Script, but that is not available to portal scripts.
10
+
11
+ Make sure the UI Type is All, and Isolate Script is false (unchecked).
You can’t perform that action at this time.
0 commit comments