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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer Service forum

How to get the data from a LookUp field when the record does no exist

(0) ShareShare
ReportReport
Posted on by 107

Hello friends, I have the following situation

1.- Contact Center Entity
2.- Entity Contact

I need to create contacts automatically from contact center through WebApi. The problem arises when the lookup field recognizes that the record does not exist and highlights it in red.

The user will not have the privilege of creating contact records and therefore I will have to do it through Web Api which is simple, I just can not get the value of the lookup field when it is highlighted in red.

5556.evidence.png

For the image attached you can see that the record "example record" does not really isn't contact. Through the web api i need to send in to variable the value "example record" as Fisrt Name and LastName respectively.

Any idea how to capture that value?

I have the following function in the LookUp OnChange

function RequestContact (executionContext)

{

var formContext = executionContext? executionContext.getFormContext (): Xrm.Page; // get formContext
var requestedID = formContext.getAttribute ("mme_personcontact"). getValue ();
alert (requestedID);

But it does not throw any value

Categories:
I have the same question (0)
  • Verified answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Just tried to see if we get any value for the values which does not exists. Unfortunately when you type in something in the lookup it does an internal search and ether populates the exact value or gives you option to select from the searched results. In both the case, it doesn't save that text value in the textbox hence when you do getValue(), it returns null. So there is no supported way to get that text.

    However it does puts that value in a SPAN element so you can get the value using unsupported way. You can try this but as this is unsupported, it may not work in the future updates.

    document.getElementById("<schemanameoflookupfield>_lookupValue").innerText

    E.g. document.getElementById("parentcustomerid_lookupValue").innerText

    Hope this helps.

  • Verified answer
    Shiongo Profile Picture
    107 on at

    Thanks Ravi, Problem Solver like always

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans