MS CRM Portal – Get currency from CRM using Odata and bind on the portal form

                var selectedCurrencyId = $(“#transactioncurrencyid”).val();

                if (selectedCurrencyId != “”) {

                    var getCurrencyDetails = “https://mycrm.microsoftcrmportals.com/_odata/Currency?$filter=transactioncurrencyid eq guid’” + selectedCurrencyId + “‘”;

                    var oDataResponse = getODataResponse(getCurrencyDetails);

                    if (oDataResponse != null) {

                        if (oDataResponse[0].isocurrencycode != null) {

                            var amount_label = $(‘#new_amount_label’).text();

                            $(‘#new_amount_label’).text(“Amount ” + “(” + oDataResponse[0].isocurrencycode + “)”);

                        }

                        else {

                            $(‘#amount_label’).text(“Amount “);

                        }

                    }

                }

                else {

                    $(‘#amount_label’).text(“Amount “);

                }

MS CRM Portal – Get query string using liquid code and show a modal pop up on certain condition

{% assign incidentRequest = entities.[‘incident’][request.params[‘id’]] %}

            {% if incidentRequest %}

            {% assign caseOrigin = request.params[‘page’] %}

            {% if caseOrigin == ‘Source’ %}

            $(‘#myModal1’).modal({ show: true });

            {% else %}

            {% endif %}             {% endif %}

Jquery – Get the query string parameter

function GetQueryStringParams(sParam) {

    var sPageURL = decodeURI(window.location.search.substring(1));

    var sURLVariables = sPageURL.split(‘?’);

    for (var i = 0; i < sURLVariables.length; i++) {

        var sParameterName = sURLVariables[i].split(‘=’);

        if (sParameterName[0] == sParam) {

            return sParameterName[1];

        }

    }

}

MS CRM – Cloning of record using plugin

Below are the steps that can be used to clone the record in MS CRM using a plugin.

  1. Configure a postimage with the attributes that should be copied in the new cloned record.
    • Post image since the new cloned record should have the latest data of the record from which it was cloned.
  2. Write a plugin and create a new object with the name such as destination object. Assign postimage in the destination object.
  3. Call the service create method to create the destination object. This will be the cloned record.
  • Point to be considered during the registration of the plugin
    • Keep in mind the trigger criteria or the attribute on create or update of which you want to trigger this plugin.
    • On create of the cloned record check if any background process, BPF, Business rule is also triggering or are configured. If yes then you need to take care of those scenarios.

**** Other details and code will be added soon…