JavaScript Reusable Functions For CRM 2011 Posted by farina kidwai on May 16, 2013 in Uncategorized

JavaScript Reusable Functions For CRM 2011
Posted by farina kidwai on May 16, 2013 in Uncategorized
//-------------------------------------------------------------------------------------------------------------
// JavaScript Helper functions
//-------------------------------------------------------------------------------------------------------------
//             INDEX
//-------------------------------------------------------------------------------------------------------------
// 1)  Make Field Required
// 2)  Make Field Optional
// 3)  Get Value Of field
// 4)  Clear/Set Value of field
// 5)  Disable Field
// 6)  Enable Field
// 7)  Submit Field Always
// 8)  Make field Visible
// 9)  Hide Field
// 10) Hide Tab
// 11) Show Tab
// 12) Hide Section
// 13) Show Section
// 14) Show Left Navigation Links (might be unsupported in future rollups)
// 15) Hide Left Navigation Links  (might be unsupported in future rollups)
// 16) Set focus to field
// 17) Integer value of optionset
// 18) Text Value of optionset
// 19) Get form type whether its CREATE, UPDATE, READ-ONLY or DISBALED
// 20) Get current entity Id
// 21) Get current Entity Logical name
// 22) Save form forcefully
// 23) Stop save of form
// 24) Set date  field value to current date
// 25) Format Phone Number
// 26) ODATA and JSON to retrieve data for an entity
// 27) Verify whether current User has a particular User Role
// 28) Jquery used to copy values from one entity(opportunity)and create a record of another entity(account)
// 29) Add or Remove options from an optionset
// 30) Filtered View for Lookup
// 31) Compare Time to Boundary values and find if it falls within given slot
// 32) Display data in an HTML webresource on form after manipulating it in javascript
// 33) Refresh Ribbon
// 34) Custom Lookup with multiple choices
//-------------------------------------------------------------------------------------------------------------
// Function Code
//-------------------------------------------------------------------------------------------------------------

   //1) This function makes a field mandatory on form
   function makeRequired(fieldRequired)
   {
       Xrm.Page.getAttribute(fieldRequired).setRequiredLevel("required");
   }

   //2) This function makes a field optional on form
   function makeNotRequired(fieldNotRequired)
   {
       Xrm.Page.getAttribute(fieldNotRequired).setRequiredLevel("none");
   }

   ///-----------------------------------------------------------------------------------------------------------

   //3) This function gets the value of a field from the form
   function getValueOfAttribute(attributeName)
   {
       var attributeValue = Xrm.Page.getAttribute(attributeName).getValue() ;
       return attributeValue;
   }

   //4) This function clears value of fields on form, instead of null u can also supply a value for it
   function clearValue(fieldName)
   {
       Xrm.Page.getAttribute(fieldName).setValue(null);
   }

   ///-----------------------------------------------------------------------------------------------------------

   //5) This function disables the fields on the form
   function disableField(fieldName)
   {
       Xrm.Page.ui.controls.get(fieldName).setDisabled(true);
   }

   //6) This function enables the field on the form
   function enableField(fieldName)
   {
       Xrm.Page.ui.controls.get(fieldName).setDisabled(false);
   }

   ///-----------------------------------------------------------------------------------------------------------

   //7) This function submits a field always on form submit
   function submitFieldAlways(fieldName)
   {
       var attributes= Xrm.Page.data.entity.attributes.get(fieldName);
       attributes.setSubmitMode("always");
   }

   ///-----------------------------------------------------------------------------------------------------------

   //8) This function sets a field visible on a form
   function makeVisible(fieldName) {
       Xrm.Page.ui.controls.get(fieldName).setVisible(true);
   }

   //9)This function sets a field invisible on a form
   function makeInvisible(fieldName) {
       Xrm.Page.ui.controls.get(fieldName).setVisible(false);
   }

   ///-----------------------------------------------------------------------------------------------------------

   //10) This function hides Tab
   function hideTab(tabName) {
       Xrm.Page.ui.tabs.get(tabName).setVisible(false);
   }

   //11) This field shows Tab
   function showTab(tabName) {
       Xrm.Page.ui.tabs.get(tabName).setVisible(true);
   }

   ///-----------------------------------------------------------------------------------------------------------

    //12) This function hides Section
    function hideSection(tabName, sectionName) {
        Xrm.Page.ui.tabs.get(tabName).sections.get(sectionName).setVisible(false);
    }

    //13) This field shows Section
    function showSection(tabName, sectionName) {
        Xrm.Page.ui.tabs.get(tabName).sections.get(sectionName).setVisible(true);
    }

   ///-----------------------------------------------------------------------------------------------------------

   //14) This function shows navigation links
   function showUserNavigationLinks(NAVLINK_NAME) {
       document.getElementById(NAVLINK_NAME).parentNode.style.display = "";
   }

   //15) This function hides navigation links
   function hideUserNavigationLinks(NAVLINK_NAME) {
       document.getElementById(NAVLINK_NAME).parentNode.style.display = "none";
   }

   ///-----------------------------------------------------------------------------------------------------------

   //16) This function sets focus to a field
   function focusField(fieldName)
   {
       Xrm.Page.ui.controls.get(fieldName).setFocus(true);
   }
   ///-----------------------------------------------------------------------------------------------------------

   //17) This function gets the integer value of an optionset
   function getOptionSetValue(optionSetName)
   {
       var optionValue = Xrm.Page.getAttribute(optionSetName).getValue() ;
   }

   //18) This function gets the text value of optionset
   function getOptionSetText(optionSetName)
   {
       var optionText = Xrm.Page.getAttribute(optionSetName).getText() ;
   }

   ///-----------------------------------------------------------------------------------------------------------

   //19) This function gets formtype: 1 for CREATE, 2 for UPDATE, 3 for READONLY and 4 for DISABLED
   function getFormType()
   {
       var formType = Xrm.Page.ui.getFormType();
   }

   ///-----------------------------------------------------------------------------------------------------------

   //20) This function gets the current Entity Id
   function getEntityId()
   {
       var entityId = Xrm.Page.data.entity.getId();
   }

   //21) This function gets the current Entity Logical name
   function getentityName()
   {
       var entityName = Xrm.Page.data.entity.getEntityName();
   }

   ///-----------------------------------------------------------------------------------------------------------

   //22) This function saves the entity form
   function saveEntityForm()
   {
       Xrm.Page.data.entity.save();
   }

   //23) This function stops the form from being saved
   function stopSave(ExecutionObj)
   {
          ExecutionObj.getEventArgs().preventDefault();
   }

   ///-----------------------------------------------------------------------------------------------------------

   //24) This function sets a datefield to current date
   function setCurrentDate(fieldName)
   {
      Xrm.Page.getAttribute(fieldName).setValue(new Date());
   }

   ///-----------------------------------------------------------------------------------------------------------

   //25) This function formats phone number but we need to check the "Pass context as paramter" checkbox
   function formatPhone(context) {
       var oField = context.getEventSource();
       // Validate the field information.
       if (typeof (oField) != "undefined" && oField != null) {
           // Remove any nonnumeric characters.
           var sTmp = "";
           if (oField.getValue() != "undefined" && oField.getValue() != null) {
               sTmp = oField.getValue().replace(/[^0-9]/g, "");
           }
           // If the number has a valid length, format the number.
           switch (sTmp.length) {
               case 10:
                   oField.setValue("(" + sTmp.substr(0, 3) + ") " + sTmp.substr(3, 3) + "-" + sTmp.substr(6, 4));
                   break;

               case 7:
                   oField.setValue(sTmp.substr(0, 3) + "-" + sTmp.substr(3, 4));
                   break;
           }
       }
   }

    ///-----------------------------------------------------------------------------------------------------------

    //26) These two functions use ODATA to retrieve data of an entity through JSON
    // A json.js file should be added to form for its proper functioning
    // Below function sends the request to the server for the Account entity data
    // on Contact form and displays account type
    function getAccountData() {
        var parentCustomer = Xrm.Page.getAttribute("parentaccount").getValue();
        if (parentCustomer != null) {
            var parentCustomerName = parentCustomer[0].name;
            var parentCustomerId = parentCustomer[0].id;
            // Querying OData for account address values
            var serverUrl = Xrm.Page.context.getServerUrl();
            var ODataPath = serverUrl + "/XRMServices/2011/OrganizationData.svc";
            var retrieveReq = new XMLHttpRequest();
            retrieveReq.open("GET", ODataPath + "/AccountSet?$filter=AccountId eq guid'" + parentCustomerId + "'");
            retrieveReq.setRequestHeader("Accept", "application/json");
            retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
            retrieveReq.onreadystatechange = function () {
                getAccountDataCallBack(this);
            };
            retrieveReq.send();
        }
    }

    //This function retrieves data based on the request
    function getAccountDataCallBack(retrieveReq) {
        if (retrieveReq.readyState == 4) {
            if (retrieveReq.status == 200) {
                var oRetrievedEntity = JSON.parse(retrieveReq.responseText).d;
                if (oRetrievedEntity && oRetrievedEntity.results && oRetrievedEntity.results.length == 1) {
                    var accountType = oRetrievedEntity.results[0].CustomerTypeCode.Value;
                    alert(accountType);
                }
            }
        }
    }

    ///-----------------------------------------------------------------------------------------------------------

    //27) Verifies role of the user to make sure a functionality should be available or not
    function verifyRole() {
        if (UserHasRole("System Administrator")) {
            return true;
        }
        else {
            return false;
        }
    }

    // Checks user role
    function UserHasRole(roleName) {
        var serverUrl = Xrm.Page.context.getServerUrl();
        var userId = Xrm.Page.context.getUserId();

        var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/";
        oDataEndpointUrl += "SystemUserSet(guid'" + userId + "')/systemuserroles_association?$select=Name";

        var service = GetRequestObject();

        if (service != null) {
            service.open("GET", oDataEndpointUrl, false);
            service.setRequestHeader("X-Requested-Width", "XMLHttpRequest");
            service.setRequestHeader("Accept", "application/json, text/javascript, */*");
            service.send(null);

            var requestResults = eval('(' + service.responseText + ')').d;
            if (requestResults != null && requestResults.results.length > 0) {
                for (var i = 0; i < requestResults.results.length; i++) {
                    var result = requestResults.results[i];
                    if (result.Name == roleName) return true;
                }
            }
        }
        return false;
    }

    // Gets request object
    function GetRequestObject() {
        if (window.XMLHttpRequest) {
            return new window.XMLHttpRequest;
        }
        else {
            try {
                return new ActiveXObject("MSXML2.XMLHTTP.3.0");
            }
            catch (ex) {
                return null;
            }
        }
    }

    ///-----------------------------------------------------------------------------------------------------------

    //28) This function copies the form values from opportunity to account
    // The jquery and json files need to be present on the entity where this function is added.
    function copyValues() {
        var context = Xrm.Page.context;
        var serverUrl = context.getServerUrl();
        var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
        var CRMObject = new Object();

        // Specify the ODATA entity collection
        var ODATA_EntityCollection = "/AccountSet";

        var oppId = Xrm.Page.data.entity.getId();

        var customerId = Xrm.Page.getAttribute("parentaccountid").getValue();
        if (customerId != null) {
            var customerIdValue = customerId[0].id;
            var customerLogicalValue = customerId[0].typename;
        }

        var contactId = Xrm.Page.getAttribute("parentcontactid").getValue();
        if (contactId != null) {
            var contactIdValue = contactId[0].id;
            var contactLogicalValue = contactId[0].typename;
        }

        var purchaseProcess = Xrm.Page.getAttribute("purchaseprocess").getValue();
        var custType = null;
        if (purchaseProcess == 0) {
            custType = 4;
        }
        if (purchaseProcess == 1) {
            custType = 6;
        }
        if (purchaseProcess == 2) {
            custType = 12;
        }

        var oppName = Xrm.Page.getAttribute("name").getValue();
        var budget = Xrm.Page.getAttribute("budgetamount").getValue();
        budget = formatCurrency(budget);

        // Define attribute values for the CRM object you want created
        if (customerIdValue != null) {
            CRMObject.ParentAccountId = {
                __metadata: { type: "Microsoft.Crm.Sdk.Data.Services.EntityReference" },
                Id: customerIdValue,
                LogicalName: customerLogicalValue
            };
        }

        if (contactIdValue != null) {
            CRMObject.PrimaryContactId = {
                __metadata: { type: "Microsoft.Crm.Sdk.Data.Services.EntityReference" },
                Id: contactIdValue,
                LogicalName: contactLogicalValue
            };
        }

        CRMObject.CustomerTypeCode = { Value: custType };
        CRMObject.Name = oppName;
       // CRMObject.revenue = { Value: budget };
        CRMObject.Todd_EstimatedAnnualRevenue = { Value: budget };

        // Parse the entity object into JSON
        var jsonEntity = window.JSON.stringify(CRMObject);

        // Asynchronous AJAX function to Create a CRM record using OData

        $.ajax({ type: "POST",

            contentType: "application/json; charset=utf-8",

            datatype: "json",

            url: serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection,

            data: jsonEntity,

            beforeSend: function (XMLHttpRequest) {

                // Specifying this header ensures that the results will be returned as JSON.
                XMLHttpRequest.setRequestHeader("Accept", "application/json");

            },
            success: function (data, textStatus, XmlHttpRequest) {

                alert("Record Creation Succesful");
                var NewCRMRecordCreated = data["d"];

            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert("Record Creation Failed");
            }
        });
    }

    // Function that formats revenue amount to currency
    function formatCurrency(num) {
        num = isNaN(num) || num === '' || num === null ? 0.00 : num;
        return parseFloat(num).toFixed(2);
    }

    ///-----------------------------------------------------------------------------------------------------------

    //29) Function which conditionally adds and removes options from optionset
    function optionSetValueChange() {

        flagValue = false;

        if (flagValue) {

            // To Add options
            var optn1 = new Option();
            optn1.text = "Any";
            optn1.value = 1;
            Xrm.Page.getControl("preferredcontactmethodcode").addOption(optn1);

            var optn2 = new Option();
            optn2.text = "E-mail";
            optn2.value = 2;
            Xrm.Page.getControl("preferredcontactmethodcode").addOption(optn2);

            var optn3 = new Option();
            optn3.text = "Phone";
            optn3.value = 3;
            Xrm.Page.getControl("preferredcontactmethodcode").addOption(optn3);
        }
        else {

            // To remove options
            Xrm.Page.getControl("preferredcontactmethodcode").removeOption(1);
            Xrm.Page.getControl("preferredcontactmethodcode").removeOption(2);
            Xrm.Page.getControl("preferredcontactmethodcode").removeOption(3);
        }
    }

///-----------------------------------------------------------------------------------------------------------

    //30) This function filters the Account Lookup to display only accounts of current owner
    function setAccountLookup() {
        var viewId = "{00000000-0000-0000-00AA-000000666000}";
        var entityName = "account";
        var viewDisplayName = "My Owned Accounts";

        // Build fetchxml
        var fetchXml = "<fetch distinct='false' mapping='logical' output-format='xml-platform' version='1.0'>";
        fetchXml += "<entity name='account'> <attribute name='name'/>";
        fetchXml += "<attribute name='primarycontactid'/> <attribute name='telephone1'/>";
        fetchXml += "<attribute name='accountid'/> <order descending='false' attribute='name'/>";
        fetchXml += "<filter type='and'> <condition attribute='ownerid' operator='eq-userid'/>";
        fetchXml += "</filter> </entity> </fetch>";

        // Build layoutxml
        var layoutXml = "<grid name='resultset' object='1' jump='name' select='1' icon='1' preview='1'>" +
                                                         "<row name='result' id='accountid'><cell name='name' width='300' />" +
                             "<cell name='primarycontactid' width='150' />" +
                                                         "<cell name='telephone1' width='100' /></row></grid>";

        // Add the custom view
        Xrm.Page.getControl("parentcustomerid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
    }

 ///-----------------------------------------------------------------------------------------------------------

    //31) This function compares last campaign datetime on contact time with the boundary values for time.
    function compareTime() {
        var appointmentDate = Xrm.Page.getAttribute("lastusedincampaign").getValue();
        if (appointmentDate != null) {
            var dateEntered = new Date(appointmentDate);
            var morningTime = new Date(appointmentDate);
            morningTime.setHours(7, 0, 0, 0); // 7 am
            var eveningTime = new Date(appointmentDate);
            eveningTime.setHours(19, 0, 0, 0); // 7 pm

            isTimeBefore7 = dateEntered.getTime() - morningTime.getTime();
            if (isTimeBefore7 < 0) {
                alert("TIME BEFORE 7 am");
            }
            isTimeAfter7 = eveningTime.getTime() - dateEntered.getTime();
            if (isTimeAfter7 < 1) {
                alert("TIME AT OR AFTER 7 pm");
            }
        }
    }

  ///-----------------------------------------------------------------------------------------------------------
    //32) These two functions need to be in two web resources. They actually pass data from the javascript
    //    on an entity to the html webresource on the enity form.

    // The function below is a simple value reading function, that passes these values as paramters to an IFRAME
    // It needs to be written in a JScript webresource.
    function passToHtml() {

        var accountName = Xrm.Page.getAttribute("name").getValue();
        var accountNumber = Xrm.Page.getAttribute("accountNumber").getValue();
        var phone = Xrm.Page.getAttribute("telephone1").getValue();

        // In this case, when Webresource is inserted on the entity form; the display name given to it is WebResource_EntityInfo
        var IFrame = Xrm.Page.ui.controls.get("WebResource_AccountEntityInfo");

        // This url is the path of the HTML webresource created plus a "?Data=" suffix
        var url = "/WebResources/new_AccountEntityInfo.html?DATA=";

        // This variable contains the info that needs to be displayed in HTML along with labels
        var data = "Account Name:!" + accountName + "^AccountNumber:!" + accountNumber + "^Phone:!" + phone;
        var newTarget = Xrm.Page.context.getServerUrl() + url + escape(data);

        //Pass values to the HTML page
        IFrame.setSrc(newTarget);
    }

    // This function accepts data sent from the Jscript file and displays it. The phone number sent is clickable.
    // It needs to be written in the HTML web resource - new_AccountEntityInfo.html.
    <HTML xmlns="http://www.w3.org/1999/xhtml"> Data Parameters Page</TITLE>
    <STYLE type=text/css>body{font-family: Segoe UI, Tahoma, Arial;margin: 0;
    padding: 0;background-color: white;}tbody,p{font-family: Segoe UI;background-color: white;font-size: 12;
    margin 0;padding: 0;}th{font-family: Segoe UI; font-weight: bold}</STYLE>

    <SCRIPT language=jscript type=text/jscript>
        function getDataParam()
        {   //Get the any query string parameters and load them
            //into the vals array

            var vals = new Array();

            if (location.search != "")
            {
                vals = location.search.substr(1).split("&");
                for (var i in vals)
                {
                    vals[i] = vals[i].replace(/\+/g, " ").split("=");
                }
                //look for the parameter named 'data'
                var found = false;
                for (var i in vals)
                {
                    if (vals[i][0].toLowerCase() == "data")
                    {
                        parseDataValue(vals[i][1]);
                        found = true;
                        break;
                    }
                }
            }
            else
            {
                noParams();
            }
        }

        function parseDataValue(datavalue)
        {
            if (datavalue != "")
            {
                datavalue = unescape(datavalue);
                var vals = new Array();

                vals = decodeURIComponent(datavalue).split("^");
                for (var i in vals)
                {
                    vals[i] = vals[i].replace(/\+/g, " ").split("!");
                }

                //Create a table and header using the DOM
                var oTable = document.createElement("table");
                var oTBody = document.createElement("tbody");

               //Loop through vals and create rows for the table
                var oTRow = document.createElement("tr");
                for (var i in vals)
                {                  
                    var oTRowTD1 = document.createElement("th");
                    oTRowTD1.innerText = vals[i][0];

                    var oTRowTD2 = document.createElement("td");
                    oTRowTD2.innerText = vals[i][1] + "\t\t";

                                        if (oTRowTD1.innerText == "Phone:")
                                        {
                                            var phno = vals[i][1];
                                            if (phno != null)
                        {
                            var link = "javascript:clickToDial_OnClick(" + phno + ")";
                            var anchor = "<a href='" + link + "'>Phone:</a>";
                                                oTRowTD1.innerHTML = anchor;
                                            }
                                        }               
                    oTRow.appendChild(oTRowTD1);
                    oTRow.appendChild(oTRowTD2);
                    oTBody.appendChild(oTRow);
                }
                oTable.appendChild(oTBody);
                document.body.appendChild(oTable);
            }
            else
            {
                noParams();
            }
        }
        function noParams()
        {
            var message = document.createElement("p");
            message.innerText = "No Claimant Information";
            document.body.appendChild(message);
        }
        function clickToDial_OnClick(phoneNumber) {
            try {

                if (confirm('Do you wish to dial the number ' + phoneNumber + '?')) {
                    window.top.location.href = 'callto:' + phoneNumber;
                }
            } catch (e) { alert("There was a problem handling the image click event: " + e.message); }
        }
    </SCRIPT>

   <META charset=utf-8></HEAD>
   <BODY contentEditable=true onload=getDataParam();></BODY></HTML>

  ///-----------------------------------------------------------------------------------------------------------

      //33) This function can be used to refresh the ribbon in order to call onload functionality
      // of ribbon on change as well
          function refreshRibbon() {
           Xrm.Page.ui.refreshRibbon();
          }

  ///-----------------------------------------------------------------------------------------------------------

        /* 34) Custom Lookup with multiple choices
        Custom lookup in CRM is oriented only for one entity.
        Following is way to add possibility to select from some entities in one lookup.

        For custom lookup "originatingleadid" oriented on Lead entity in order to select from views of three different entities: Lead, Contact, User.
        some customization is done on opportunity entity,
        Create three hidden text fields:
        new_type - to save lookup type
        new_guid - to save lookup guid
        new_name - to save lookup name.

        Include three javascript function:
        1. function to handle OnChange event on lookup.
        */

        function onChange()
        {
         var originatingLeadValue = Xrm.Page.getAttribute("originatingleadid").getValue();
         if (IsNull(originatingLeadValue) || originatingLeadValue[0].type == "4")
         {
          // Lookup is null or there is a Lead, need to clear hidden fields. To clear one of them will be enough, we will be check this field during onload.
          Xrm.Page.getAttribute("new_guid").setValue(null);
         }
         else
         {
          // Lookup contains Contact or User, so need to store lookup properties to our hidden fields.
          Xrm.Page.getAttribute("new_type").setValue(originatingLeadValue[0].type);
          Xrm.Page.getAttribute("new_guid").setValue(originatingLeadValue[0].id);
          Xrm.Page.getAttribute("new_name").setValue(originatingLeadValue[0].name);
         }
        }

        //2. function to handle OnSave event on Opportuniry Form.
        function onSave()
        {
         var originatingLeadValue = Xrm.Page.getAttribute("originatingleadid").getValue();
         if (!IsNull(originatingLeadValue) && originatingLeadValue[0].type != '4')
         {
          Xrm.Page.getAttribute("originatingleadid").setValue(null);
         }
        }

        // 3. function to handle OnLoad event on Opportunity Form.
        function onLoad()
        {
         lookuptypeIcons = '/_imgs/ico_16_2.gif:/_imgs/ico_16_4.gif:/_imgs/ico_16_8.gif';
         lookuptypenames = 'contact:2:Contact,lead:4:Lead,systemuser:8:User';
         lookuptypes = '2,4,8';
         var savedId = Xrm.Page.getAttribute("new_guid").getValue();
         var savedType = Xrm.Page.getAttribute("new_type").getValue();
         var savedName = Xrm.Page.getAttribute("new_name").getValue();
         var savedEntityName = savedType == "8" ? "systemuser" : "contact";
         document.getElementById("originatingleadid").setAttribute("lookuptypes", lookuptypes);
         document.getElementById("originatingleadid").setAttribute("lookuptypenames", lookuptypenames);
         document.getElementById("originatingleadid").setAttribute("lookuptypeIcons", lookuptypeIcons);
         document.getElementById("originatingleadid").setAttribute("defaulttype", "4"); // default type - Lead entity
         var originatingLeadValue = Xrm.Page.getAttribute("originatingleadid").getValue();
         if (IsNull(originatingLeadValue) && !IsNull(savedId))
         {
          var value = new Array();
          value[0] = new Object();
          value[0].displayClass = "ms-crm-Lookup-Item";
          value[0].keyValues = new Object();
          value[0].values = new Object();
          value[0].onclick = "openlui()";
          value[0].id = savedId;
          value[0].entityType = savedEntityName;
          value[0].typename = savedEntityName;
          value[0].name = savedName;
          value[0].type = savedType;
          Xrm.Page.getAttribute("originatingleadid").setValue(value);
         }
        }

Yorumlar

Bu blogdaki popüler yayınlar

CRM search can not find deactive records

Microsft CRM makale arama seçeneklerinin default değerini değiştirme