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 - Approve Course Version

rio_ed.REDU_ApproveCourseVersion_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 approve a draft Course version, promoting it to become the new latest version of the Course.

Flow

This invocable method — "Approve Course Version" — is designed to be used within Salesforce Flow to update a draft Course record to become either a new Active course or the new latest version of a Course.

Process:

This method will do the following:

  1. Update a Course record:
    1. Status = [Chosen Status]
    2. Version = Latest previous version + 1, or 1
    3. Latest = true
    4. Optionally update extra fields:
      1. Taken from the populated fields on the Course Version Record parameter.
  2. Create a new Course Header, or link to a specified Course Header

Parameters to Be Passed (Flow Inputs): 

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

  • Approve As
    • (Type: Text, Required)
    • Determines the approval behavior. Supported values: newCourse, newVersion.
  • Existing Course Header Id
    • (Type: Text)
    • Existing Course Header record to associate with the approved Course Version. Required when approveAs = newVersion.
  • Course Version Id
    • (Type: Text, Required)
    • The Course version record to be approved.
  • Course Version Record
    • (Type: Course record)
    • A partially populated Course record used to update Course Version fields during the approval process.
  • Course Status
    • (Type: Text, Required)
    • The status value to assign to the approved Course Version.

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:

  • Approve course version response status
    • (Type: Text)
    • Execution status e.g., success or fail.
  • Approve 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).
  • Version number
    • (Type: Number)
    • The approved course version number.

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.
  • We recommend setting the status to ‘Active’ for approved Courses.
  • If you instead want to reject a draft Course, you should just set the status to “Rejected” directly in the flow, instead of calling this invocable method.

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_ApproveCourseVersion_FLOW.Request> requests
    • A list of request objects, each containing the following fields:
      • approveAs
        • (Type: String, Required)
        • Determines the approval behavior. Supported values: newCourse, newVersion.
      • existingCourseHeaderId
        • (Type: Id)
        • Existing Course Header record to associate with the approved Course Version. Required when approveAs = newVersion.
      • courseVersionId
        • (Type: Id, Required)
        • The Course version record to be approved.
      • courseVersionRecord
        • (Type: hed__Course__c record)
        • A partially populated Course record used to update Course Version fields during the approval process.
      • courseStatus
        • (Type: String, Required)
        • The status value to assign to the approved Course Version.

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).
      • versionNumber
        • (Type: Decimal)
        • The approved course version number.

Sample Code:

// Example: Approve Course Version as a new version (links to an existing Course Header)
Id courseVersionId = 'XXXXXXXXXXXXXXX'; // Replace with a valid Course Version Id
Id existingCourseHeaderId = 'XXXXXXXXXXXXXXX'; // Replace with a valid Course Header Id


// (Optional) Build a course version record with field overrides applied during approval
hed__Course__c courseVersionRecord = new hed__Course__c();
courseVersionRecord.Name = 'Business Analytics';
courseVersionRecord.hed__Course_ID__c = 'BUS101';
// ...

rio_ed.REDU_ApproveCourseVersion_FLOW.Request req = new rio_ed.REDU_ApproveCourseVersion_FLOW.Request();
req.courseVersionId = courseVersionId;
req.approveAs = 'newVersion';
req.existingCourseHeaderId = existingCourseHeaderId;
req.courseVersionRecord = courseVersionRecord; // Optional: skip this to leave fields unchanged
req.courseStatus = 'Active';

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

List<rio_ed.REDU_ApproveCourseVersion_FLOW.Response> responseList =
    rio_ed.REDU_ApproveCourseVersion_FLOW.approveCourseVersion(requestList);

for (rio_ed.REDU_ApproveCourseVersion_FLOW.Response res : responseList) {
    System.debug('Status: ' + res.status);
    System.debug('Message: ' + res.message);
    System.debug('Approved Course Version Id: ' + res.courseVersionId);
    System.debug('Course Header Id: ' + res.courseHeaderId);
    System.debug('Version Number: ' + res.versionNumber);
}

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