Thanks Mehdi - I did was you suggested and receive the exact same error. I removed all comments frmo the switch statement so all cases were in the new web resource. Just for reference, added the code below. As for Xrm.Page, I planned to update that. Just got hung up on this error before getting to the end of the code. I did validate the form is using the new web resource and the function name was copied and pasted. The below is the entirety of the js file.
function SetRelationshipStrength(executionContext) {
var formContext = executionContext.getFormContext(); // get the form context
var score = 0;
formContext.data.entity.attributes.forEach(function (attribute, index) {
var attr = attribute.getName();
var value = formContext.getAttribute(attr).getValue();
if (formContext.getAttribute(attr).getAttributeType() === "optionset") {
var value = formContext.getAttribute(attr).getText();
}
else {
var value = formContext.getAttribute(attr).getValue();
}
switch (attr) {
case "firstname":
if (value != "" && value != null) {
score = score + 2;
}
break;
case "jobtitle":
if (value != "" && value != null) {
score = score + 1;
}
break;
case "cre5e_jobtype":
if (value != "" && value != null) {
switch (value) {
case "Technical":
score = score + 2;
break;
case "Functional":
score = score + 2;
break;
}
}
break;
case "cre5e_keybusinessinterests":
if (value != "" && value != null) {
score = score + 1;
}
break;
case "telephone1":
if (value != "" && value != null) {
score = score + 2;
}
break;
case "emailaddress1":
if (value != "" && value != null) {
score = score + 1;
}
break;
case "managername":
if (value != "" && value != null) {
score = score + 2;
}
break;
case "cre5e_hasdirectreports":
if (value != "" && value != null) {
score = score + 2;
}
break;
case "cre5e_favoritesport":
if (value != "" && value != null) {
score = score + 3;
}
break;
case "cre5e_favoritefood":
if (value != "" && value != null) {
score = score + 2;
}
break;
}
/*if (value != "" && value != null && attr == "firstname") {
score += 2;;
}
if (value != "" && value != null && attr == "jobtitle") {
score += 5;
}*/
});
Xrm.Page.getAttribute("cre5e_relstrengthtest").setValue(score);
Xrm.Page.getAttribute("cre5e_relstrengthtest").setSubmitMode("always");
}