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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / how can model driven a...
Power Apps
Unanswered

how can model driven app check whether the customer exists in D365 CRM ?

(0) ShareShare
ReportReport
Posted on by 190

I am creating a model driven app . 

 

So , on addition of a new customer , i want to have a check on the D365 CRM whether the customer exists within CRM , if yes then the relevant details can be auto populated .

Can any one pls help ! Many thanks for your support .

Categories:
I have the same question (0)
  • Luis Arellano Profile Picture
    247 on at

    Sounds to me that you'll need to add JavaScript to your MDA form for the Customer table but for that, you'll need a unique value to retrieve the Customer.

     

    Can you share more about your form/process?

     

    If you have a unique "customer ID" column, you can add an even on the change of that column and trigger a JavaScript code that will query Dataverse for a customer with the same "Customer ID" and retrieve the data you want to populate in the form.

     

    You can use Xrm.WebApi for that.

    Xrm.WebApi (Client API reference) in model-driven apps - Power Apps | Microsoft Learn

     

    That said, I am not understanding why you would want to allow the addition of a new customer record if it is already in D365 CRM.

  • Kumar_bi Profile Picture
    190 on at

    Thanks much @LuisArellano for your response .
    Actually I need the customer details to be populated as those details will then be used for the calculation of quotes in my app , and some details like address and risk and premium plays major role in close the lead/opportunity .
    Also, can this be done via a lookup or an API somehow if you know .
    Many Thanks again,kumar

  • Luis Arellano Profile Picture
    247 on at

    Yes, it can be done it will depend on the requierement and scenarios for your validation, but can be done via JavaScript, Flow, Plugin or workflow.

     

    Since you mentioned the close of the lead/opportunity, I think this should be a realtime validation.

     

    If you decide to use JavaScript, you can use XrmToolBox's plugin FetchXml Builder plugin to build the query you need.

     

    So, once you have the unique value to identify your customer you can use this WebApi query for the Account table as an example:

    https://yourUrl/api/data/v9.2/accounts?$select=address1_city,address1_country,address1_county,address1_fax,address1_line1,address1_stateorprovince&$filter=accountnumber eq 'CUS1000001'

     

    you'll have to change the name of your table and columns as needed.

     

    Converting that webApi query to Xrm.WebApi call

     

    Xrm.WebApi.retrieveMultipleRecords(account, "$select=address1_city,address1_country,address1_county,address1_fax,address1_line1,address1_stateorprovince&$filter=accountnumber eq 'CUS1000001'").then(successCallback, errorCallback);

     

    In you success callback you'll get an array as a result with the retrieved data.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard