Please wait, loading...

 

SET AND GET VALUE FROM LOOKUP TO LOOKUP USING JAVASCRIPT IN MSCRM 2011 , 2013

February 24, 20141

function lookuptolookup() {
    //want the code to run only when some one update form click here to know about FORM TYPE
    var formtype = Xrm.Page.ui.getFormType();
    if (formtype == 2) {
        //look have the values ” 1.id 2. name 3. entity type ” so need to be in array
        var lookup = new Array();
        lookup = Xrm.Page.getAttribute( “new_test5_lookup” ).getValue();
        if (lookup != null) {
            var name = lookup[0].name;
            var id = lookup[0].id;
            var entityType = lookup[0].entityType;
        }
        var lookup1 = new Array();
        lookup1[0] = new Object();
        lookup1[0].id = id;
        lookup1[0].name = name;
        lookup1[0].entityType = entityType;
        //set value of lookup2 same as look up 1
        Xrm.Page.getAttribute( “new_test_5_lookup_2” ).setValue(lookup1);
    }
}




SOURCE : JUST2CODE.IN
Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651
Microsoft Dynamics Community Profile

Learn more