web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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.


I have the same question (0)
  • Verified answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    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

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    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/.../

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 182 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans