Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to create a flow that will create a program with groups and sprints

TashaFletcher
Tera Contributor

Hello, I'm looking for help in creating a flow . I'm trying to create a catalog item with a flow in flow designer that will create a program then attach an already created group then create sprints for that group in servicenow without scripts. I would also like to create subflows to allow the team to use them in other flows.

2 ACCEPTED SOLUTIONS

Vaibhav Chouhan
Tera Guru

You can do this using Flow Designer without scripting by splitting the logic into subflows and then calling them from your main catalog flow.

First, create a subflow that creates the Program record and returns its sys id.

Then create another subflow to link the existing group to that program using the appropriate relationship.

After that, create a subflow to generate sprints where you loop based on the number of sprints and create sprint records linked to the same program and group.

In your main flow triggered from the catalog item, just call these subflows one after another and pass the data between them using data pills. This way, everything stays reusable and clean for future use.

View solution in original post

Naveen20
ServiceNow Employee

Try these

Catalog ItemMain Flow (Service Catalog trigger) → calls 3 Subflows:

  1. Create Program
  2. Attach Group to Program
  3. Create Sprints

Step 1: Catalog Item Variables

Create a catalog item (e.g., "Request New Agile Program") with these variables:

  • program_name (Single Line Text) — Name for the new program
  • program_description (Multi Line Text) — Optional description
  • agile_group (Reference to rm_agile_group or sys_user_group) — Lookup to pick the existing group
  • number_of_sprints (Integer) — How many sprints to create
  • sprint_duration_days (Integer, default 14) — Length of each sprint
  • start_date (Date) — When the first sprint should begin

Step 2: Subflow 1 — "Create Program"

This subflow is reusable anywhere a team needs to programmatically create a program.

Inputs:

  • program_name (String)
  • program_description (String)

Actions:

  1. Create Record on table rm_program
    • Set short_description → drag in program_name input
    • Set description → drag in program_description input
    • Set any other default fields (state, assignment group, etc.)

Outputs:

  • program_record (Reference to the created record) — use the output of the Create Record action (Program Record)
  • program_sys_id (String) — sys_id of the created program

Step 3: Subflow 2 — "Attach Group to Program"

This handles the many-to-many relationship between programs and groups.

Inputs:

  • program_sys_id (String)
  • group_sys_id (String)

Actions:

  1. Create Record on the M2M association table. Depending on your instance version, this is typically m2m_rm_program_rm_agile_group or similar. To find the correct table:

    • Go to an existing program → Groups related list → right-click the header → "Show XML" or check the relationship table name.

    Set fields:

    • rm_program → drag in program_sys_id
    • rm_agile_group → drag in group_sys_id
  2. Alternatively, if there's a direct reference field on the group record pointing to a program, you can use Update Record on rm_agile_group where sys_id = group_sys_id, setting the program field.

Outputs:

  • association_record (Reference)

Step 4: Subflow 3 — "Create Sprints"

This is the most complex subflow — it loops to create multiple sprints with sequential dates.

Inputs:

  • group_sys_id (String)
  • number_of_sprints (Integer)
  • sprint_duration_days (Integer)
  • start_date (Date/Time)

Actions:

  1. For Each (Flow Logic) — this is key. However, since Flow Designer's native "For Each" requires a list, you'll need to build a counter pattern:

    Option A — Use a "1 to N" loop pattern:

    • Use "Repeat" flow logic (available in newer versions). Set the repeat count to number_of_sprints.

    • Inside the loop, for each iteration:

      a. Create Record on rm_sprint:

      • short_description → Use an inline concatenation: Sprint + loop index (you can use the loop item's index pill)
      • groupgroup_sys_id
      • start_date → Calculated: start_date + (loop_index × sprint_duration_days)
      • end_date → Calculated: start_date + ((loop_index + 1) × sprint_duration_days)
      • state → Default (e.g., "Planning" or "Not Started")

    Option B — If "Repeat" isn't available, use a workaround:

    • Before calling this subflow, create a helper subflow that uses "Look Up Records" on a utility table with known row counts, limited to number_of_sprints, then pass that list to a "For Each" to iterate.
  2. Date Calculations Without Scripts:

    • Flow Designer has Date/Time pills and transforms. When you drag in a date pill, you can use the "Add Duration" transform to add days.
    • For each iteration: start_date pill → Transform → Add Durationsprint_duration_days × iteration index

Outputs:

  • sprints_created (Integer) — count of sprints created

Step 5: Main Flow — "Provision Agile Program"

Trigger: Service Catalog

Actions (in order):

  1. Call Subflow: "Create Program"

    • program_nameTrigger - Catalog Item → Variables → program_name
    • program_descriptionTrigger → Variables → program_description
  2. Call Subflow: "Attach Group to Program"

    • program_sys_id → Output from Step 1 (program_sys_id)
    • group_sys_idTrigger → Variables → agile_group (sys_id)
  3. Call Subflow: "Create Sprints"

    • group_sys_idTrigger → Variables → agile_group
    • number_of_sprintsTrigger → Variables → number_of_sprints
    • sprint_duration_daysTrigger → Variables → sprint_duration_days
    • start_dateTrigger → Variables → start_date
  4. Update Catalog Task / RITM — set state to closed complete

View solution in original post

4 REPLIES 4

Vaibhav Chouhan
Tera Guru

You can do this using Flow Designer without scripting by splitting the logic into subflows and then calling them from your main catalog flow.

First, create a subflow that creates the Program record and returns its sys id.

Then create another subflow to link the existing group to that program using the appropriate relationship.

After that, create a subflow to generate sprints where you loop based on the number of sprints and create sprint records linked to the same program and group.

In your main flow triggered from the catalog item, just call these subflows one after another and pass the data between them using data pills. This way, everything stays reusable and clean for future use.

Thank you so much

Naveen20
ServiceNow Employee

Try these

Catalog ItemMain Flow (Service Catalog trigger) → calls 3 Subflows:

  1. Create Program
  2. Attach Group to Program
  3. Create Sprints

Step 1: Catalog Item Variables

Create a catalog item (e.g., "Request New Agile Program") with these variables:

  • program_name (Single Line Text) — Name for the new program
  • program_description (Multi Line Text) — Optional description
  • agile_group (Reference to rm_agile_group or sys_user_group) — Lookup to pick the existing group
  • number_of_sprints (Integer) — How many sprints to create
  • sprint_duration_days (Integer, default 14) — Length of each sprint
  • start_date (Date) — When the first sprint should begin

Step 2: Subflow 1 — "Create Program"

This subflow is reusable anywhere a team needs to programmatically create a program.

Inputs:

  • program_name (String)
  • program_description (String)

Actions:

  1. Create Record on table rm_program
    • Set short_description → drag in program_name input
    • Set description → drag in program_description input
    • Set any other default fields (state, assignment group, etc.)

Outputs:

  • program_record (Reference to the created record) — use the output of the Create Record action (Program Record)
  • program_sys_id (String) — sys_id of the created program

Step 3: Subflow 2 — "Attach Group to Program"

This handles the many-to-many relationship between programs and groups.

Inputs:

  • program_sys_id (String)
  • group_sys_id (String)

Actions:

  1. Create Record on the M2M association table. Depending on your instance version, this is typically m2m_rm_program_rm_agile_group or similar. To find the correct table:

    • Go to an existing program → Groups related list → right-click the header → "Show XML" or check the relationship table name.

    Set fields:

    • rm_program → drag in program_sys_id
    • rm_agile_group → drag in group_sys_id
  2. Alternatively, if there's a direct reference field on the group record pointing to a program, you can use Update Record on rm_agile_group where sys_id = group_sys_id, setting the program field.

Outputs:

  • association_record (Reference)

Step 4: Subflow 3 — "Create Sprints"

This is the most complex subflow — it loops to create multiple sprints with sequential dates.

Inputs:

  • group_sys_id (String)
  • number_of_sprints (Integer)
  • sprint_duration_days (Integer)
  • start_date (Date/Time)

Actions:

  1. For Each (Flow Logic) — this is key. However, since Flow Designer's native "For Each" requires a list, you'll need to build a counter pattern:

    Option A — Use a "1 to N" loop pattern:

    • Use "Repeat" flow logic (available in newer versions). Set the repeat count to number_of_sprints.

    • Inside the loop, for each iteration:

      a. Create Record on rm_sprint:

      • short_description → Use an inline concatenation: Sprint + loop index (you can use the loop item's index pill)
      • groupgroup_sys_id
      • start_date → Calculated: start_date + (loop_index × sprint_duration_days)
      • end_date → Calculated: start_date + ((loop_index + 1) × sprint_duration_days)
      • state → Default (e.g., "Planning" or "Not Started")

    Option B — If "Repeat" isn't available, use a workaround:

    • Before calling this subflow, create a helper subflow that uses "Look Up Records" on a utility table with known row counts, limited to number_of_sprints, then pass that list to a "For Each" to iterate.
  2. Date Calculations Without Scripts:

    • Flow Designer has Date/Time pills and transforms. When you drag in a date pill, you can use the "Add Duration" transform to add days.
    • For each iteration: start_date pill → Transform → Add Durationsprint_duration_days × iteration index

Outputs:

  • sprints_created (Integer) — count of sprints created

Step 5: Main Flow — "Provision Agile Program"

Trigger: Service Catalog

Actions (in order):

  1. Call Subflow: "Create Program"

    • program_nameTrigger - Catalog Item → Variables → program_name
    • program_descriptionTrigger → Variables → program_description
  2. Call Subflow: "Attach Group to Program"

    • program_sys_id → Output from Step 1 (program_sys_id)
    • group_sys_idTrigger → Variables → agile_group (sys_id)
  3. Call Subflow: "Create Sprints"

    • group_sys_idTrigger → Variables → agile_group
    • number_of_sprintsTrigger → Variables → number_of_sprints
    • sprint_duration_daysTrigger → Variables → sprint_duration_days
    • start_dateTrigger → Variables → start_date
  4. Update Catalog Task / RITM — set state to closed complete

TashaFletcher
Tera Contributor

Thank you so much, this was very helpful.