Custom Error Messages are Not Working | Field Validation

Hi all.

I'm creating a piece of code which stops users saving the Opportunity record when there are no contacts linked to it. I've gotten all the way to the end and have the code working, however I cannot get the custom error to work. I've seen an older question but no one has responded.

In the following location: custom/modules/Opportunities/clients/base/views/record I have the following code: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
({
/* because 'accounts' already has a record view, we need to extend it */
extendsFrom: 'OpportunitiesRecordView',
initialize: function (options) {
this._super('initialize', [options]);
app.error.errorName2Keys['contactrequired'] = 'ERROR_CUSTOM_MESSAGE_CONTACTREQUIRED';
//add validation tasks
this.model.addValidationTask('check_contact', _.bind(this._doValidateRelatedContact, this));
//this.model.addValidationTask('check_account_type', _.bind(this._doValidateCheckType, this));
},
_doValidateRelatedContact: function(fields, errors, callback) {
//validate requirements
var contacts = this.model.getRelatedCollection('contacts');
contacts.fetch({ relate: true });
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This works no problem at all, however you can see that I am trying to use a custom error called "contactrequired". This is saved here (as per sugar docs) custom/Extension/application/Ext/Language

Fullscreen
1
2
3
<?php
$app_strings['ERROR_CUSTOM_MESSAGE_CONTACTREQUIRED'] = 'No contact against the opportunity, please add one to confirm the save';
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

However when I save the record and the code fires I get the generic

"Error Please resolve any errors before proceeding."

Rather than any custom error. Can anyone help please? Or point me to where I may be going wrong.

Many Thanks,

Daniel Hill