US English (US)
ES Spanish

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Log in
English (US)
US English (US)
ES Spanish
  • Home
  • Help & Support
  • Support
  • Deep Dive
  • Technical Guides
  • RIO Ed Components

Course Versioning - Clone Course Version

rio_ed.REDU_CloneCourseVersion_FLOW

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • RIO Certification
    RIO Certification Program RIO Academy RIO Challenge RIO Recipe Training
  • Releases
    V3 Release Notes V4 Release Notes
  • Help & Support
    Install RIO Education RIO Insights RIO Recipe Support RIO Graduate/Intern Program Trainee (GPT)
  • Experience RIO in action
  • RIO Insights
+ More

Table of Contents

Overview Flow Flow

Overview

This invocable flow method allows users to create a new Course version by cloning some or all of the details from a previous Course version.

Flow

This invocable method — "Clone Course Version" — is designed to be used within Salesforce Flow to create a new Course record based on an existing Course record.

Process:

This method can do the following:

  1. Create a new Course record:
    1. Status = Draft
    2. Version = null
    3. All other fields are either:
      1. All fields are cloned directly from the provided last course version OR
      2. Taken from the populated fields on the New Course Version Record parameter.
  2. Optionally create a new Course Header, or link to the same Course Header as the last course version
  3. Optionally clone child records from the last course version:
    1. Course Requirements
    2. Grade Criteria
    3. Qualified Faculty
    4. Course Attribute
    5. Course Learning Outcomes
    6. Learning Outcome Mappings

Parameters to Be Passed (Flow Inputs): 

The method accepts a list of input values. Each input must contain the following fields:

  • Last Course Version Id
    • (Type: Text)
    • The source Course version record to clone from. Required when cloning an existing course/version.
  • New Course Version Record
    • (Type: Course record)
    • A partially populated Course record used as the target values for the new cloned Course Version.
  • Clone As
    • (Type: Text, Required)
    • Determines the cloning behavior. Supported values: newCourse, newVersion.
  • Create or Link Header
    • (Type: Boolean)
    • Determines whether a Course Header should be created or linked during the cloning process.
  • Clone Child Records
    • (Type: Boolean)
    • Determines whether related child records should also be cloned.

Each set of these inputs will be processed together. Multiple sets can be passed in one Flow execution.

Response Returned (Flow Outputs): 

For each input set, the method will return a corresponding output with the following fields:

  • Clone course version response status
    • (Type: Text)
    • Execution status e.g., success or fail.
  • Clone course version response message
    • (Type: Text)
    • A message providing additional information, such as error details if the process failed.
  • Course version id
    • (Type: Text)
    • The id of the newly created course version record.
  • Course header id
    • (Type: Text)
    • The id of the newly created course header or existing course id (if one exists).

Usage Tips: 

  • This method can be used in any kind of flow ( Screen flow, Record-triggered flow, Schedule-Triggered Flow, …)
  • If a request fails, the message field will provide a cleaned-up error message for easier troubleshooting.

Flow

For a custom Apex class, we could use the same method exposed from the Flow Invocable Method.

Parameters to Pass:

  • List<rio_ed.REDU_CloneCourseversion_FLOW.Request> requests
    • A list of request objects, each containing the following fields:
      • lastCourseVersionId
        • (Type: Id)
        • The source Course version record to clone from. Required when cloning an existing course/version.
      • newCourseVersionRecord
        • (Type: hed__Course__c record)
        • A partially populated Course record used as the target values for the new cloned Course Version.
      • cloneAs
        • (Type: String, Required)
        • Determines the cloning behavior. Supported values: newCourse, newVersion.
      • createOrLinkHeader
        • (Type: Boolean)
        • Determines whether a Course Header should be created or linked during the cloning process.
      • cloneChildRecords
        • (Type: Boolean)
        • Determines whether related child records should also be cloned.

Return Type:

  • List<rio_ed.REDU_CloneCourseVersion.Response>
    • A list of response objects, each containing:
      • status
        • (Type: Text)
        • Execution status e.g., success or fail.
      • message
        • (Type: Text)
        • A message providing additional information, such as error details if the process failed.
      • courseVersionId
        • (Type: Text)
        • The id of the newly created course version record.
      • courseHeaderId
        • (Type: Text)
        • The id of the newly created course header or existing course id (if one exists).

Sample Code:

// Example: Clone Course Version as a new version
Id lastCourseVersionId = 'XXXXXXXXXXXXXXX'; // Replace with a valid Course Id

// (Optional) Build the new course version record with overrides
hed__Course__c newCourseVersionRecord = new hed__Course__c();
newCourseVersionRecord.Name = 'Business Analytics';
newCourseVersionRecord.hed__Account__c = 'XXXXXXXXXXXXXXX'; // Replace with a valid University Department Id
// ...

// Build request
rio_ed.REDU_CloneCourseVersion_FLOW.Request req = new rio_ed.REDU_CloneCourseVersion_FLOW.Request();
req.lastCourseVersionId = lastCourseVersionId;
req.newCourseVersionRecord = newCourseVersionRecord; // Optional: skip this to clone all fields from the original Course
req.cloneAs = 'newVersion';
req.createOrLinkHeader = true;
req.cloneChild = false;

List<rio_ed.REDU_CloneCourseVersion_FLOW.Request> requestList = new List<rio_ed.REDU_CloneCourseVersion_FLOW.Request>{ req };

// Call the invocable method
List<rio_ed.REDU_CloneCourseVersion_FLOW.Response> responseList =
    rio_ed.REDU_CloneCourseVersion_FLOW.cloneCourseVersion(requestList);

// Process responses
for (rio_ed.REDU_CloneCourseVersion_FLOW.Response res : responseList) {
    System.debug('Status: ' + res.status);
    System.debug('Message: ' + res.message);
    System.debug('New Course Version Id: ' + res.courseVersionId);
    System.debug('Course Header Id: ' + res.courseHeaderId);
}

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • RIO Ed - Display Student Connections (Aura)
  • RIO Ed - Appointment Scheduler (Aura)
  • RIO Ed - Attendance Register (Aura)
  • RIO Ed - File Uploader (Aura)
  • RIO Ed - Related List - Single (Aura)
RIO Education

RIO Education, a WDCi Company. This information is proprietary, confidential and protected by copyright ©2024.

CONTACT

Get in touch

  • Privacy
  • Terms of service

Knowledge Base Software powered by Helpjuice

Definition by Author

0
0
Expand