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

Add condition on ItemId Field lookup in D365FO

(0) ShareShare
ReportReport
Posted on by 113

Hi Experts,

How to add a filter to show particular Item in ItemID field of SalesLine Datasource in SalesTable Form.

I want the condition in lookup that-
It will check the "ProductLifecycleStateId" field in "InventTable" Table. If It is not blank than will go inside to "EcoResProductLifecycleState " Form and check the field -"EngChgEcoResProductLifeCycleStateRule_StateRuleName" has value "Sales order" & if Field -"EngChgEcoResProductLifeCycleStateRule_Blocked" has value "Blocked". Than the Item ID field will not show that item in the lookup.

How can I achieve this can anyone help. 

I have the same question (0)
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi Harish, You can use override existing lookup method in ItemId field in SalesLine datasource in salesTable form. So, instead of standard lookup, your custom lookup should be called.

    dynamics365musings.com/.../

  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Harish,

    You can create a view with the above-mentioned table with the values specified as a range and then add that view as Non exist join to the ItemId table in the lookup query.

    Thanks,

    Girish S.

  • HARISH MEHRA Profile Picture
    113 on at

    Hello Mohit,

    Thanks for the reply.

    How can I add the logic in this lookup.

  • HARISH MEHRA Profile Picture
    113 on at

    Thanks Girish

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    If I understood your requirement correctly, you don't want to show only those Item IDs which have Blocked status and StateRuleType is SalesOrder and value not empty in ProductLifecycleStateId field in InventTable. If Yes, then you can add ranges as per your requirement. If you want to show all items where ProductLifecycleStateId is empty and check these requirements only where it has some value then query will be different. Please confirm your requirement.

  • HARISH MEHRA Profile Picture
    113 on at

    Yes I have the same requirement.

    I don't want to show those Item IDs which have Blocked status and StateRuleType is SalesOrder.

    I want to show all items where ProductLifecycleStateId is empty & if ProductLifecycleStateId is not empty so  will check for non Blocked and display those Item.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    In that case, you can refer to this article and add OR range to check either ProductLifecycleStateId  is empty || using && operator check all other conditions.

    www.linkedin.com/.../

  • GirishS Profile Picture
    27,827 Moderator on at

    You can create a view and add those ranges - use that view in a query. This will reduce coding.

    Thanks,

    Girish S.

  • HARISH MEHRA Profile Picture
    113 on at

    Hi,

    I have created a View but how can I use it in my code for lookup.

  • GirishS Profile Picture
    27,827 Moderator on at

    You can use this as how you use table in lookup query.

    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 646 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans