Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?

(0) ShareShare
ReportReport
Posted on by 340

Here i am fetch the guid value of the record based on record name using fetch xml in the java script function. Below is the code

var fetch1 = '<fetch mapping="logical">' +
'<entity name="service">' +
'<attribute name="serviceid"/>'+
'<attribute name="name"/>'+
'<order attribute="name" descending="false" />' +
'<filter type="and">' +
'<condition attribute="name" operator="eq" value="' + servicename+ '" /> ' +
'</filter>' +
'</entity>' +
'</fetch>';

var res = svc.Fetch(fetch1);
if(res!=null)
{
if (res[0].attributes.id != null) {
testid = res[0].attributes["id"];
}
}

//lookup

lookupValue[0].id = "testid";

Error : UciError: Invalid value testid for value[0].id

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?

    Google help is a very good thing. If you are using some products of https://essay-reviewer.com and you get stuck somewhere then the best thing that you can do is just that ask for google help. They will help you with your matter.

  • Suggested answer
    Sandy Hello Profile Picture
    Sandy Hello 340 on at
    RE: How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?

    Hi Luis thanks for response

    Below code did work for me

    testid = res[0].attributes.serviceid.value;

    lookupValue[0].id = testid;

  • Suggested answer
    Marco.P Profile Picture
    Marco.P 2,405 on at
    RE: How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?
    [quote user="Sandy Hello"]

    Thanks Durgaprasad for your response.

    code changed to lookupValue[0].id = testid;

    Still giving error "UciError: Value should be of type: LookupValue[]: Parameter Name: undefined"

    [/quote]

    Hi,

    take a look at this:

    https://community.dynamics.com/365/b/goutamdas/posts/how-to-set-lookup-field-value-using-javascript-dynamics-crm

  • Sandy Hello Profile Picture
    Sandy Hello 340 on at
    RE: How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?

    Thanks Durgaprasad for your response.

    code changed to lookupValue[0].id = testid;

    Still giving error "UciError: Value should be of type: LookupValue[]: Parameter Name: undefined"

  • Suggested answer
    RE: How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?

    Hi,

    Beside Durgaprasad recomendation, you should also replace :

    testid = res[0].attributes["id"];

    with :

    testid = res[0].attributes["serviceid"];

  • RE: How to retrieve GUID value of the record using record name in order to popup lookup value on the other entity?

    Remove the double quotes while assigning the tested to the lookupvaluep[0].id.

    lookupValue[0].id = testid;

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans