Tuesday, June 7, 2022

Disable Case Deflection in Power Apps Portal

In the scenario where you want to hide the search box, you need to edit the page template. It could be something like this:




Please have in mind that this is a customization made directly on the template and it might break other functionalities. 

Tuesday, January 25, 2022

Power Apps Portal Useful JS

1. If you want to hide Subgrid Create button based on condition you can use the below script.

You have to apply the below script on Basic Forms --> Open your Basic Form --> go to Additional Settings --> add in Custom Javascript.


// Based on Condition Hide Subgrid Create Button

$(document).ready(function(){


    // hide create button once sub-grid contains a record

    $(".entity-grid").on("loaded", function () {

        var tBody = $(this).find("tbody")

        if(tBody.length > 0)

        {        

            var Value=$("#its_budgeted").val();

            if(Value==2)

            {

               $(".grid-actions").hide();

            }

        }

    });

});


2.  Hiding Lookup values on Portal Forms, use the below script on Basic Form.

You have to apply the below script on Basic Forms --> Open your Basic Form --> go to Additional Settings --> add in Custom Javascript.

//Hide Lookup Values

$(document).ready(function() {  

$("#msdyn_serviceaccount").parent().parent().hide();
$("#msdyn_serviceaccount_label").parent().parent().hide();
$("#msdyn_serviceaccount_lookupmodal").parent().parent().hide();

 }

 );


3. To setup Lookup Value on Portal form, use the below script on Basic Form.

You have to apply the below script on Basic Forms --> Open your Basic Form --> go to Additional Settings --> add in Custom Javascript.

$(document).ready(function () {

  //To Set Lookup value use the below code

  $("#msdyn_serviceaccount_name").attr("value","Venkat");

  $("#msdyn_serviceaccount").attr("value","DAC92DEC-C94A-EC11-8C62-002248811BA2");

  $("#msdyn_serviceaccount_entityname").attr("value","account");


    //To Retrieve Value use the below line

    //var aa=$("#msdyn_serviceaccount").val();

    //alert(aa);

  });

4. Disable Lookup Selection, use the below script.

//Disable Lookup Values
$(document).ready(function() {
$("#msdyn_serviceaccount_name").parent().find('.input-group-btn').hide();
$("#its_divisiondept_name").parent().find('.input-group-btn').hide();
}
);


5. Automatically reopen last created record, use the below script.

You have to apply the below script on Lists --> Open your List Form --> go to Options --> add in Custom Javascript.

var existingRecordsList;
var firstLoad = true;
$(document).ready(function() {
var list = $(".entitylist.entity-grid").eq(0);
list.on("loaded", CheckNewRecord);
});
function CheckNewRecord() {
var list = $(".entitylist.entity-grid").eq(0);
var newRecordFound = false;
var newRecordId;
// first load
if (firstLoad) {
existingRecordsList = [];
}
if (existingRecordsList.length != $(list).find('table tbody tr').length) {
var tempRecordList = [];
$(list).find('table tbody tr').each(function() {
var id = $(this).attr("data-id");
tempRecordList.push(id);
if (!firstLoad && !newRecordFound && existingRecordsList.indexOf(id) < 0) {
newRecordId = id;
newRecordFound = true;
}
});
// reload global variable with items in temp list
existingRecordsList = tempRecordList;
if (newRecordFound && !!newRecordId) {
// open edit modal
var newRecordElement = $(list).find("[data-id='" + newRecordId + "']");
$(newRecordElement).find("a.edit-link").eq(0).trigger("click");
}
}
firstLoad = false;
}


6. Comparing Past Date with Current Date

$(document).ready(function () {
try{
if (typeof (Page_Validators) == 'undefined') return;
// Create new DOB validator
var dobValidator = document.createElement('span');
dobValidator.style.display = "none";
dobValidator.id = "dobValidator";
dobValidator.controltovalidate = "its_accountingdate";
dobValidator.errormessage = "<a href='#its_accountingdate_label'>Accounting Date should not be past date.</a>";
dobValidator.validationGroup = "";
dobValidator.initialvalue = "";
dobValidator.evaluationfunction = function () {
var dobValue = $("#its_accountingdate").val();
var dob=moment(new Date(dobValue),'DD/MM/YYYY');
var today =moment(new Date(),'DD/MM/YYYY');
if (dob < today) {
return false;
}
return true;
};
// Add the dobValidator to Web Page’s validators array
Page_Validators.push(dobValidator);
// Attach event handler of the validation summary link
$("a[href='#its_accountingdate_label']").on("click", function () { scrollToAndFocus('its_accountingdate_label','its_accountingdate');

});
}
catch(e)
{
alert("Error during DOB validation – "+e.description);
}
});

7. Apply JS on Onchange of Field, use the below script.

$(document).ready(function () {
// register onPrimaryChange function to run on change of its_name field
$("#its_name").change(onPrimaryChange);
//$("#its_name").change();
});
function onPrimaryChange(){
alert("Test");
}

8. Associate Subgrid Record, use the below script on Subgrid Basic Form

$(document).ready(function() {
$('#its_workorderid').val("{{request.params['id']}}").closest('.lookup').hide();
});

Monday, January 24, 2022

How to add missing CRM Custom Field in Dataverse Project Tasks

Recently we had a requirement to add new field to existing Project Task. So we have created new custom field in CRM but when we are trying to add this custom field in existing Project Task we could not find this field even after Refresh Tables option.

So overcome and resolve this issue, follow the below steps in Dataverse Project Task.

Note: Advanced query and filtering should be enabled.

1. Open the Project -> Project Task. 




2. Click on Advanced query and filtering on the header

3. Click on url on the right hand side

4. Add missing custom field schema name and click on Save button.



5. Again click on Schema that you will find above url 

6. Add the same schema name with the data type and click on Save



7. With this you will be able to add missing custom filed and map in your project tasks. 


Wednesday, January 12, 2022

Limit access to CRM Online to users with trusted IP addresses to reduce unauthorized access

You can limit access to CRM Online to users with   trusted IP addresses to reduce unauthorized access. When trusted IP address restrictions are set in a user’s profile and the user tries to log in from an untrusted IP address, access to CRM Online is blocked.

Requirements

A subscription to Azure Active Directory Premium.

A federated or managed Azure Active Directory tenant.

Federated tenants require that multi-factor authentication (MFA) be enabled.

Additional security considerations

IP restriction is only enforced during user authentication. This is done by the Azure Active Directory Conditional Access capability. CRM Online sets a session timeout limit to balance protecting user data and the number of times users are prompted for their sign-in credentials. Trusted IP restriction for devices (including laptops) is not applied until the CRM Online session timeout expires.

For example, a trusted IP restriction is setup to only allow access to CRM when users are working from a corporate office. When a CRM user signs in into CRM using their laptop from their office and establishes a CRM session, the user can continue to access CRM after leaving the office until the CRM session timeout expires. This behavior also applies to mobile and offsite connections such as: CRM for phones and tablets, and Dynamics CRM App for Outlook.

Create security group (optional)

You can restrict access to all Users or groups of users. It’s more efficient to restrict by a group if only a subset of your Azure Active Directory (AAD) users are accessing CRM Online.
1. Sign in to your Azure portal .
2. Click Browse > Active Directory, and then select your CRM Online directory.
3. Click Groups > Add Group, and then fill in the settings to create a new group.



4. Click the group you created and add members.


Create a location based access rule

Access restriction is set using Azure Active Directory (AD) Conditional Access. You control Conditional Access through an access rule.
 
Note
Setting Conditional Access is only available with an Azure Active Directory Premium license. Upgrade your Azure AD to a Premium license in the Office 365 admin center (https://portal.office.com > Billing >Purchase services).
1. Sign in to your Azure portal.
2. Click Browse > Active Directory, and then select your CRM Online directory.
3. Click Applications, and then click the Dynamics CRM Online web application.


4. Click Configure.


5. Set the following on the Properties page:
Set Enable Access Rule to On.
Optional: Set Apply to to Groups.
Optional: Click Add Group to select a group.
Set Rules to Block access when not at work.




Click Save > OK.
Click Click here to define/edit your work network location.








Tuesday, January 11, 2022

Restore Service Management from Customer Service Hub

If you are unable to see Service Management from Customer Service Hub.


Please follow the below mitigation steps to restore Service Management from Customer Service Hub.

1) Go to Advanced Settings then customizations

2) Customize the system 

3) Click Client Extensions

4) Select Customer Service Hub

5) Click solution layers

6) Remove the active layer ( Active -> 3 dots -> Remove active customizations )

7) Publish all customization

Please wait for few minutes for the changes to reflect and ‘Service management’ should appear.