Saturday, 22 September 2018

Execute MS CRM Workflow (On Demand) Using Ribbon Button

Execute MS CRM  (On Demand) Workflow CRM / Custom : Using Ribbon Button OR  Web Resource
Any entity (CRM / Custom) ribbon button can execute workflow
Execute this process have many steps below mention
1. Create Workflow 
2. Create Java Script
3. Create Button 

Create Workflow :
Create workflow as a regular creation example below screen shot

Create Java Script:
Create Java script Web resource
this web resource can add on entity (which entity can be execute)
two option for execution workflow using java script
1.button click 2. run java script method
below mention screen shot : 
Create Button :

Create simple button below mention screen shot

Note:- 
Workflow execute when trigger JS method
suppose workflow execute on page load. so that ExecuteWorkflowUsingRibbonButtonClick() can call page load event.


Conclusion :-
Call workflow properly after that show alert message other wise workflow is not execute (have any error for syntax / entity id / workflow id/ version)


thanks





Tuesday, 15 November 2016

Import / Export Subject Tree From MS Dynamics CRM

Note : Fallow below Steps

1. Configuration Migration tool alone using the link below:
 http://crmchap.co.uk/wp-content/uploads/2018/05/Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf_.9.0.2.3.zip

2. Go to This downloaded  CrmSdk Tool
 .. \Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf.9.0.2.3\tools
open DataMigrationUtility open this setup.

Setps for Data Import:-

A.



B. After Choose Create Schema . 

C. After Logged In.
Select Subject Entity below screen shot .

Click on Save and Export Button.
(Save Schema to selected Path / folder)

D. Select Export option
Below Screen short.

Select Above Downloaded Schema of Subject entity .
and put  exported data file name (exported record downloaded in ZIP)

below screen shot
Complete Export Steps


Export Data 

A. Select Export Data
below Screen shot .
Login Your CRM Credential .

B. Select Data File(ZIP)
Below Screen Shot
Complete Export Steps

Saturday, 5 November 2016

Dynamics CRM : button add in service calander

 
     Dynamics CRM: button add in service calendar

Add button in Service Calendar entity in command bar in Dynamics CRM.
Let’s walk through using an example
The example given below is for this add button in service calendar entity on command bar in Dynamics CRM.

Assume add button “New Country” in service calendar entity in command bar, Click on this button redirect to “CountryMaster” entity form. Only two option are fallow .
  • 1.     Add Application Ribbons component of solution.
  • 2.     Open RibbonWorkbench and select the solution and select Application Ribbons.    
     
Add Application Ribbons component of solution.

Many step are given below

a.     Open new solution in Dynamics CRM.
b.    Click on component à add on existingà select Application Ribbons. And save, publish.
(Graphical; process are given below)


Open RibbonWorkbench

This option are many step
  • a.     Open RibbonWorkbench
  • b.    Select the solution (added in application ribbons).
  • c.     Select Application ribbons.
  • d.    Add command and fill action details(using url or java script) àok
  • e.     Drag & drop button on required place.
  • f.     Select the command and fill required the details.
  • g.    Publish.
  •    (Graphical process are given below)


Publish are success
Click on “New Country” open new country form.





Monday, 18 July 2016

Implement Auto complete feature of CRM 2016 text fields

        AutoComplete Feature for Dynamics CRM 2016

AutoComplete is one of the most desired and advanced feature for Dynamics CRM 2016. It not only enhances customer experience but helps in fast and accurate entry of records.
AutoComplete can be implemented on simple text fields as well as for complex and composite fields (e.g. Composite Address fields). 

Let’s walk through using an example
The example given below is for implementation of “Autocomplete feature” in Dynamics CRM 2016 for simple text field such as Country in Address Details. One may simply type few characters in the field and a list of country names is displayed in sorted manner.
Assume the simple text field on which we want to enable autocomplete feature is “na_country” and an entity CountryMaster (na_countrymasters) contains the master list of countries.
Create a web resource say “AddressDetails.js” which will have 2 methods:  


Method 1: LoadAutoComplete

 

This method is executed at the time of ‘Form Load’ to get the list of all countries existing in CountryMaster (na_countrymasters) entity. We are using CRM web API to get a list of countries sorted by name. (How to use web API is another topic and we will go into details later.) 



function LoadAutoComplete() {
    if (Xrm.Page.getControl("na_country") != null) {
        Xrm.Page.getControl("na_country").setDisabled(true);
    }
    var clientURL = Xrm.Page.context.getClientUrl();
    var oDataPath = clientURL + "/api/data/v8.0/"
    var req = new XMLHttpRequest();
    req.open("GET", encodeURI(oDataPath + "na_countrymasters?$select=na_name,na_countryname&$orderby=na_name"), true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.onreadystatechange = function () {
        if (this.readyState == 4) /* request complete*/ {
            req.onreadystatechange = null;
            if (this.status == 200) {
                var reqResults = JSON.parse(this.response).value;
                if (reqResults != null && reqResults.length > 0) {
                    var countries = [];
                    for (var i = 0; i < reqResults.length; i++) {
                        var country = reqResults[i];
                        countries.push({
                            id: country.na_countrymasterid,
                            name: country.na_name,
                            isocode: country.na_countryname,
                            fields: [country.na_name, country.na_countryname]
                        });
                    }
                    if (Xrm.Page.getControl("na_country") != null) {
                        Xrm.Page.getControl("na_country").setDisabled(false);
                     
                    }
                   
autoCompleteCountries(countries);
                }
            }
            else {
                var error = JSON.parse(this.response).error;
                console.log(error.message);
            }
        }
    };
    req.send();
}

The above method calls the List of countries from Country Master entity and calls the second method AutoCompleteCountries().

Method 2: AutoCompleteCountries

This method works on “key press” event on Country field (The field on which autocomplete is applied)

function autoCompleteCountries(countries) {
    var keyPressFcn = function (ext) {
        try {        
            var userInput = Xrm.Page.getControl("na_country").getValue();

            var resultSet = {
                results: new Array(),
                commands: {
                    id: "sp_commands",
                    label: "Learn More",
                    action: function () {                       
                        // Any help or other information URL
                        //window.open("http://www.microsoft.com/en-us/dynamics/crm-customer-center/create-or-edit-an-account.aspx");
                    }
                }
            };

            var userInputLowerCase = userInput.toLowerCase();
            for (i = 0; i < countries.length; i++) {
                if (userInputLowerCase === countries[i].name.substring(0, userInputLowerCase.length).toLowerCase()) {
                    resultSet.results.push({
                        id: i,
                        fields: [countries[i].name, countries[i].isocode]
                    });
                }
                if (resultSet.results.length >= 10) break;
            }
            if (resultSet.results.length > 0) {
                ext.getEventSource().showAutoComplete(resultSet);
            }
            else {
                ext.getEventSource().hideAutoComplete();
            }
        } catch (e) {
             console.log(e);

        }
    };

    Xrm.Page.getControl("na_country").addOnKeyPress(keyPressFcn);

}



Setting in Dynamics CRM 2016:

Add the AddressDetails.js as new web resource in CRM.
Add this web resource to the form using form properties. Go to manage function and set LoadAutoComplete function on form Onload event.

Publish the changes in CRM. Open the form and start entering letters in Country field. You should get the below autocomplete output