Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

onchange of lookup field

(0) ShareShare
ReportReport
Posted on by 80

Hi

I want to change my custom field when we choose product in opportunity . So in my opportunity when I add product and choose 'existing product' from lookup filed , my custom field (hidden) 'date' should be visible .

Can you please help me how I can achieve that , Should I create JS or plugin ?

FYI - I have created plugin already but its not doing anything when I choose existing product .

Thanks
Hemisha

  • HGajjar Profile Picture
    HGajjar 80 on at
    RE: onchange of lookup field

    Thank you ! I have used Xrm.WebApi.retrieveRecord and now its working perfectly fine . Thank you so much for help.

    Thanks

    Hemisha

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: onchange of lookup field

    Hi,

    Use below article and copy code to get the lookup value.

    www.google.com/.../amp

    Now use xrm.webapi to read custom field from product entity based on lookup guid

    learn.microsoft.com/.../retrieverecord

  • HGajjar Profile Picture
    HGajjar 80 on at
    RE: onchange of lookup field

    Hi

    I did try with JS as well but in my logic I need to check about 'product' type . I have one custom field 'is product accommodation product' and if product saved as 'accommodation' then I want to show accommodation dates while I am adding product to opportunity .

    I can make change on 'onchange' event of 'product' but I don't know how I can get product's custom field value in js and add condition according to it .

    Can you please help to write this logic ?

    Thanks

    Hemisha

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: onchange of lookup field

    Hi,

    With plugin Date field will be populated when you click save.

    If you want to see the result as soon as you select lookup then you will need to write javascript code

  • Verified answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,081 Moderator on at
    RE: onchange of lookup field

    Hi HGajjar ,

    As you need to make the date column visible. It must need to write JS. The trigger must be On Change of Product.

    If I answer your question then please mark it as verified.

    Let me know if I can provide you with more details.

    Thanks
    Regards,

    Abdul Wahab
    Power Platform & Customer Engagement Developer/Lead/Solution Architecture/Project Manager
    Direct/WhatsApp:+923323281237
    E-mail: abdulwahabubit@outlook.com
    Skype: abdul.wahabubit
    Linkedin: www.linkedin.com/.../

  • HGajjar Profile Picture
    HGajjar 80 on at
    RE: onchange of lookup field

    I made it 'create' but still nothing happening .

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: onchange of lookup field

    Hi,

    As I mentioned earlier you should specify Create in Message instead of Update.

  • HGajjar Profile Picture
    HGajjar 80 on at
    RE: onchange of lookup field

    Hi This my quick form inside Opportunity form. Now when I choose 'Existing Products' depend on product type my 'Accommodation StartDate' should trigger.

    pastedimage1666022967799v1.png

    and below is register plugin 

    pastedimage1666023168583v2.png

    Thanks

    Hemisha

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 Moderator on at
    RE: onchange of lookup field

    Hi,

    Can you please share your code?

    Also plugin step configuration screenshot.

    I think it message should be create and not update .  Update also if you are updating existing associated product

  • HGajjar Profile Picture
    HGajjar 80 on at
    RE: onchange of lookup field

    Yes I have registered my plugin on opportunityproduct on Update (message).

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,575 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans