- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 07:35 AM
Hello all,
I would like to know how can I populate an embedded list. For example, in the following image, all fields of the form (request form) can be populated with a mapping between user's selections and table's fields. However, there is no any option for making a mapping between a record producer's option and a column of an embedded list.
In my case, I want once a user selects an item on Service Portal, this item is populated and appears on the embedded list of the record.
I guess it needs advanced scripting techniques, but since I don't have them your assistance would be incredibly valuable for me.
Thank you in advance for your time and your willingness to help me.
Best regards,
Smith.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 01:46 PM
To use the cart functionality - test with one catalog item you can pick from the record producer.
1. Add a new variable to the catalog item
- Type: Reference
- Table: sc_request
2. Add a UI Policy to hide the variable on load
3. In the BR you have in the REQ table, replace the code with this:
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem(current.u_cat_item);
cart.setVarible(item, 'request', current.sys_id);
var rc = cart.placeOrder();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 01:21 PM
You're very welcome! 🙂 Let me know how it turns out!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 01:25 AM
The embedded list is populated.
However the workflow is not triggered. It seems that the first stage of the workflow is done, but I don't understand why the next stages are not triggered.
You can't imagine how grateful I feel for your assistance!! Really thank you for all the time that you spent on this thread trying to figure out my logic and provide me a solution!!
I hope you could help me also trigger the workflow.
Thank you again and again.
Regards,
Smith.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 05:05 AM
Here is also an image that maybe will help you understand what's going on. The workflow is not triggered for this item (even if I have a workflow attached on this item).
I don't know what's going on.
Even if all the stages are just a log message activity, they are not triggered.
Maybe I need to try the option with the cart that you said, but to be honest I didn't understand it.
If we could find again a solution to this, I would be so grateful for your help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 01:07 PM
Hi Smith,
Sorry for the late response on this! I was afraid that would happen. Did you add the ritm.setWorkflow(true); after the insert on the BR? It should look like this:
var cat = current.u_cat_item; //catalog item selected
var ritm = new GlideRecord('sc_req_item');
ritm.initialize();
ritm.request = current.sys_id; //associate the REQ to the RITM
ritm.quantity = '1';
ritm.item = cat; //populate Item with the user's selection
ritm.insert();
ritm.setWorkflow(true);
gs.log("RITM Inserted: " + ritm);
Give that a try and let me know if it works. If it still has issues starting the workflow, then we can go the cart route. We'll work through it 🙂
Yeny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2020 01:46 PM
To use the cart functionality - test with one catalog item you can pick from the record producer.
1. Add a new variable to the catalog item
- Type: Reference
- Table: sc_request
2. Add a UI Policy to hide the variable on load
3. In the BR you have in the REQ table, replace the code with this:
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem(current.u_cat_item);
cart.setVarible(item, 'request', current.sys_id);
var rc = cart.placeOrder();