/salesforce-canvas-sync

SFDX project for syncing Salesforce data to Canvas. Note: this project was developed in 2019 and as of 2022 is not currently supported.

Primary LanguageApex

Canvas Sync SFDX App

This Salesforce app contains functionality to help manage courses, users and enrollments in Canvas.

NOTE: This project was developed in 2019 and as of 2022 is not currently supported.

Installation (DRAFT)

Prerequisites:

  • Install the sfdx command-line tool
  • Have a Salesforce Dev org set up (Go to https://developer.salesforce.com/signup if you don't have one)
  • In the Salesforce UI, enable 'Dev Hub' slider in the browser under the Development -> Dev Hub menu options
  • Authenticate the CLI tool to your Dev Hub org:
sfdx force:auth:web:login -d -a DevHub

Steps:

  • [Review this step: Set the default user name:
[sfdx force:config:set defaultdevhubusername=<username>]
[sfdx force:config:set defaultusername=<myscratchorg>]
  • Check out this project from GitHub
  • From the project directory, create a new scratch org:
sfdx force:org:create -s -f config/project-scratch-def.json -a <new scratch org name>
  • From the project directory, push the code into your scratch org:
sfdx force:source:push
  • Open the scratch org:
sfdx force:org:open

After installing this package in your Salesforce org, set up the custom settings: Canvas URL, sub-account ID, and API token.

Resources

  • sObjects:
    • CanvasUser__c: represents a user account in Canvas
    • CanvasCourse__c: represents a Canvas course
    • CanvasEnrollment__c: represents an enrollment in a Canvas course; links CanvasUser__c and CanvasCourse__c
  • Triggers:
    • syncUserToCanvas
    • syncCourseToCanvas
    • syncEnrollmentToCanvas
  • Apex classes:
    • CanvasClient: provides some methods that are called by the above triggers which make the actual API calls to Canvas.

Configuration

This package defines a custom settings object that includes several parameters that must be configured before the sync will work properly:

  • API Gateway Base URL and API Gateway Key: these are used to create and update User records in Canvas; values will be supplied by HUIT.
  • Base URL and token: These are used for calls that go directly to the Canvas API. The Base URL should point to a Canvas instance, and end in a slash. The token can be generated by an administrator of the relevant Canvas sub-account.
  • Sub-account ID: The numeric ID of the Canvas sub-account where courses should be created. Note that if you are using Blueprints, the Blueprint source course must be placed in this sub-account or a parent.