web
You’re offline. This is a read only version of the page.
close
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

How to remove few drop down records in ItemGroup

(0) ShareShare
ReportReport
Posted on by 5

Hello Everyone,

While creating a new record in released products, we select itemgroup. From that drop down top two of the records need to be removed.

Sharing the screenshot for reference.

pastedimage1680243279802v1.png

Thanks in advance.

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Hanisha,

    You can override the lookup event handler and write query to avoid the two values by using SysQuery::ValueNot("Audio").

    But in UAT or Prod you need to confirm that same name exist otherwise it won't work.

    Otherwise, you need to find for another workaround.

    Thanks,

    Girish S.

  • Martin Dráb Profile Picture
    237,789 Most Valuable Professional on at

    You need to override the lookup and use a query that filters out the records.

    Are you familiar with lookup and queries or do you have no idea at all?

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, In addition to above comments, you can check the below article on how to override lookup of form field.

    dynamics365musings.com/.../

  • Hanisha Profile Picture
    5 on at

    Hello Girish,

    I have used following code, but no luck.

    [FormControlEventHandler(formControlStr(EcoResProductCreate, ItemGroupId), FormControlEventType::Lookup)]    

    public static void ItemGroupId_OnLookup(FormControl sender, FormControlEventArgs e)

      {  

         SysQuery::valueNot("Audio");  

         SysQuery::valueNot("Audio Products");  

    }

    Please suggest. Thanks

  • GirishS Profile Picture
    27,827 Moderator on at

    You need to build the query from the scratch. First you need to find out the tables related to item group and then build the query along with code you sent.

    Also please refer to the mohits blog for how to build a lookup query.

    Thanks,

    Girish S.

  • Hanisha Profile Picture
    5 on at

    Hello,

    Its a unbounded control actually. I tried writing the below code but no luck.

    class TutorialCustTable_Form_Handler

    {

    [FormControlEventHandler(formControlStr(EcoResProductCreate, ItemGroupId), FormControlEventType::Lookup)]

    public static void ItemGroupId_OnLookup(FormControl sender, FormControlEventArgs e)

    {      

    }

       {

           SysTableLookup      sysTableLookup  = SysTableLookup::newParameters(tableNum(inventItemGroup), sender);

        SysQuery::valueNot("Audio");  

        SysQuery::valueNot("Audio Products");

           // Run the lookup

           sysTableLookup.performFormLookup();

           FormControlCancelableSuperEventArgs cancelableSuperEventArgs = e as FormControlCancelableSuperEventArgs;

           cancelableSuperEventArgs.CancelSuperCall();

       }

    }

  • GirishS Profile Picture
    27,827 Moderator on at

    You still didn't understand about writing query. Please see fully the blog send by the mohit.

    Your code looks something like below.

    [FormControlEventHandler(formControlStr(EcoResProductCreate, ItemGroupId), FormControlEventType::Lookup)]
    
    public static void ItemGroupId_OnLookup(FormControl sender, FormControlEventArgs e)
    {  
       Query query = new Query();
       QueryBuildDataSource qbds;
       SysTableLookup      sysTableLookup  = SysTableLookup::newParameters(tableNum(inventItemGroup), sender);
       qbds = query.addDataSource(tablenum(InventItemGroup));
       qbds.addRange(fieldnum(InventItemGroup, ItemGroupId)).value(queryvalue(SysQuery::valueNot("Audio")));
       qbds.addRange(fieldnum(InventItemGroup, ItemGroupId)).value(queryvalue(SysQuery::valueNot("Audio Products")));
       // Run the lookup
        sysTableLookup.performFormLookup();
        FormControlCancelableSuperEventArgs cancelableSuperEventArgs = e as FormControlCancelableSuperEventArgs;
        cancelableSuperEventArgs.CancelSuperCall();
    }
    
    

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    You are not applying ranges correctly. You need to create queryBuildDataSource buffer and pass this value in addRange method.

    Check this article

    dynamicsaxinsight.com/.../

  • Hanisha Profile Picture
    5 on at

    Thanks for helping but the problem is no DataSource for the form. If i add the base datasource of that records. am getting some parameter error .

  • GirishS Profile Picture
    27,827 Moderator on at

    What error you got?

    Can you show us the error.

    Thanks,

    Girish S.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 663 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 540 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 348 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans