Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Select all phonecalls where "From" is null

(0) ShareShare
ReportReport
Posted on by

Hello!

I need to select all phonecalls where field "From" not contains any values (after selected I want to update this record).

How I could make that from C# (I have created workflow activity)?

I try to use QueryByAttribute and QueryExpression but I didn't make it (I got an error..)

Could anybody help me?

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Select all phonecalls where "From" is null
    var query = new QueryExpression
    {
        ColumnSet = new ColumnSet(false),
        EntityName = "phonecall"
    };
    
    query.Criteria.AddCondition("from", ConditionOperator.Null);
    
    var phoneCalls = service.RetrieveMultiple(query);
  • Anatoliy Veshemirsky Profile Picture
    on at
    RE: Select all phonecalls where "From" is null

    Thanks for help!

    I solved my task.

  • Suggested answer
    ashlega Profile Picture
    34,477 on at
    RE: Select all phonecalls where "From" is null

    For debugging, just through InvalidPluginExecutionException somewhere and pass a message.. if it's async workflow, you'll see that exception in the system jobs. If it's a sync workflow, you'll see it in the user interface right away.

    I'd go with what Vikas has suggeted, really. You can download Fetch from AdvancedFind and use it in your code.. Although, I'm not sure why he put quotes around fetchxmlstring there (typo mistake:) ), but this should work:

    ************

    Download the FetchXML from advance find. Then use below to get records

    var entities = service.RetrieveMultiple(new FetchExpression(fetchxmlstring)).Entities;

  • Gopalan Bhuvanesh Profile Picture
    11,401 on at
    RE: Select all phonecalls where "From" is null

    --

  • Verified answer
    a33ik Profile Picture
    84,325 Most Valuable Professional on at
    RE: Select all phonecalls where "From" is null

    Anatoliy,

    That should help - ssharmacrm.wordpress.com/.../how-to-debug-a-custom-workflow-activity-in-dynamics-crm

  • Anatoliy Veshemirsky Profile Picture
    on at
    RE: Select all phonecalls where "From" is null

    I have an issue: how I could debugging custom workflow activity? As variant - create console application with same code.. May be you know better cases?

  • EmployeeOcta Profile Picture
    2 on at
    RE: Select all phonecalls where "From" is null

    Hello Anatoliy,

    what the error you are getting in this.?

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Select all phonecalls where "From" is null

    Download the FetchXML from advance find. Then use below to get records

    service.RetrieveMultiple(new FetchExpression("fetchxmlstring");

  • Verified answer
    Thomas David Dayman Profile Picture
    11,323 on at
    RE: Select all phonecalls where "From" is null

    You can use the FetchXML Builder in the XRM toolbox and save it as a C# QueryExpression

    http://prntscr.com/f1sh4r

    // Instantiate QueryExpression QEphonecall

    var QEphonecall = new QueryExpression("phonecall");

    QEphonecall.Distinct = true;

    // Add columns to QEphonecall.ColumnSet

    QEphonecall.ColumnSet.AddColumns("subject", "statecode", "prioritycode", "scheduledend", "createdby", "regardingobjectid", "activityid");

    QEphonecall.AddOrder("subject", OrderType.Ascending);

    // Add link-entity QEphonecall_activityparty

    var QEphonecall_activityparty = QEphonecall.AddLink("activityparty", "activityid", "activityid");

    QEphonecall_activityparty.EntityAlias = "aa";

    // Define filter QEphonecall_activityparty.LinkCriteria

    QEphonecall_activityparty.LinkCriteria.AddCondition("partyid", ConditionOperator.Null);

  • Suggested answer
    Nithya Gopinath Profile Picture
    17,076 on at
    RE: Select all phonecalls where "From" is null

    Hi,

    In order to query party list fields, see the link below.

    https://community.dynamics.com/crm/b/crmshafraz/archive/2009/08/19/querying-a-partylist-field

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,850 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans