Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Auto populate the lookup field

Posted on by Microsoft Employee

Hi,

I am new to CRM . I created a two entities called (new_university) and (new_student),

In  new_student  entity i have a fields called University ID which is plain text filed and University code Which is a lookup field and in new_university  entity created a field called University ID (plain text).Now the problem is when i enter the student_university ID(plain text) in new_student entity it  should compare with University_University ID (plain text) .if it equals, the value should be set to the lookup field in student entity(University code). i tried to do with workflow but it is not working

My workflow conditions:

If student_university ID equals to university_university ID ,then

Update student_university code 

so, I am trying to do with Java Script ,but i am new to java script 

Can anyone help me to achieve this 

Thanks in Advance 

John Adrew

CRM Developer 

 

*This post is locked for comments

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Auto populate the lookup field

    Hi John,

    You can able to do it through custom workflow, plugin and JS. Kindly follow below steps to do it in any way:

    1. Retrieve student entity and filter it through university Id.

    2. If you have record count is equals to one.

    3. Fill out your desire lookup field.  

    If you have any query do let me know.

    Thanks

    Regards,

    AW

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Auto populate the lookup field

    Take a look at the following.

    It contains the steps, sample code and a sample solution you can download.

    I saw multiple requests for the same this week, so decided to write something up...

    community.dynamics.com/.../populate-lookup-field-based-on-related-entity-value

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Auto populate the lookup field

    Hi Aric ,

    Thanks for reply,

    I tried using  REST Builder . but the thing i am not able to compare the values from 2 different fields and i am very new to java script . i am not able to retrieve the value from university Entity  with out any entity reference ,

    Thanks

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Auto populate the lookup field

    Take a look at the following:

    community.dynamics.com/.../263071

    I think this is a very similar question which might provide you an answer for what you are looking for. At this point it is not yet verified, but I think the answers you see there should give you the right approach on how to implement this.

    Basically you need to use SDK.REST to retrieve the data from the related entity, and get the Guid of the entity you are looking for, and then populate the lookup field from the value you retrieved from the REST call.

    Hope this helps.

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

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans