If you're exporting applicant information from Outcomes into a file, you may wish to include information about the applicants' references, or recommenders. This advanced configuration allows you to extract recommender details (e.g., their name, email address, or organization) to an export file.
Before configuring the JavaScript for your export, you'll need to determine which data points you want to export. This may include:
The code to use for this configuration will vary based on which details you want to include.
You have two options when adding the JavaScript Code for this expression:
In either case, you'll have an Expression area to add your code and configure it as desired. To complete this process:
{
/* * * * * * * * * * * * *
* * USER INPUT SECTION * *
* * * * * * * * * * * * */
// use this field to determine the number recommendation you want to output.
let recNumber = 1;
// use this field to define the information you want returned
//choose one of the field names below and enter it into "field" exactly as written
// name, email, is_complete, dateRequested, dateCompleted
let field = "name";
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This function takes two inputs to return a single recommendation field.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
recNumber = recNumber - 1;
let type = "";
// checks where in JSON the requested data is stored
if (field == "email" || field == "name" || field == "is_complete") {
type = "outer";
} else if (field == "dateRequested" || field == "dateCompleted") {
type = "date";
} else if (field == "recommender_organization" || field == "recommender_title") {
type = "inner";
} else {
return;
}
if ((references) &&
(references.recommendations) &&
(references.recommendations.references) &&
(references.recommendations.references.length > 0) &&
(references.recommendations.references[recNumber])) {
if ((type == "outer") && (references.recommendations.references[recNumber][field])) {
return references.recommendations.references[recNumber][field];
} else if ((type == "date") && (references.recommendations.references[recNumber][field])) {
let ref = references.recommendations.references[recNumber][field];
return ref.slice(5, 7) + "/" + ref.slice(8, 10) + "/" + ref.slice(0, 4);
} else if ((type == "inner") && (references.recommendations.references[recNumber].forms) &&
(references.recommendations.references[recNumber].forms.overall_recommendation) &&
(references.recommendations.references[recNumber].forms.overall_recommendation[field])) {
return (references.recommendations.references[recNumber].forms.overall_recommendation[field]);
} else {
return;
}
} else {
return;
}
}