I have created JS to define a variable by picking the highest score between multiple items. I then add these new variables as embedded data in the survey flow to include an an email trigger score report. The JS does not seem to run as these defined variables are not factored into my scoring at the end. I am wondering if anyone had a suggestion as to what could be off.
Qualtrics.SurveyEngine.addOnload(function()
{
var D2 = Math.max(parseInt("${gr://SC_080RbHTrsT1D3dX/Score}"), parseInt("${gr://SC_bxT0sMdAzcuvVwp/Score}"), parseInt("${gr://SC_0qdtqn6ZDef4M3r/Score}"));
Qualtrics.SurveyEngine.setEmbeddedData("D2", D2);
var D3 = Math.max(parseInt("${gr://SC_d6FNACqSr3a57F3/Score}"), parseInt("${gr://SC_eyuzFq3CuB0eKjz/Score}"));
Qualtrics.SurveyEngine.setEmbeddedData("D3", D3);
var D4 = Math.max(parseInt("${gr://SC_b286v30r9zo0naZ/Score}"), parseInt("${gr://SC_2bDQfrW19FnTcXj/Score}"), parseInt("${gr://SC_e2rxOogyrh9w3f7/Score}"), parseInt("${gr://SC_9RMkPlGRr2G1MDr/Score}"));
Qualtrics.SurveyEngine.setEmbeddedData("D4", D4);
});
JavaScript not working
Best answer by TomG
KKI_CCFTS ,
The JS has to be attached to a question on a page after the last scored question. The block is irrelevant. It could be attached to a question populated by respondents as long as it meets the requirement above. Also, the embedded variables must defined in the survey flow, prior to the block that contains the JS calculations.
Assuming the question with the JS calculations remains a descriptive text question on its own page, you would use JS to click the Next Button after the calculations are complete. You would add padding (white space) to the top of the question text so the respondent just sees blank page for the fraction of a second while the calculations are done.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

I did as suggested and it did not work.