web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Web resource method does not exist

(0) ShareShare
ReportReport
Posted on by 221

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.

pastedimage1632839936020v1.png

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));

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi thecharwest,

    Usually this error is caused by these two reasons:

    1. Your JS code  has syntax issue.

    2. You give the wrong function name when you create event.

    In your case, your code syntax is correct. So you could give the wrong function name.

    Please change newbusopperror to Safe.newbusopperror:

    pastedimage1632880735095v3.png

  • thecharwest Profile Picture
    221 on at

    Ah, I knew it would be a simple fix! Thanks so much.

  • Verified answer
    Inogic Profile Picture
    748 on at

    The error occurs due to the function name “newbusopperror”. We cannot call as it is, since in your code you have used objectname.

    So while calling you need to add object name along with the function name i.e. Safe.newbusopperror, while triggering the function.

    4621.form-properties.jpg

    Hope this  helps.

    Thanks!

  • ONE BEE Profile Picture
    15 on at

    My code is showing script error

    Web resource method does not exist: HideorShowSecSession
    Event Name: onchange
    Function Name: HideorShowSec
    Web Resource Name: new_HideorShowSecSolution
    code is as follow

    function HideorShowSection(executionContext) {
    debugger;
    var formContext = executionContext.getFormContext();

    var tabvalue = formContext.getAttribute("new_tabselection").getValue();
    formContext.ui.tabs.get("tab_6").setVisible(false);
    formContext.ui.tabs.get("tab_4").setVisible(false);
    formContext.ui.tabs.get("tab_5").setVisible(false);


    if (tabvalue == 100000000){
    formContext.ui.tabs.get("tab_4").setVisible(true);
    formContext.ui.tabs.get("tab_5").setVisible(false);
    formContext.ui.tabs.get("tab_6").setVisible(false);
    }

    else if (tabvalue == 100000001){
    formContext.ui.tabs.get("tab_5").setVisible(true);
    formContext.ui.tabs.get("tab_6").setVisible(false);
    formContext.ui.tabs.get("tab_4").setVisible(false);
    }


    else (tabvalue == 100000002){
    formContext.ui.tabs.get("tab_6").setVisible(true);
    formContext.ui.tabs.get("tab_5").setVisible(false);
    formContext.ui.tabs.get("tab_4").setVisible(false);
    }
    }

  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at

    Hi ONE BEE,

    Create a separate thread as it is already closed.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform/Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 182 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans