Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Check Associated Record Value Javascript

Posted on by 15

Hi

Hope somebody can help. I'm trying to create some code that checks an associated (let's call it 'Preference) record's value when selecting the same value from a new ('Preference') record for a contact. It should then display an error message if that value within an existing ("Preference') record exists. Sorry if that's a bit vague. New to this.

Any help would be super appreciated!

  • M4ttg1lbert Profile Picture
    M4ttg1lbert 15 on at
    RE: Check Associated Record Value Javascript

    The latter is probably favourable. Will give it a go when I get a chance.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Check Associated Record Value Javascript

    Hi,

    If you want to check/retrieve value from other record in JavaScript, you will have to use WebAPI to query that record. Take a look at the below article-

    community.dynamics.com/.../get-lookup-value-from-other-entity-and-set-it-on-the-form-using-web-api-in-microsoft-dynamics-crm

    Hope this helps.

  • Suggested answer
    Marco.P Profile Picture
    Marco.P 2,405 on at
    RE: Check Associated Record Value Javascript

    Hi,

    may I ask, why don't you use a duplicate detection rule?

    https://rocketcrm.co.uk/dynamics-365-duplicate-detection-rules/

    It seems to me like the perfect choice to fulfill your requirement!

    If you wanna do it using ha, then write down a function that retrieve the preference record and add a validation function like this:

    hihaj.com/howto-client-side-validation-of-dynamics-crm-forms-1c84cd02c15a

    Hope it helps!


    If you found the answer helpful for you or other readers, please mark as Verified.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans