Monday, May 9, 2016

Filter Activity lookup MSCRM Javascript

Hi All,

Please find the below JS code to filter Lookup Types

In my below Code am filtering requiredattendees, Call the below script in onload function

var lookuptypeIcons = "/_imgs/ico_16_2.gif:/_imgs/ico_16_8.gif";
var lookuptypenames = "contact:2:Contact,systemuser:8:User";
var lookuptypes = "2,8";

if (Xrm.Page.getAttribute("requiredattendees") != null) {
                $("#requiredattendees").focus(function () {
                    var toLookUp = $("img[attrName='requiredattendees']");
                    lookuptypes = "2,8";
                    if (toLookUp.length > 0) {
                        toLookUp[0].setAttribute("lookuptypenames", lookuptypenames);
                        toLookUp[0].setAttribute("lookuptypes", lookuptypes);
                        toLookUp[0].setAttribute("lookuptypeIcons", lookuptypeIcons);
                        toLookUp[0].setAttribute("createpermissiondictionary", "contact:true,systemuser:true");
                        toLookUp[0].setAttribute("DefaultViewId", "5DA08E4B-4493-E111-BEF2-00155DC87C59");
                        toLookUp[0].setAttribute("defaulttype", 2);
                    }
                });

            }

No comments:

Post a Comment

Day 23: Creating New Records Programmatically with JavaScript in Dataverse / MSCRM

In this Blog, we will see how to Create New Records Programmatically with JavaScript in Dataverse / MSCRM var record = {}; record.bosch_day...