Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Utpal Dutta
Tera Guru
Tera Guru

Hello fellow community members,

I've noticed a recurring question in the community: "How can we create multiple instances of a Requested Item, each with different variable values, all within a single request?" Think of it like a shopping cart experienceβ€”you add multiple items, then check out once.

 

Today, I'm sharing a powerful solution to achieve exactly that.

 

The Problem Statement

A user needs to submit multiple, distinct issues. Each submission has an Action, an Issue Type, and a unique Issue ID. The system should then generate a separate Requested Item (RITM) for each submission.

  • If a user submits multiple issues with the same Action and Issue Type, the system should create multiple RITMs for the same catalog item, but each RITM should contain the different Issue ID.
  • All these RITMs must be consolidated under a single Request (REQ) for easy tracking.

 

Why the OOB Approach Falls Short

At first glance, an Order Guide seems like a good fit. It can certainly trigger different catalog items based on user input. However, its main limitation is that it cannot generate multiple instances of the same catalog item within a single submission. This is the key blocker for our use case.

 

 

The Solution: A Modern Approach πŸ’‘

We can solve this by combining a few powerful platform features: a Record Producer, a Multi-Row Variable Set (MRVS), and a Flow Designer Subflow that leverages the Cart API.

Here’s the high-level workflow:

  1. Capture Data: The user enters multiple issues into an MRVS on a Record Producer form.
  2. Process Rows: After submission, a Subflow is triggered. It takes the MRVS data as input and iterates through each row.
  3. Build the Cart: For each row, the Subflow uses the CartJS API to add the corresponding catalog item to a new shopping cart.
  4. Place the Order: Once all items are in the cart, the Subflow places the order, generating a single REQ with multiple RITMs.
  5. Redirect User: The Subflow returns the new REQ's details to the Record Producer, which then redirects the user to their request summary page.

 

Step-by-Step Implementation Guide

 

Step 1: Create the User Interface

  • Create a Record Producer: This will be the entry point for your users.
  • Create a Multi-Row Variable Set (MRVS): Add all the common variables that your catalog items will need (e.g., action, issue_type, issue_id).
  • Add the MRVS to the Record Producer: This allows the user to add as many rows (issues) as they need.

Step 2: Build the Logic Engine with a Subflow βš™οΈ

Create a Subflow in Flow Designer. This is where the magic happens!

  • Input: Define a Subflow input of type JSON to receive the MRVS data from the Record Producer.

 

Screenshot 2025-10-25 at 10.23.31β€―PM.pngScreenshot 2025-10-25 at 10.23.44β€―PM.pngScreenshot 2025-10-25 at 10.24.04β€―PM.png

 

  • Action: Add Items to Cart:
    • Inside the Subflow, add a custom action step. This action will parse the input JSON and loop through each row.
    • For each row, use the sn_sc.CartJS API to create a new cart and add items to it. This gives you full control over which catalog item to order and what variables to populate for each RITM.

 

Screenshot 2025-10-25 at 10.21.23β€―PM.pngScreenshot 2025-10-25 at 10.21.40β€―PM.pngScreenshot 2025-10-25 at 10.21.55β€―PM.png

 

  • Action: Order cart: Once all the items have been added to the cart then order it using a custom action.

 

Screenshot 2025-10-25 at 10.24.23β€―PM.pngScreenshot 2025-10-25 at 10.24.39β€―PM.pngScreenshot 2025-10-25 at 10.24.49β€―PM.png

 

  • Output: Define a Subflow output (e.g., request_details) to return the generated REQ number and sys_id as a JSON string.

 

Screenshot 2025-10-25 at 10.41.08β€―PM.png



Step 3: Connect the Producer to the Subflow

  • Navigate to your Record Producer's configuration and open the Script section.
  • In this server-side script, call the Subflow you created using sn_fd.FlowAPI.executeSubflow() OR use just copy paste subflow code snippet.
  • Capture the output from the Subflow and use it to build a redirect URL, sending the user directly to their newly created request.

 

Screenshot 2025-10-25 at 10.31.03β€―PM.pngScreenshot 2025-10-25 at 10.31.15β€―PM.pngScreenshot 2025-10-25 at 10.31.48β€―PM.png



And that's it! You've successfully created a seamless, scalable, and user-friendly bulk-ordering system. πŸ‘

 

Comments
TejasSN_LogicX
Tera Contributor

Great post! πŸ‘
This is a very clear and well-thought-out solution to a common challenge in catalog design.

Version history
Last update:
a week ago
Updated by:
Contributors