question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] GetValue for LookupItem returns value twice

See original GitHub issue

Bug Report

Issues should only be created for items related to covered functionality.

Not covered functionality, feature requests, and questions should use the Feature Request or Question templates.

EasyRepro Version

  • Microsoft Dynamics 365 Online Version 8.2 (8.2.x) (DB 8.2.x) online
  • Microsoft Dynamics 365 Online Version 9.0 (9.0.x) (DB 9.0.x) online
  • Microsoft Dynamics 365 Online Version 9.0.2 (9.0.2) (DB 9.0.2) online
  • Microsoft Dynamics 365 Online Version 9.1 (9.1.x) (DB 9.1.x) online

UCI or Classic Web

  • UCI (XrmApp)
  • Classic Web (XrmBrowser)

Online or On Premise

  • Online
  • On Premise

Browser

  • Chrome
  • Firefox
  • IE
  • Edge

Describe the bug
After the latest update getting values from lookup items, the resulting string appears as “Value; Value” instead of just “Value”. The used lookup attributes have definitely one single element.

Special formatting / display
none

Code to reproduce

string countryValue = App.Entity.GetValue(new LookupItem(){ Name="tk_countryregionid" });
Assert.AreEqual("Germany", countryValue);

Result: 'Message: Error at "Assert.AreEqual". Expected:<Germany>. Current:<Germany; Germany>.'

Expected behavior
GetValue for LookupItem shall return single display name only.

Screenshots

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrizz-mswebcommented, Dec 11, 2020

Right!!.. Here the method

    protected void checkLookupValue(XrmApp xrmApp, string idLookup, string value)
    {
        string val = xrmApp.Entity.GetValue(new LookupItem { Name = idLookup });
        string[] correction = val.Split(';');
        Assert.AreEqual(value, correction[0]);
    }
0reactions
imartinflorescommented, Dec 11, 2020

I’d suggest to split it before Asserting

Read more comments on GitHub >

github_iconTop Results From Across the Web

N/A error while using the correct VLookup formula to get ...
Given this, just double check that both indeed are formatted as text vs. someone left-aligning a column of numbers. Let us know if...
Read more >
Is this a bug? Or I don't understand something - iPlug2 Forum
What is causing the exception. It turned out that the GetValue() method returns an incorrect value. Or am I misunderstanding something?
Read more >
Change log
Fixed a bug in vLookup "add new item" where lookup field values was not properly set. Changed the width of the lookup field...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found