Last active
October 31, 2020 13:23
-
-
Save sachi-d/df62baa33d0cf687a432590634c33767 to your computer and use it in GitHub Desktop.
Apex code stub for Enrolments class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Enrolments { | |
@InvocableMethod(label='Get Enrolments' description='Iterate over students, classes and payments and create junction records') | |
public static List<EnrolmentsResult> createEnrolments(List<EnrolmentsRequest> request){ | |
//parse inputs and variables | |
List<Account> students = request.get(0).students; | |
List<Class__c> classes = request.get(0).classes; | |
List<Payment__c> payments = request.get(0).payments; | |
List<Enrolment__c> enrolments = new List<Enrolment__c>(); | |
List<String> unenroledStudents = new List<String>(); | |
//start of logic | |
//end of logic | |
//parse outputs | |
EnrolmentsResult result = new EnrolmentsResult(); | |
result.enrolments = enrolments; | |
result.unenroledStudents = unenroledStudents; | |
List<EnrolmentsResult> resultList = new List<EnrolmentsResult>(); | |
resultList.add(result); | |
return resultList; | |
} | |
public class EnrolmentsRequest{ | |
@InvocableVariable | |
public List<Account> students; | |
@InvocableVariable | |
public List<Class__c> classes; | |
@InvocableVariable | |
public List<Payment__c> payments; | |
} | |
public class EnrolmentsResult{ | |
@InvocableVariable | |
public List<Enrolment__c> enrolments; | |
@InvocableVariable | |
public List<String> unenroledStudents; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment