How to set multiple lookup value by JavaScript d365

 

                 var lookupValue = new Array();

                if (result.entities[0] != undefined) {

                    lookupValue[0] = new Object();

                    lookupValue[0].id = result.entities[0].contactid;

                    lookupValue[0].name = result.entities[0].fullname;

                    lookupValue[0].entityType = "contact";

                }

                if (result.entities[1] != undefined) {

                    lookupValue[1] = new Object();

                    lookupValue[1].id = result.entities[1].contactid;

                    lookupValue[1].name = result.entities[1].fullname;

                    lookupValue[1].entityType = "contact";

                }

                if (result.entities[2] != undefined) {

                    lookupValue[2] = new Object();

                    lookupValue[2].id = result.entities[2].contactid;

                    lookupValue[2].name = result.entities[2].fullname;

                    lookupValue[2].entityType = "contact";

                }

                if (result.entities[3] != undefined) {

                    lookupValue[3] = new Object();

                    lookupValue[3].id = result.entities[3].contactid;

                    lookupValue[3].name = result.entities[3].fullname;

                    lookupValue[3].entityType = "contact";

                }

                formContext.getAttribute("to").setValue(lookupValue);

Comments

Popular posts from this blog

Power Automate compose vs variable

Update record when checkbox checked using JavaScript and save d365

Power pages custom button add in gried