- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 07:34 AM
Dear all,
I have implemented a workflow logic attached to a catalog item to collect the variables of a requested item (I call it parent) and use them to open a new request/requested item (child) and "copy" the variables to the new REQITM.
This works perfect with sn_sc.CartJS and I can fill the variables in the new child REQITM as long as they are standard text.
But now I have a reference field in my parent and also in my child.
I can pick the sys_id of the selected value from the reference field in the parent.
But the reference in the child stays empty.
I create the variable set as you see below:
// my_switch is the reference variable of the parent REQITM and has the sys_id
// which_switch_child is the refernce variable in the child REQITM
var cart = new sn_sc.CartJS();
cart.empty();
var my_variables = {"var1":my_variable1,"var2":my_variable2,"which_switch_child":my_switch};
var request = {
'sysparm_id': cat_item,
'sysparm_quantity': quantity,
'sysparm_requested_for': myID,
'variables': my_variables
};
cart.addToCart(request);
var checkoutInfo = cart.checkoutCart();
...
Do you have an idea?
Many thanks
Best regards
Eckhard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 11:51 AM
From the information you've provided, there shouldn't be an issue. I would triple check spelling/spacing on the variable name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 11:21 AM
How are you getting the sys_id? I'm pretty sure if you just get the value of the source variable, that is the sys_id. Or are you trying another way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 11:44 AM
I get the sys_id with current.variables.[variable_name] and it is definitely there. I checked it with gs.warn. I saw the correct sys_id in the log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2022 11:51 AM
From the information you've provided, there shouldn't be an issue. I would triple check spelling/spacing on the variable name.