Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

error passing default parameters to a form in classic interface but not in unified interface

Posted on by 20

I feel like I'm doing something fundamentally wrong here. 

var entityFormOptions = {};
entityFormOptions["entityName"] = "connection";

var formParameters = {};
formParameters["record1id"] = node.data.id;
formParameters["record1idname"] = node.text;

if (Xrm.Internal.isUci()) {
    formParameters["record1idtype"] = node.data.typename; 
} else {
    formParameters["record1idobjecttypecode"] = node.data.typename; 
}

Xrm.Navigation.openForm(entityFormOptions, formParameters);

The above code works, but:

1) It uses a method from the Internal workspace (Why does record1idtype not work in classic interface?)

2) I'm passing a string entity name to objecttypecode instead of an actual integer object type code (which fails if I do it)

All I'm trying to do is set a default record1 lookup value when I open a new connection form. But it either doesn't work in classic or unified interface, depending on what "type" property I'm setting.

Any help is appreciated.

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: error passing default parameters to a form in classic interface but not in unified interface

    Oh. You mean usage of Xrm.Internal.isUci... that's the other question. Unfortunately Microsoft doesn't provide any other way to detect what type of interface is it...

  • marcelxrm Profile Picture
    marcelxrm 20 on at
    RE: error passing default parameters to a form in classic interface but not in unified interface

    Thanks, I'll try running solution checker against it. My only concern is that, per Microsoft docs, the use of Internal namespace functions is unsupported.

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: error passing default parameters to a form in classic interface but not in unified interface

    It should not - technically your code doesn't do anything unsupported. In order to check that you can create solution and run App Checker against it.

  • marcelxrm Profile Picture
    marcelxrm 20 on at
    RE: error passing default parameters to a form in classic interface but not in unified interface

    but this will get flagged when submitting to AppSource, won't it?

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: error passing default parameters to a form in classic interface but not in unified interface

    Hello,

    I don't see anything wrong in your approach. Different UI-s - different approaches. If you're looking for consistent code try to use createFrom parameter instead - no guarantees but it could work.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans