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 / Plugin code for qualif...
Power Apps
Unanswered

Plugin code for qualify lead

(0) ShareShare
ReportReport
Posted on by 146

Hello Experts,

Scenario - I'm trying to qualify lead when there is any phone call activity is present in the timeline.

 

code-

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{

Entity entity = (Entity)context.InputParameters["Target"];

if (context.MessageName.ToUpper() == "QUALIFYLEAD")

{
EntityReference regardingobjectid = null;

{
string fetch = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true' no-lock='false'>
<entity name='phonecall'>
<attribute name='subject'/>
<attribute name='regardingobjectid'/>
<attribute name='activityid'/><attribute name='to'/><attribute name='prioritycode'/><attribute name='scheduledend'/><attribute name='phonenumber'/>
<order attribute='scheduledend' descending='false'/><filter type='and'>
<condition attribute='regardingobjectid' operator='eq' value='" + entity.LogicalName + @"' uiname='' uitype='lead'/>
</filter></entity></fetch>";


EntityCollection testing = service.RetrieveMultiple(new FetchExpression(fetch));

if (testing.Entities.Count > 0)
{
foreach (var e in testing.Entities)
{
Guid activityid;

if (e.Attributes.Contains("activityid"))
{
activityid = (Guid)e["activityid"];
}
if (entity.Attributes.Contains("regardingobjectid") && entity.Attributes["regardingobjectid"] != null)
{

regardingobjectid = (EntityReference)entity.Attributes["regardingobjectid"];
}

bhavanadesale__0-1669020920168.png

I'm stuck in this code. Please help me.

I have the same question (0)
  • Gowri Halan Profile Picture
    262 on at

    @bhavanadesale_ Hi, What is your trigger condition. is it whenever activity record (phone call) created?

  • bhavanadesale_ Profile Picture
    146 on at

    @gowrihalan04 , Yes.

    If there is any phone call activity is open than only lead will qualify otherwise it will show "phone call activity count is 0".

     

  • Gowri Halan Profile Picture
    262 on at

    @bhavanadesale_  then register plugin on create of activity entity (phone call) check if regarding object type is lead. if it is, then check the lead status. if it is not qualified, you need to qualify lead within code. see below example.

     

    https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/sample-qualify-lead?view=op-9-1 

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 802 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 332 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 273

Last 30 days Overall leaderboard