I'm getting the above error on one of my scripts on the Opportunity form and I'm unsure why. This is the first time I've actually tried writing a script and implementing it on a form, so I imagine it's a fairly simple fix I'm just not aware of!
I have added the code as a web resource and enabled it on my form. I have also saved and published these changes and cleared my cache before testing.
These are the error details:
ReferenceError: Web resource method does not exist: NewBusOppError
Error Details:
Event Name: onchange
Function Name: NewBusOppError
Web Resource Name: samar_/NewBusinessOppError
Solution Name: Active
Publisher Name: DefaultPublisherorg36a1d10f
And this is my script:
var Safe = window.Safe || {};
//This function gives an error message if the Opp Type is New Business but there is an Originating Lead.
(function () {
this.newbusopperror = function (executionContext) {
var formContext = executionContext.getFormContext();
// GET Opportunity Type
var opportunityTypeValue = formContext
.getAttribute("safe_opportunitytype")
.getValue();
var record_id = opportunityTypeValue[0].id;
//var salesProcess = formContext.getAttribute("samar_salesprocess").getOption(value);
var Lead = formContext
.getAttribute("originatingleadid")
.getValue();
if (
opportunityTypeValue != null &&
record_id.toUpperCase() == "{8815B22C-80E0-EA11-A813-000D3A4B2C9E}" && Lead == null
) {
alert("New Business Sales Should Always Start as a Lead");
}
};
}.call(Safe));