- 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 07:45 AM
Hi Smith,
you can have these records created via after insert BR of your parent table.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 07:52 AM
Hello Ankur,
in my case.. how could I make this BR look like? I don't understand how can I get the user's input on Service Portal (for example on the field Item) and make it available to the Business Rule, so the embedded list to be populated.
Do I need to write a script for that?
If you could assist me on this, I would be so grateful!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 08:12 AM
Until this point I got it, but how can I refer to this variable from a script. So, I want to make it a dynamic script, that populates the Item value with a user's selection.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 08:16 AM
Hi Smith,
if your BR is on sc_req_item table then you can access the RITM's variable using syntax below
current.variables.<variableName>
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader