The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
We're a really big institution. We have 20+ campuses, each with their locations, all operating as a single institution. A need was identified to be able to record a student's home campus and provide it to LTIs/display it to support staff within Canvas, etc. I couldn't find an existing solution within Canvas so I did a mix of SIS feed updates with some local custom JS to help out.
async function home_campus() {
if(window.location.pathname.includes("/users/"))
{
let user_id = ENV["USER_ID"];
let integration_id = await getIntegrationId(user_id);
if (integration_id) {
let home_campus = integrationIdToCampus(integration_id);
let tr = document.createElement("tr");
tr.innerHTML = '<th>Home Campus:</th><td class="home_campus">'+home_campus+'</td>';
document.querySelector(".time_zone").parentElement.after(tr);
}
}
};
async function getIntegrationId(user_id) {
let response = await fetch('/api/v1/users/' + user_id)
let data = await response.text();
data = JSON.parse(data);
return data["integration_id"];
};
function integrationIdToCampus(integration_id) {
campus_code = integration_id.split('-')[1];
switch (campus_code) {
case "AN":
return("Anderson");
case "BL":
return("Bloomington");
case "CL":
return("Columbus");
case "EV":
return("Evansville");
case "DA":
return("Distance Apprenticeship");
case "FW":
return("Fort Wayne");
case "HC":
return("Hamilton County");
case "IN":
return("Indianapolis");
case "IO":
return("IvyOnline");
case "KM":
return("Kokomo");
case "LF":
return("Lafayette");
case "LC":
return("Lake County");
case "LB":
return("Lawrenceburg");
case "MD":
return("Madison");
case "MR":
return("Marion");
case "MN":
return("Muncie");
case "RM":
return("Richmond");
case "SL":
return("Sellersburg");
case "SE":
return("South Bend/Elkhart");
case "SW":
return("Statewide");
case "TH":
return("Terre Haute");
case "VP":
return("Valparaiso");
default:
return("Undefined");
}
}
home_campus();
We've had this running for several years and nothing seems to have broken with neither the integration ID nor the custom JS but as always - use with caution, your mileage may vary, objects in mirror are closer than they appear, etc.
Just want to say how much I appreciate people sharing their solutions! I do a lot of weird hacky Javascript with LMS software, because often they don't fit what feels like our pretty basic needs. So I'm glad I'm not the only one!
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in