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

Script Error: Web resource method does not exist

(0) ShareShare
ReportReport
Posted on by 2

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.

  • Verified answer
    Steve Zhao2 Profile Picture
    Microsoft Employee on at

    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
    2 on at

    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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
11manish Profile Picture

11manish 73 Super User 2026 Season 2

#2
ParthPatel249 Profile Picture

ParthPatel249 56

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 44 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans