Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Answered

JScript for Mapping Lookup fileds

Posted on by 380

Hi All,

I'm looking for help from all of the developers here.

I have two custom entities Examination (sc_examination) and Prescriptions (cs_prescription)

The examination has a lookup filed called sc_patient and sc_spceialist which contains the patient record and the doctor's record.

pastedimage1611314434349v1.png

pastedimage1611314656133v3.png

from the Examination entity, you can create a new prescription record.

However, when I create a new prescription record, doesn't auto-populate the patient and the doctor's lookup fields, so I have to add them manually every time even though I'm using a subgrid inside the examination entity.

pastedimage1611314767447v4.png

I'm looking for a Jscript that I can use on the Prescription form on Load to get the Patient and the Doctor and populat them into the prescription so I can save some time looking for the patient and the doctor.

Any help is appreciated.

  • Radoslavov Profile Picture
    Radoslavov 380 on at
    RE: JScript for Mapping Lookup fileds

    Hi,

    Yes, I tried, but you cannot map one file to multiple fields.

    The connection here is Examination - Prescription (taking the patient value from the examination and filled to the prescription)

    So there is no 1:N connection between the patience filed in the prescription and the patienceid.

    This is why i need a custom solution.

  • Verified answer
    chrispytwist Profile Picture
    chrispytwist 235 on at
    RE: JScript for Mapping Lookup fileds

    Hey Kiril,

    have you mapped these fields in the 1:N relationship manager? No JS needed for this (which also means less maintenance if APIs change)

    This might help: readyxrm.blog/.../

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans