Skip to main content
Post a question

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Set Entity Value C#

Posted on 2 Jul 2020 11:20:55 by 85

Hi,

We have accounts, which has many contacts, for every contact we have a flag.

Can we set each flag to FALSE without iterating each contact in the account ?

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on 02 Jul 2020 at 13:56:53
    RE: Set Entity Value C#

    Hi,

    You can use microsoft flow to achieve your requirement. But you will have to iterate contact records associated to account.

    You can get all contacts associated to Account using Web api filter criteria in microsoft flow.

    If you want to go with c# code then you can use query expression or fetchxml to get all contacts associated to account. Use company name field on Contact to get all contacts associated to a particular account.

    If found helpful, Please mark my answer verified.

  • Suggested answer
    TNS Profile Picture
    TNS 1,195 on 02 Jul 2020 at 13:22:17
    RE: Set Entity Value C#

    Hi,

    you can create custom workflow and run as on demand workflow. In your custom workflow you can get the account and by using your account id  you can retrieve its contact based on condition by "Query Expression" or "Fetch XML" which suits you. Then you can change the flag.

    After creating your workflow select the accounts and run workflow.

    Regards,

    TNS

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,204 User Group Leader on 02 Jul 2020 at 12:46:36
    RE: Set Entity Value C#

    Hi, 

    You should use bulk workflow execution and use a fetchXml query to execute the workflow against the associated contacts

  • RG Student Profile Picture
    RG Student 85 on 02 Jul 2020 at 12:34:21
    RE: Set Entity Value C#

    Hi Andrew,

    We have multiple contacts associated with an Acoount. For each Contact there is a flag xyz.

    so, for each contact I need to set the flag as FALSE for a given condition.

    Could you please suggest how I can do this using C# ?

    Thanks.

  • RG Student Profile Picture
    RG Student 85 on 02 Jul 2020 at 12:31:57
    RE: Set Entity Value C#

    Thank You Mehdi El Amri .

    As suggested I have created a workflow, now, how can I get the contacts associated with the given account and set the flag for each contact?

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on 02 Jul 2020 at 11:56:47
    RE: Set Entity Value C#

    Hello,

    I'm afraid you can't.

    Can you please tell more about your scenario - may there there is an alternative way to implement your requirement.

  • Suggested answer
    meelamri Profile Picture
    meelamri 13,204 User Group Leader on 02 Jul 2020 at 11:55:58
    RE: Set Entity Value C#

    Hi,

    You can create on-demand workflow to set your flag to FALSE. Then use Bulk Worflow execution tool availble on XrmToolBox to execute your workflow against your contacts. Bulk Workflow execution offer the possibility to use views and fetchXml.

    Please check this blog for more details about the tool:

    www.powerobjects.com/.../

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans