Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Unified Interface – Dynamics 365 : Want to set field value using java script

Posted on by 900

Hi,

I am using html web resource to update form value.

Code :

window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(1);

It is working fine in simple web client but in unified interface it is not working.

Thanks,

keyur shah.

*This post is locked for comments

  • Suggested answer
    keyur7379 Profile Picture
    keyur7379 900 on at
    RE: Unified Interface – Dynamics 365 : Want to set field value using java script

    I got a solution.

    Actually unified interface does not support (1 & 0) for two option set field. It is only support true & false.

    window.parent.Xrm.Utility.confirmDialog("Do you really want to update PAN details?", function() {

                    var flag = window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").getValue();

                    if (flag) {      
                   
                       window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(false);

                    } else {
                   window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(true);
                    }

                    window.parent.Xrm.Page.data.entity.save();

                }, function() {

                });

     

    Thanks,

    Keyur Shah.

  • keyur7379 Profile Picture
    keyur7379 900 on at
    RE: Unified Interface – Dynamics 365 : Want to set field value using java script

    I have just click on html button and update form value

    PFA.

    Html-webresource-button.PNG

    It is working fine in normal web client but in Unified interface code is not working.

    window.parent.opener.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(1); - this code is not working.

     

    Update Code :

     window.parent.Xrm.Utility.confirmDialog("Do you really want to update PAN details?", function() {

                    var flag = window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").getValue();

                    if (flag) {
                    
                    window.parent.opener.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(0);
                       // window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(0);
                        //window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(0);
                       

                    } else {
                    window.parent.opener.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(1);
                        //window.parent.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(1);
                        
                    }

                    window.parent.Xrm.Page.data.entity.save();

                }, function() {


                });

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Unified Interface – Dynamics 365 : Want to set field value using java script

    Hi ,

    Are you opening the HTML in separate window or embedded in IFrame?

    If you open in popup try with this  -

    window.parent.opener.Xrm.Page.getAttribute("zep_flagupdatepan").setValue(1);

    Other wise you can try to add additional parent in your code .

    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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans