Skip to main content

Notifications

Customer Insights - Journeys forum

How to fetch lead score from lead id using API

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I have created a customer journey that sends email and based on email clicks, I am creating leads.

I have also done a setup for lead scoring models, which gives me the score when I see the lead on the UI.

Now, I would like to fetch the lead score using API, passing the lead ID; but so far I have not been able to get through this.

The "view lead" page passes the following request:

<?xml version="1.0" encoding="utf-8"?>
<fetch version="1.0" mapping="logical" returntotalrecordcount="true" page="1" count="4" no-lock="false">
<entity name="msdyncrm_leadscore">
<attribute name="statecode"/>
<order attribute="msdyncrm_select_score" descending="false"/>
<filter type="and">
<condition attribute="statecode" operator="eq" value="0"/>
</filter>
<attribute name="msdyncrm_select_scoringmodelname"/>
<attribute name="msdyncrm_select_scoringmodelid"/>
<attribute name="msdyncrm_select_score"/>
<attribute name="msdyncrm_select_grade"/>
<attribute name="msdyncrm_leadscoreid"/>
<link-entity name="lead" from="leadid" to="msdyncrm_leadid" alias="bb">
<filter type="and">
<condition attribute="leadid" operator="eq" uitype="lead" value="64c86b97-f9b2-4761-8dc8-930e50916dd4"/>
</filter>
</link-entity>
</entity>
</fetch>

But what exactly do I need to pass/query if I need the same output with postman or using microsoft flow?

Regards,

Dhiren Shah

  • Suggested answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: How to fetch lead score from lead id using API

    Try to do the same query in Advanced find, then download the fetchxml from there (it’s easy & to avoid any mistakes)

    us.hitachi-solutions.com/.../great-fetchxml-tool-for-microsoft-dynamics-crm

    You can test/build queries (including above query in question) in xrmtoolbox plugins like Fetchxml builder or fetchxml tester.

    Query looks good, you didn’t say what’s the result ie if any errors or empty rows.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans