Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Instances of type 'InitialQueryParameter' cannot be added to a container

(0) ShareShare
ReportReport
Posted on by

pastedimage1645697249711v1.pngpastedimage1645697281160v2.png

Like that,I wanna add a query into container, but throw this error!

Is there someone who knows what the problem is?

  • jameszhang Profile Picture
    jameszhang on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Args::create() is called when opening workspace  pastedimage1647846436837v1.png

    when opening my view pastedimage1647846476593v2.png

    Args::create() is called either.

  • Martin Dráb Profile Picture
    Martin Dráb 231,436 Most Valuable Professional on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Aha, so you're talking about a tile created by personalization, not by development, right?

    If you're sure that initialQuery is populated before (un)packing, then you extend the packing logic, as discussed before.

    By the way, can you tell me where Args::create() is called from in this case?

  • jameszhang Profile Picture
    jameszhang on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    It's not about tile, it's about Args doesn't pack initialquery when opening tile and it cause this issues.

  • jameszhang Profile Picture
    jameszhang on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Created a saved view by extending the existing pre-filtering on that specific form "Procurement and sourcing > Purchase orders > Purchase order follow-up >Purchase orders without confirmed delivery date" with a filter on the created by person.

    Saved this view and created a tile!

    Opening the tile I saw that all filters were deleted on my saved view and I got the message with the user security restrictions again. (see screenshot)

    Selecting the same saved view form the form itself of course still had all the filters. (see screenshot)

    Next I entered all the filters again on the session that I had opened from the tile and clicked on save the view again under the same name.

    Then I closed the form and went back to my work space with the tile.

    From the workspace I opened the tile again and this time the filters did stay also with the form opened from the tile and no message was shown. How nice!

  • Martin Dráb Profile Picture
    Martin Dráb 231,436 Most Valuable Professional on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Which tile is it about?

  • jameszhang Profile Picture
    jameszhang on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Well,let me show you the bug

    Opening form from menu item directly - initialQuery().modeledQueryName() exists (see immediate window) - OK:

    pastedimage1647593777321v5.png

    Opening same form/menu item from a Tile - initialQuery() is null - Not OK:

    pastedimage1647593812782v6.png

    So here is my problem

    pastedimage1647593862677v7.pngpastedimage1647593883257v8.png

    if I create an extension as you said, args will include the initialQuery or not ? I was confused about how to recognize which function will use(which pack() and unpack() ) when exec create(),or both?

    Besides,could you please give more details about the code?Thanks again!

  • Martin Dráb Profile Picture
    Martin Dráb 231,436 Most Valuable Professional on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Sorry, but I don't understand what you mean by "finding a model about extension".

    I'm saying that if you don't have a model for your customizations, you need to create one, because you can't work without a model. Then create a project (make sure it's associated with your model) and create a new class there.

  • jameszhang Profile Picture
    jameszhang on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    But you shouldn't create a new model for each change - a single model for all changes will likely be sufficient.That's what I'm saying, I can't find any model about extension.

  • Martin Dráb Profile Picture
    Martin Dráb 231,436 Most Valuable Professional on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    Well, you definitely need to learn the basics before you can do any development. You see that you're currently unable to do anything...

    Don't you have anybody on the project who can teach you at least a bit of F&O development? If not, look at resource on the internet.

    You need a model to do any development, because that's where your code gets stored. But you shouldn't create a new model for each change - a single model for all changes will likely be sufficient.

  • jameszhang Profile Picture
    jameszhang on at
    RE: Instances of type 'InitialQueryParameter' cannot be added to a container

    I've searched about extension class and I had some troubles of how to create extension class, should I create a new model before create a extension class? I'm not familiar with D365 operations. Could you please give me more details about it ? thanks again!

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans