web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

Update lookup field value based on option set value

(0) ShareShare
ReportReport
Posted on by 267

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?

I have the same question (0)
  • Suggested answer
    Torrado Profile Picture
    1,270 on at

    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.

  • Verified answer
    Community Member Profile Picture
    on at

    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.

  • on-premise Profile Picture
    267 on at

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

  • Community Member Profile Picture
    on at

    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.

  • Community Member Profile Picture
    on at

    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.

  • on-premise Profile Picture
    267 on at

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

  • Verified answer
    Gulshan Khurana Profile Picture
    40 on at

    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.

  • Verified answer
    Community Member Profile Picture
    on at

    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.

  • on-premise Profile Picture
    267 on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 42 Most Valuable Professional

#3
Scott Jackson UK Profile Picture

Scott Jackson UK 22

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans