Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

Getting error on Interactive Service case form "Required Parameter is Null or Undefined"

(0) ShareShare
ReportReport
Posted on by 5

Hi 

I am using Interactive Case Form to auto populate CustomerId on load of  case form.Below is the Js code

function setParentAccount()
{
if(Xrm.Page.ui.getFormType()==1)
{
setUser("parentaccountid");
}
}

function setUser(LookupField)
{
var setUservalue = new Array();
setUservalue[0] = new Object();
setUservalue[0].id = "a16b3f4b-1be7-e611-8101-e0071b6af231";
setUservalue[0].entityType = 'account';
setUservalue[0].name = "A Datum Corporation";
Xrm.Page.getAttribute(LookupField).setValue(setUservalue)
}

I am getting below error 

pastedimage1562328544137v1.png

This error is coming on the Customer service Hub only. In Normal form it is working as expected.

Can anybody facing the same issue / Please help me to resolve this issue.

Categories:
  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Getting error on Interactive Service case form "Required Parameter is Null or Undefined"

    Hi partner,

    In Unified Interface, I recommend you to use "execution context" to get "formcontext" rather than "xrm.page" because D365 V9.X UI dose not support "xrm.page" any more. 

    Here is the upgrated code.

    function setParentAccount()
    {
    if(Xrm.Page.ui.getFormType()==1)
    {
    setUser("parentaccountid");
    }
    }
    function setUser(LookupField,executionContext)
    {
    var setUservalue = new Array();
    setUservalue[0] = new Object();
    setUservalue[0].id = "a16b3f4b-1be7-e611-8101-e0071b6af231";
    setUservalue[0].entityType = 'account';
    setUservalue[0].name = "A Datum Corporation";
    //Xrm.Page.getAttribute(LookupField).setValue(setUservalue)
    var formcontext=executionContext.getFormContext();
    formcontext.getAttribute(LookupField).setValue(setUservalue);
    }

    Hope it helps.

    Best Regards,

    Leo

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans