How to Develop Sticky Footer in Microsoft Dynamics 365 CRM Portals.


Summary : How to make the Sticky Footer in Microsoft Dynamics 365 CRM Portals.



1. Navigate to Portals Tab---> Webtemplates

2. Open the Footer webtemplate and search for the following line of code

<footer role="contentinfo">

3. Replace the above line with following code.

<footer role="contentinfo" style="position:fixed;left:0;bottom:0;width:100%;">








How to Disable / Enable the Fields, Buttons and DateTime Fields with Common Code. In Dynamics 365 CRM Portals.

Summary : How to Disable / Enable the Fields, Buttons and DateTime Fields In Dynamics 365 CRM Portals.

Common Code:

function TextFieldsdisableEnable(fields, flag) {
    if (fields !== "") {
        var fieldschema = fields.split(",");
        for (var item = 0; item < fieldschema.length; item++) {
            if (fieldschema !== "" && $("#" + fieldschema[item]) !== null) {
                $("#" + fieldschema[item]).prop('disabled', flag);
            }
        }
    }
}

function DatetimeFieldsdisableEnable(fields, flag) {
    if (fields !== "") {
        var fieldschema = fields.split(",");
        for (var item = 0; item < fieldschema.length; item++) {
            if (fieldschema !== "" && $("#" + fieldschema[item]) !== null) {
                if (flag) {
                    var dateField = $("#" + fieldschema[item]);
                    // Get ‘Text’ field of Date Control
                    var displayField = dateField.nextAll(".datetimepicker").children("input");
                    // Get ‘Calendar’ Icon of Date Control
                    var dateIcon = dateField.nextAll(".datetimepicker").children("span");
                    // Make ‘Text’ field of Date Control Read-Only
                    displayField.attr("readonly", "readonly");
                    // Hide ‘Calendar’ Icon
                    dateIcon.css("display", "none");
                }
                else {
                    var dateField = $("#" + fieldschema[item]);
                    // Get ‘Text’ field of Date Control
                    var displayField = dateField.nextAll(".datetimepicker").children("input");
                    // Get ‘Calendar’ Icon of Date Control
                    var dateIcon = dateField.nextAll(".datetimepicker").children("span");
                    // Make ‘Text’ field of Date Control Read-Only
                    //displayField.attr("enabled", "enabled");
                    displayField.removeAttr("readonly");
                    // Hide ‘Calendar’ Icon
                    dateIcon.css("display", "");
                }
            }
        }
    }
}

How to Use Example:

// the first parameter is list of fields/button id's which you want to disable and second parameter pass true/false , true for disable and false for enable.

TextFieldsdisableEnable("portal_test,portal_tetsoptionset,edittBtn", true);

DatetimeFieldsdisableEnable("portal_testdate", true);



How to Create Custom Button in CRM Portals EntityForm or WebForm

Summary :  How to Create Custom Button in CRM Portals EntityForm or WebForm


Code:

$(document).ready(function () {
    var editbtn = $('<input/>').attr({ type: 'button', name: 'Edit', value: 'Edit', id: 'edittBtn', class: 'submit-btn btn btn-primary' });

// InsertButton is for the  Create Form, if you want for update form use the UpdateButton

    $("#InsertButton").after(editbtn);
    $("#edittBtn").click(function () {
       // Implement the button click logic.
    });
});




How to auto populate the Customer/Account field from current login user's customer in Dynamics 365 Portals

Summary : How to auto populate the Customer/Account field from current login user's customer in Dynamics 365 Portals

Open your EntityForm or WebForm Step and place the following code on advanced JavaScript field.

Code:

$(document).ready(function () {

    {% if user %}
        $("#customerid").val('{{user.parentcustomerid.id}}');
        $("#customerid_name").val('{{user.parentcustomerid.name}}');
        $("#customerid_entityname").val("account");
        
    {% endif %}
});

In the above code replace customerid field with your field schema name and {{user.parentcustomerid.id}} replace with you field name of user entity.
ex: {{user.yourfieldname.id}}




Popular Posts