Show Ribbon Buttons Only in Mobile Or Tablets in CRM

Configure the below Enable Rule for the required ribbon buttons to show Only in Mobile/ Tablets and not in CRM Web.

Show Or Hide Ribbon Buttons in Mobile or Tablets

Use the below function,

function ShowOrHideDeviceButtons() {
 var showOrHideFlag = false;
 // Form Factor = 2 - Tablet
 // Form Factor = 3 - Phone
 if (Xrm.Page.context.client.getClient() == "Mobile" && (Xrm.Page.context.client.getFormFactor() == 2 || Xrm.Page.context.client.getFormFactor() == 3)) {
 // Add code that should only run in CRM for phones here
 showOrHideFlag = true;
 }
 return showOrHideFlag;
}

Output:

Dynamics 365 for phones App View: Highlighted ribbon buttons can be seen only in Mobile/ Tablet.

Show Or Hide Ribbon Buttons in Mobile or Tablets in CRM App

CRM Web View: Buttons are not displayed in CRM Web View.

Show Or Hide Ribbon Buttons in Mobile or Tablets in CRM Web

Hope you learned a new thing today :):):)

 

Advertisements

How to retrieve multiple records in Dynamics 365 Online V 9.X using JavaScript WebAPI?

Below is the latest Syntax available to retrieve multiple records in Dynamics 365 Online V9.X using JavaScript,

Syntax:

Xrm.WebApi.retrieveMultipleRecords(entityLogicalName, options, maxPageSize).then(successCallback, errorCallback);

Parameters:

Name Type Required Description
entityLogicalName String Yes The entity logical name of the records you want to retrieve. For example: “account”.
options String No OData system query options or FetchXML query to retrieve your data.

·        Following system query options are supported: $select, $top, $filter, $expand, and $orderby.

·        To specify a FetchXML query, use the fetchXml attribute to specify the query.

NOTE: You must always use the $select system query option to limit the properties returned for an entity record by including a comma-separated list of property names. This is an important performance best practice. If properties aren’t specified using $select, all properties will be returned.

You specify the query options starting with ?. You can also specify multiple system query options by using & to separate the query options.

See examples later in this topic to see how you can define the options parameter for various retrieve multiple scenarios.

maxPageSize Number No Specify a positive number that indicates the number of entity records to be returned per page. If you do not specify this parameter, the default value is passed as 5000.

If the number of records being retrieved is more than the specified maxPageSize value, nextLink attribute in the returned promise object will contain a link to retrieve the next set of entities.

successCallback Function No A function to call when entity records are retrived. An object with the following attributes is passed to the function:1

·        entities: An array of JSON objects, where each object represents the retrieved entity record containing attributes and their values as key: value pairs. The Id of the entity record is retrieved by default.

·        nextLink: String. If the number of records being retrieved is more than the value specified in the maxPageSize paramter, this attribute returns the URL to return next set of records.

errorCallback Function No A function to call when the operation fails.

Return Value:
On success, returns a promise that contains an array of JSON objects (entities) containing the retrieved entity records and the nextLink attribute (optional) with the URL pointing to next set of records in case paging (maxPageSize) is specified and the record count returned exceeds the paging value.

Example:
Create a new Javascript Webresource (new_Account.js) and copy paste the below code in it and call it on OnLoad of the Account Form.

After that, open an existing account record.

function RetrieveAllAccountRecords() {
 var outputText = "Account Name\t\t\tPhone\n---------------------------------------------------\n";
 Xrm.WebApi.retrieveMultipleRecords("account", "?$select=name,telephone1").then(
 function success(result) {
 for (var accountRecordsCount = 0; accountRecordsCount < result.entities.length; accountRecordsCount++) {
 outputText += result.entities[accountRecordsCount].name + "\t\t" + result.entities[accountRecordsCount].telephone1 + "\n";
 }
 Xrm.Utility.alertDialog(outputText, null);
 },
 function (error) {
 // Handle error conditions
 Xrm.Utility.alertDialog(error.message, null);
 });
}

Output:

Dynamics 365 Retrieve All Records V9.X

Hope you have successfully retrieved all Account records using New Syntax.

How to Install/ Uninstall Sample Data in CRM?

Follow the below steps to Install/ Uninstall Sample Data from Dynamics 365 CRM Online,

Step 1: Open Dynamics 365 Online. Goto Settings -> Data Management and click on Sample Data.

Sample Data Settings Under Data Management

Step 2: If you have not installed any Sample Data earlier, it will show Sample Data button. Click on it to import sample data given by CRM OOB.

Sample Data - Install Sample Data

Step 3: After clicking on it, Goto Imports under Data Management to see the Sample Data import records Status.

Sample Data - Imports Status

Step 4: Once all the records Status Reason change to Completed, we can Sample records in the Entities Specified in the Import Name.

For an Instance, below is the Contacts Sample Data imported during this operation,

Contacts Sample Data

Step 5: If you want to Uninstall the same data imported during this operation, Goto Settings -> Data Management and click on Sample Data.

Then click on Remove Sample Data button.

Remove Sample Data

Step 6: Records deletion status can be seen under Settings -> Data Management -> Bulk Record Deletion.

Bulk Record Deletion record Status

Hope you learned this feature in CRM :):):)

 

How to add/ edit/ remove subjects in CRM?

Subjects field is a commonly used in Products, Cases, Sales Literature and Articles. Using this, we can organize them in a Tree structure.

Follow the below steps to Add/ Edit/ Remove subjects.

Step 1: Go to Settings -> Business Management -> Subjects

Settings - Subjects - Business Management Setting

Step 2: Select the required Subject. Add/ Edit/ Remove subjects using Common Tasks Area.

In this below screen shot, I have selected Subject Products and added Product 1 and Product 2.

Subject Common Tasks Area

Step 3: Open New Case/ Articles record to see the updated Subjects.

Case Subject