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

Is it possible to pull leads with only one task using advanced find?

(0) ShareShare
ReportReport
Posted on by 10

Hello,

We need to pull all leads with only one task assigned. It looks Advanced find can't do the job. Is there any way can I get the results?

Thanks

carys

  • Verified answer
    Kenneth Ariel Chaves Herrera Profile Picture
    on at
    RE: Is it possible to pull leads with only one task using advanced find?

    Hi, here additional documentation of suing rollups in Dynamics

    On-prem:

    Create rollup fields in Dynamics 365 Customer Engagement (on-premises) | Microsoft Docs

    Power Apps:

    Define rollup columns with Power Apps - Power Apps | Microsoft Docs

  • Pradeep Rai Profile Picture
    5,487 Super User 2025 Season 1 on at
    RE: Is it possible to pull leads with only one task using advanced find?

    Hi Carys,

    you're welcome.

    pastedimage1630563388590v1.png

    Thanks,

    Pradeep.

  • Carys Sun Profile Picture
    10 on at
    RE: Is it possible to pull leads with only one task using advanced find?

    Thanks a lot!

  • Verified answer
    Pradeep Rai Profile Picture
    5,487 Super User 2025 Season 1 on at
    RE: Is it possible to pull leads with only one task using advanced find?

    Hi Carys,

    Yes, you can create Rollup Field as shown below on Lead entity to store the Related Task Record Count:

    pastedimage1630522625435v1.png

    Then in Advance Find of Lead you can use this the above Rollup Field As shown below:

    <fetch>
    <entity name="lead" >
    <attribute name="subject" />
    <filter>
    <condition attribute="new_taskcount" operator="eq" value="1" />
    </filter>
    </entity>
    </fetch>

    Here, We need add one more additional logic about task create/delete. Means, whenever task deleted or created we need to update the New Rollup Fields using below code:


    //rollup fieldname
    string fieldName = "new_taskcount"
    string entLogicalName = "lead";
    Guid recordId = "<GUIDOFLEAD>";
    var rollupObj = new CalculateRollupFieldRequest {
    Target = new EntityReference(entLogicalName, recordId), FieldName = fieldName
    };
    var result = (CalculateRollupFieldResponse)service.Execute(rollupObj);

    Thanks,
    Pradeep.

    Please mark this as VERIFIED it it helps.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 89

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans