Stop Opportunity being created based on Account module field + Opp field

Stop Opportunity being created based on Account module field + Opp field

I'm trying to create a client script that stops someone being able to create an opp on save based on a account module field and opp field.

Any idea what is wrong with the code?

var accountField = ZDK.Page.getField("Account_Name");
var accountFieldValue = accountField.getValue();

var selectedStage = ZDK.Apps.CRM.Accounts.fetchRelatedRecords(accountFieldValue.id, "Account_FIELD")

var pipelineField = ZDK.Page.getField("Pipeline");
var selectedPipeline = pipelineField.getValue();

if (selectedStage !== "Customer" && selectedPipeline === "XXXX") {
ZDK.Client.showAlert("TEXT ALERT HERE");
return false;
}

return true;