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 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
    16,341 Moderator on at

    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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans