Set Lookup Field Disable/Enable in Dynamics 365 CE Portal

Here is the snippet which helps to set the lookup field as Disable(Read-only) in the dynamics portal.

function disableLookupField(lookupId) {
    $('#' + lookupId).parent().find('.input-group-btn').hide();
    $('#' + lookupId).parent().parent().find('.input-group').css('width', '100%');
    $('#' + lookupId + '_name').prop('disabled', true);

}

Here is the snippet which helps to Enable the lookup field in the dynamics portal.

function enableLookupField(lookupId) {
    $('#' + lookupId).parent().find('.input-group-btn').show();
    $('#' + lookupId + '_name').prop('disabled', false);

}

Leave a comment