Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Update Lookup Field via Query in Workflow

Posted on by Microsoft Employee

Good day,

I am trying to figure out a way to dynamically update a lookup field in a workflow.

An example use-case of what I mean: So we want to make things easy for our inventory manager by automatically creating Product Purchase Orders. So we check and see if quantity on hand in Product Inventory is below the reorder point, and if so we can create a new Product Purchase Order record that will replenish our inventory. The problem is now associating this Product Purchase Order to a Purchase Order, but we don't want to create a new Purchase Order every time if the PO is for the same supplier (shipping is expensive!). So the idea would be to query all POs and see if any have the same supplier (we can use the default supplier of the warehouse that needs the new inventory) and if so we add the Product Purchase Order onto that PO. If there are no matching POs with the same supplier we create a new PO. (Also we don't really care if there are a bunch of Product Purchase Orders associated to a PO that all are for the same product.)

Is a setup like this easily possible without having to write any custom code?

I was thinking something similar to the Query Values step seen in the Workflow Tools package would work for this problem. (https://msdyncrmworkflowtools.codeplex.com/) The only problem with the Query Values step is that it outputs a string and cannot be used in an Update step to update a record lookup. (Even if you try to set the lookup to a GUID string.)

Does anyone know of any workflow solution that could solve this problem?

Thanks,

       BGS

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update Lookup Field via Query in Workflow

    Hello Jeroen,

    Thank you so much for the response. I'll check this out

    Have a great day

    Mark

  • Jeroen J Profile Picture
    Jeroen J 415 on at
    RE: Update Lookup Field via Query in Workflow

    Hi Mark,

    I managed to get this solved using http://www.itaintboring.com/dynamics-crm/dynamics-crm-use-a-workflow-to-set-a-lookup/

    It's a bit of a puzzle, but once configured right, it works like a charm.

    Good luck!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update Lookup Field via Query in Workflow

    Same issue here !

  • Jeroen J Profile Picture
    Jeroen J 415 on at
    RE: Update Lookup Field via Query in Workflow

    Hey,

    realizing that my reply is a 'bit late', but I was wondering if you managed to solve this issue? Have exactly the same and it looks as if we're the only ones in the world.

    thanks!

    Jeroen

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans