Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Plugin to check if value of an entity exists in records of another entity

(0) ShareShare
ReportReport
Posted on by 165

Hello,

I need help writing a plugin that updates a boolean field of the target entity, if a value of the target entity exists in the records of another entity.
Specifically, the target entity is 'Case' and the attribute I am interested in is Serial Number (which is a lookup field). So, I need to check if Serial Number already exists in another entity ('Warranties'), and if so, if it has not expired (ending date > today). Plugin will get triggered when a Case is created and if all criteria are met, it will update a boolean field to 'true'.

Should I get service.retrieve to get all warranties records and check if value exists or should I use a foreach on the Warranties Entity? I don't have any experience on writing plugins, so any help would be much appreciated.


  • Suggested answer
    Rawish Kumar Profile Picture
    Rawish Kumar 13,756 on at
    RE: Plugin to check if value of an entity exists in records of another entity

    I would recommend you start with understanding how basic plugin works and how you write it by this sample : crmbook.powerobjects.com/.../

    post that learn to use retrieve multiple with query expression : crmbook.powerobjects.com/.../

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: Plugin to check if value of an entity exists in records of another entity

    Hi,

    service.retrieve will not work in this.

    You will need to use either fetchxml or queryexpression to check if serial number is exist in warrnty entity.

    Fetch XML Example

    docs.microsoft.com/.../use-fetchxml-construct-query

    mylearnings26.wordpress.com/.../

    Query Expression example

    sank8sinha.wordpress.com/.../

    carldesouza.com/.../

    Please mark my answer verified if i were helpful

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,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans