Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Answered

Update lookup field value based on option set value

(0) ShareShare
ReportReport
Posted on by 265

Hi,

I have a option set field which is being replaced with lookup field. Both the fields have same values. after removing option set and replacing with lookup, I need to update the lookup field data with option set values. How can i do it? if any one has existing code, could you please paste it below?

  • on-premise Profile Picture
    on-premise 265 on at
    RE: Update lookup field value based on option set value

    I did everything in Microsoft flows. it is working perfectly. Now i need to handle failed records. if you see the below picture, out of 3 there are two failed records, now i want these two records which are from contact entity should be in log file where i can download it after the flow execution completed. How can i do it?

    Screenshot-2021_2D00_05_2D00_07-144253.jpg

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update lookup field value based on option set value

    Hi Varma,

    As Gulshan said, you can use ‘Open in Excel Online’ function to achieve it if you can’t use power automate.

    Prerequisites:

    1.Create related records with same values from the optionset field.

    pastedimage1620353596243v1.png

    2.Optionset field and related lookup field must in the same view.

     pastedimage1620353641411v2.png

    Then you can export ‘Export to Excel’ to click ‘Open in Excel Online’.

    pastedimage1620353674555v3.png

    Open one excel dialog.

    pastedimage1620353744607v4.png

    Copy and paste value, save it.

    pastedimage1620353791737v5.png

    Track Progress.

    pastedimage1620353821434v6.png

    Waiting for the progress to 'Complete' status and navigate to entity view to refresh page;

    pastedimage1620354284163v7.png

    pastedimage1620354323435v8.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Verified answer
    Gulshan Khurana Profile Picture
    Gulshan Khurana 40 on at
    RE: Update lookup field value based on option set value

    Being a no-code guy, I would first keep both the optionset as well as the lookup fields on the form, create a view with both and then use 'Open in excel' to get the data in Excel, use copy/paste (from optionset to lookup column) and then save. Once re-import is complete then verify and then remove optionset field from the form/view.

  • on-premise Profile Picture
    on-premise 265 on at
    RE: Update lookup field value based on option set value

    Can anyone tell me how to do it in custom app? because i have some team limitations to do it in power apps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update lookup field value based on option set value

    Hi Partner,

    Has the problem been solved? Any updates?

    Please click Yes under "Did this answer your question?" to close this thread.

     pastedimage1620293026105v2.png

    Thanks. 

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update lookup field value based on option set value

    Hi Varma,

    You can check ‘Run history’ of the flow in power automate.

    pastedimage1620266233244v1.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • on-premise Profile Picture
    on-premise 265 on at
    RE: Update lookup field value based on option set value

    Do we have Error handling in power automate flows and also can we see the failed records and success records?

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Update lookup field value based on option set value

    Hi Varma,

    You can use power automate to create an automated flow to update lookup field, which maybe a simple way.

    For example, i have one custom entity, which has one optionset field and one lookup field that related to 'optionset entity' entity, i need copy optionset field value to lookup field as your requirement.

    pastedimage1620203149098v2.png pastedimage1620207070746v10.png

    1.Go Power Automate(https://us.flow.microsoft.com/en-us/ ) to create an instant flow.

    pastedimage1620203266320v3.png

    2.Set trigger--'when a row is selected'

    pastedimage1620203288734v4.png

    3.Action--'Get a row by ID'

    pastedimage1620206680787v7.png

    4.Action--'Compose', get optionset field value label with following expression and you need replace logic name with your field.

    outputs('Get_a_row_by_ID')?['body/new_optionsetfield@OData.Community.Display.V1.FormattedValue']

    pastedimage1620206911737v8.png

    5.Action--'List Rows'

    pastedimage1620207141941v11.png

    6.Action--'Initialize variable'.

    pastedimage1620207247425v12.png

    7.Action--'Condition'

    pastedimage1620207313101v13.png

    8.Branch for condition.

    8.1. Under 'Yes'

    pastedimage1620207523668v14.png

    8.2. Under 'No'

    pastedimage1620207766876v15.png

    9.Test--Select records you want to update and expand flow to run the flow you just created.

    pastedimage1620206381153v5.png

    Result:

    pastedimage1620206588454v6.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Suggested answer
    Torrado Profile Picture
    Torrado 1,270 on at
    RE: Update lookup field value based on option set value

    Hello Varma,

    You don't need to build console app to perform that data migration.

    You can do it via workflow (run using XRMToolBox Bulk Workflow Execution plugin) or Power Automate.

    Hope this helps you.

    Please mark the answer as verified if helpful. That will help others in future.

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans