Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Custom workflow to populate lookup field with text field

Posted on by 270

Hi Guys

Please assist if you know how to work this out. I have two custom entities Entity A and Entity B. 

I have lookup  field on Entity A that lookup to Entity B. I also have text field on entity A that has the same values as the one in Entity B. I wan to write a custom workflow that will take the value from text field and pass it to lookup then lookup will return the record with that same value. I can do it manually by just copying the value from text and paste it on lookup then it will return the same value.

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Custom workflow to populate lookup field with text field

    aspsolutionkirit.blogspot.in/.../how-to-update-lookup-value-using-custom.html

  • Samrando Profile Picture
    Samrando 270 on at
    RE: Custom workflow to populate lookup field with text field

    Thanks Ravi much appreciated

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Custom workflow to populate lookup field with text field

    Okay. I will try to send some sample code snippits for the above.

    For now, you can start your workflow activity using this sample...

    msdn.microsoft.com/.../gg334455.aspx

  • Samrando Profile Picture
    Samrando 270 on at
    RE: Custom workflow to populate lookup field with text field

    Code will help sir.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Custom workflow to populate lookup field with text field

    Hi Samrando,

    You need to create a custom workflow activity and call it from the workflow. This workflow needs to be triggered on field change (Risk) which would check if the Risk = 'Yes' then call the custom workflow activity.

    In Custom workflow activity, you need the following-

    1) Extract the target entity CreditRisk record.

    2) Get the text value in field new_billid

    3) Retrieve the Billing entity record matching the text value retrieved above.

    4) Once retrieved, update the CreditRisk record with the Billing  value retrieved  in above step.

    If you are looking for code specific to any of the above step then let me know.

    Hope this help.

  • RE: Custom workflow to populate lookup field with text field

    Hi Samrando,

    Unfortunately not. I misunderstood the question. I thought you wanted a field from the parent (look up) record to populate into the child record.

    Regards,

    David

  • Samrando Profile Picture
    Samrando 270 on at
    RE: Custom workflow to populate lookup field with text field

    I have two option field (yes/no) so on change of the field called Risk. (if risk=yes) then call the custom workflow

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Custom workflow to populate lookup field with text field

    When do you want to rigger your custom code/ workflow. Are you looking for a workflow which your can run it on the existing records whic will populate the billing lookup based on the text value?

  • Samrando Profile Picture
    Samrando 270 on at
    RE: Custom workflow to populate lookup field with text field

    Hi David will your solution populate my lookup?

  • Samrando Profile Picture
    Samrando 270 on at
    RE: Custom workflow to populate lookup field with text field

    Please take kcd_invoicenumber as new_invoicenumber

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