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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Script Error: Web resource method does not exist

(0) ShareShare
ReportReport
Posted on by

Hello,

When I built an onLoad websuorce, error message:

ReferenceError: Web resource method does not exist: getSubjectLookupId
Error Details:
Event Name: onload
Function Name: getSubjectLookupId
Web Resource Name: abc_casesubjectidlookup.js
Solution Name: Active
Publisher Name: DefaultPublisherxxxx

I'd like get the Subject entity's GUID (lookup field) when I load the Case entity form. My script:

function getSubjectLookupId(executionContext) {

debugger;

var formContext = executionContext.getFormContext();

var lookupObj = formContext.getAttribute("subjectid"); //Check for Lookup Object

if (lookupObj != null) {

var lookupObjValue = lookupObj.getValue(); //Check for Lookup Value

if (lookupObjValue != null) {

var subjectId = lookupObjValue[0].id, // To get record GUID

if (subjectId != null) {

Xrm.Utility.alertDialog("ID: " + subjectId);

}
}
}
}

Could you please help to analyze what cause the error? Thanks.

I have the same question (0)
  • Verified answer
    Steve Zhao2 Profile Picture
    on at
    RE: Script Error: Web resource method does not exist

    Hi ALL365,

    This is due to there is a syntax error in your script. You should change the comma to semicolon at this line: var subjectId = lookupObjValue[0.id,

    So please try this code:

    function getSubjectLookupId(executionContext) {
    
    debugger;
    
    var formContext = executionContext.getFormContext();
    
    var lookupObj = formContext.getAttribute("subjectid"); //Check for Lookup Object
    
    if (lookupObj != null) {
    
    var lookupObjValue = lookupObj.getValue(); //Check for Lookup Value
    
    if (lookupObjValue != null) {
    
    var subjectId = lookupObjValue[0].id; // To get record GUID
    
    if (subjectId != null) {
    
    Xrm.Utility.alertDialog("ID: "   subjectId);
    
    }
    }
    }
    }

  • ALAN365 Profile Picture
    on at
    RE: Script Error: Web resource method does not exist

    Thank you so much  Steve!

    It's work. You found the typo.

    I have encounter another issue, almost same script but lookup a custom entity, The lookupObj always undefined. I will post another tread. Please review it.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 101

#2
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans