web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
    RE: Web resource method does not exist

    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/.../

  • ONE BEE Profile Picture
    15 on at
    RE: Web resource method does not exist

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

  • Verified answer
    Inogic Profile Picture
    651 on at
    RE: Web resource method does not exist

    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!

  • thecharwest Profile Picture
    221 on at
    RE: Web resource method does not exist

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

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Web resource method does not exist

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 164

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 121 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans