Certificates of Achievement

Certificates of Achievement for successfully completing courses in ecLearn is possible with some customization work. The following document will describe how to create a usable certificate of achievement using a Microsoft Word template and a Power Automate Flow.

The Certificate Template

Any Microsoft Word document will do. The important part of creating the template is setting up Content Controls. Download the sample certificate template for an example of how to use content controls in a certificate.

The attached template includes three content controls:

  1. FULL NAME
  2. COURSE NAME
  3. DATE

These controls will have their content replaced with appropriate values based on the Learner and Course completed.

Once the certificate has been created, you can upload it to a course in the Certificate Template field.

Power Automate Flow

In order to create the final Certificate of Completion for the Learner, each Word template will require a custom Power Automate Flow. Every template will contain different parameters, so for every different template you will need to create a specific flow that will follow the steps:

  1. Trigger “When a row is added, modified or deleted” on Course Attempts
  2. Check the Course Attempt result
  3. Get the Course Registration record
  4. Get the Learner record
  5. Download the certificate template
  6. Temporarily upload the certificate template to OneDrive
  7. Populate the template with values from the Course, Learner, and Course Registration
  8. Temporarily upload the completed certificate to OneDrive
  9. Convert the file to PDF
  10. Upload the completed certificate PDF to the Course Registration record
  11. Delete the temporary certificate template from OneDrive
  12. Delete the temporary completed certificate from OneDrive

Trigger “When a row is added, modified or deleted”

Set up the Dataverse trigger with the following values:

PropertyValue
Change TypeAdded or Modified
Table NameCourse Attempts
ScopeOrganization
Select columnsec_result

Check the Course Attempt result

Add a Condition where the Course Attempt Result is equal to “Pass”. If you wish to use multiple certificates for different courses, you may also need additional conditions to ensure that the flow only progresses for courses with the intended certificate for this flow.

Add all remaining steps to the “If yes” condition.

Get the Course Registration record

Add a Dataverse “Get a row by ID” step to retrieve the Course Registration record for the affected Course Attempt:

PropertyValueDescription
Table nameCourse Registrations
Row ID@{triggerOutputs()?[‘body/_ec_courseregistrationid_value’]}Dynamically select the Course Registration ID from the Course Attempt in the trigger step

Get the Learner record

Add a Dataverse “Get a row by ID” step to retrieve the Learner record for the previously retrieved Course Registration:

PropertyValueDescription
Table nameLearners
Row ID@{outputs(‘Get_Course_Registration_Record’)?[‘body/_ec_learner_value’]}Dynamically select the Learner ID from the Course Registration selected in the previous step

Download the certificate template

Add a Dataverse “Download a file or image” step to download the certificate from the Course record for the previously retrieved Course Registration:

PropertyValueDescription
Table nameCourses
Row ID@{outputs(‘Get_Course_Registration_Record’)?[‘body/_ec_courseid_value’]}Dynamically select the Course ID from the Course Registration selected in a previous step
Column nameCertificate Template

Temporarily upload the certificate template to OneDrive

For this step, you will need a OneDrive location. In the example below, we have created a folder at the path “/Documents/Uploads” for this purpose.

Add a OneDrive for Business “Create file” step:

PropertyValueDescription
Folder Path/Documents/Uploads
File Namecourse_@{outputs(‘Get_Course_Registration_Record’)?[‘body/_ec_courseid_value’]}_template.docxCreate a custom file name for the file to avoid name collisions. In this case, we use the Course Registration ID to ensure a unique file name.
File Content@{body(‘Download_Template’)}Dynamically select the Body from the previous download step.

Populate the template with values from the Course, Learner, and Course Registration

Add a Word Online (Business) “Populate a Microsoft Word template” step:

PropertyValueDescription
LocationOneDrive for Business
Document LibraryOneDrive
File/Documents/Uploads/course_@{outputs(‘Get_Course_Registration_Record’)?[‘body/_ec_courseid_value’]}_template.docxCombine the Folder Path and File Name from the previous step to dynamically construct the path/name of the file to be populated
dynamicFileSchema{
  “1300799527”: @{outputs(‘Get_Learner_Record’)?[‘body/ec_name’]},
  “-616060284”: @{outputs(‘Get_Course_Registration_Record’)?[‘body/ec_name’]},
  “-1556692127”: @{triggerOutputs()?[‘body/ec_completedon’]}
}
See notes below for how to retrieve the content control ID values.

The “dynamicFileSchema” values here are the hardest part of the process. Unfortunately, it is not possible to retrieve the numerical IDs for the content controls in your template, so for each template you will need to discover these individually using the following steps:

  1. Upload the template to a OneDrive location
  2. Create a temporary Word Online (Business) “Populate a Microsoft Word template” step:
PropertyValueDescription
LocationOneDrive for Business
Document LibraryOneDrive
File/Documents/Uploads/CERTIFICATE OF COMPLETION.docxManually select the uploaded certificate template.
Full Name@{outputs(‘Get_Learner_Record’)?[‘body/ec_name’]}This is the “Full Name” content control. Select the dynamic Learner “Name” value
Course Name@{outputs(‘Get_Course_Registration_Record’)?[‘body/ec_name’]}This is the “Course Name” content control. Select the dynamic Course Registration “Name” value
Date@{triggerOutputs()?[‘body/ec_completedon’]}This is the “Date” content control. Select the dynamic Course Access “Completed On” value
  1. With the values selected for the step, use the step’s kebab menu (…) and select “Peek code”
  1. Find the values labeled like “dynamicFileSchema/1300799527” and copy them. For example, in the example we have set up, there are three values like this:
  1. Use the IDs revealed in this step to construct the “dynamicFileSchema” values. For example, the step:
    “dynamicFileSchema/1300799527”:
    “@outputs(‘Get_Learner_Record’)?[‘body/ec_name’]”
    Should be converted to :
    “1300799527”: @{outputs(‘Get_Learner_Record’)?[‘body/ec_name’]}
    The full value in this case will be:
    {
    “1300799527”: @{outputs(‘Get_Learner_Record’)?[‘body/ec_name’]},
    “-616060284”: @{outputs(‘Get_Course_Registration_Record’)?[‘body/ec_name’]},
    “-1556692127”: @{triggerOutputs()?[‘body/ec_completedon’]}
    }
  1. Enter this final value, including the curly braces (“{“, “}”) in the dynamicFileSchema field for the dynamic “Populate a Microsoft Word template” step.
  2. Delete this temporary step.

Temporarily upload the completed certificate to OneDrive

Add a OneDrive for Business “Create file” step:

PropertyValueDescription
Folder Path/Documents/Uploads
File Nameattempt_@{triggerOutputs()?[‘body/ec_courseattemptid’]}_certificate.docxCreate a custom file name for the file to avoid name collisions. In this case, we use the Course Attempt ID to ensure a unique file name.
File Content@{body(‘Populate_Template’)}Dynamically select the Body from the previous template population step.

Convert the file to PDF

Add a OneDrive for Business “Convert file” step:

PropertyValueDescription
File@{outputs(‘Upload_Populated_Document_To_OneDrive’)?[‘body/Id’]}Dynamically select the file created in the previous step.
Target typePDF

Upload the completed certificate PDF to the Course Registration record

Create a Dataverse “Upload a file or an image” step:

PropertyValueDescription
Table nameCourse Attempts
Row ID@{triggerOutputs()?[‘body/ec_courseattemptid’]}Dynamically select the row ID from the trigger step
Column nameCertificate
Content@{body(‘Convert_file’)}Dynamically select the body of the previous file conversion step
Content nameCertificate.pdf

Delete the temporary certificate template from OneDrive

Add a OneDrive for Business “Delete file” step:

PropertyValueDescription
File@outputs{(‘Upload_Template_To_OneDrive’)?[‘body/Id’]}Dynamically select the temporarily uploaded template file

Delete the temporary completed certificate from OneDrive

Add a OneDrive for Business “Delete file” step:

PropertyValueDescription
File@outputs{(‘Upload_Populated_Document_To_OneDrive ‘)?[‘body/Id’]}Dynamically select the temporarily uploaded populated file

Test the Flow

To test the flow, simply register for a course with an uploaded certificate, then take the course and complete it with a passing grade.

The flow will run, and after a few moments, the completed certificate will be added and attached to the Course Attempt record in the “Certificate” field. If you download the completed certificate, you will see the Full Name, Course Name, and Date fields filled with appropriate dynamic values.

Back to top