Showing Link to Shared Network Folder in CRM 2013 Form

One recent query I got is that a company was trying to migrate some stuff from SharePoint directories back to shared network folders. They also needed to show link to shared network folder on CRM forms.Here is what I thought might work out (works only in IE, other browsers do not support file protocol anymore):

Make a HTML web resource:

<html>

<head>

<meta charset=”utf-8″ />

<title></title>

</head>

<body>

<button onclick=”window.open(‘file://Network path)”>Click me!</button>

</body>

</html>

Upload it and put it on the form:

clip_image001

Now when you click it, it will let you open a shared network location.

Some things to note:

CRM URL should be under trusted sites

Different network policies need to be allowed to be doing so.

Hope it helps!

Ask your Query : Click here

{Tips and Tricks} Put icons/smileys in sub grids Dynamics CRM 2013

I have been spending last few blogs to do changes to Sub-grids in Dynamics CRM 2013.

Different customers want to see different representation of their customer data, something visual is often better perceived by customers. I often find customers talking about a visual element on CRM sub grids, so it is more visible than having to read a text field for status on sub grids. CRM off course doesn’t yet let us show icons on Grids. Here is a workaround I tried to achieve for one of the demos. I have used unsupported scripting to achieve this, but still it will work fine as long as DOM structure of CRM forms is not changed, after which another investigation and relook into this code might be required. However, it is often more visual to see cases on sub-grid like the one below, which makes us understand that first two are completed and the last two are in progress.

clip_image001

Now, if you want to try it here is the script bits:

How to put it up in a function and other stuff on Form load is mentioned in my other blog: Click here

Just put the below code in place of Logic here from the blog linked above:

$(‘#accountcasessgrid td’).filter(function() {
    return $(this).text() == ‘Active’;
}).
html(“<img src=’web resource path for Active ‘>”); $(‘#accountcasessgrid td’).filter(function() {
    return $(this).text() == ‘Resolved’;}).
html(“<img src=’web resource path for Resolved’ >”);

You are done. Hope it helps!

{Scripting titbits} Coming in Dynamics CRM 2015: Business Process Flows{Part 1}

I was going through documentation on new scripting tit-bits coming in Dynamics CRM 2015 in scripting. Basically there is a new section in namespace coming up for Business Processes: The Xrm.Page.data namespace is extended to include methods under Xrm.Page.data.process. The Xrm.Page.ui namespace is extended to include methods under Xrm.Page.ui.process.

In CRM 2015, Business Process flows can have a structure like the one below:

clip_image001

This and other scripting changes included solves lots of workaround and unsupported scripting which needed to be done till Dynamics CRM 2013 to meet customer requirements. Methods and usage are mentioned below (Reference 2015 Developer Preview SDK):

Change the process when there are more than one process available for the entity.

Use Xrm.Page.data.process.getEnabledProcesses to retrieve information about enabled processes that the user can choose for the entity. Then use Xrm.Page.data.process.setActiveProcess to make one of the enabled processes the active one.

Move to the next stage when all required steps are completed to make it the current active stage.

Use Xrm.Page.data.process.moveNext.

Move to the previous stage and make it the current active stage.

Use Xrm.Page.data.process.movePrevious.

Select a stage to view the status of the steps in the stage.

Use Xrm.Page.data.process.getActivePath to retrieve information about the stages that have been completed, the current active stage, and valid stages available from the current active stage. Examine the steps included in that stage and compare the corresponding form attribute values to determine whether they are completed.

Complete a step

Steps are completed when the corresponding data in the form is entered. You can determine the attribute using the step getAttribute method. This will return the logical name of the attribute. Then use Xrm.Page.getAttribute to retrieve attribute from the Xrm.Page.data.entity.attributes collection and then use the attribute setValue method to set the value.

Detect whether a step is required

Use the step isRequired method to determine if a step is required by the business process flow.

Expand or collapse the business process flow control

Use Xrm.Page.ui.process.setDisplayState.

Things only developer can perform:

Hide the process control

Use Xrm.Page.ui.process.setVisible, you can control whether to display the business process flow control.

Skip to a valid stage without progressing through each one.

Use Xrm.Page.data.process.setActiveStage to set one of the valid stages returned using Xrm.Page.data.process.getActivePath as long as the stage is defined for the current entity.

Query the process definition including stages not currently visible

Use Xrm.Page.data.process.getActiveProcess to query the definition of the business process flow, including stages that might not be visible because of branching logic in the process.

Get Active Process:

var activeProcess = Xrm.Page.data.process.getActiveProcess();

Set Active Process:

Xrm.Page.data.process.setActiveProcess(processId, callbackFunction);

Get Active Stage:

var activeStage = Xrm.Page.data.process.getActiveStage();

Hope it helps!

Dynamics CRM 2015 SDK (Preview) Available

A pre-release of the Dynamics CRM 2015 SDK is now available. This SDK has a version number of 7.0.a and you may download it here: Click here

What’s New

After you download and install the SDK, open the help file and navigate to this topic:

What’s new for developers

Developers will be able to leverage the following enhancements and new capabilities in this release:

  • Product catalog enhancements
  • Use hierarchical data
  • Apply hierarchical security models
  • Use calculated and rollup attributes created in Dynamics CRM
  • Write form scripts that interact with business process flows
  • Use field-level security with system entities
  • Create business rules instead of writing code
  • Add custom help content
  • Use two-factor authentication
  • New messages in the Organization web service
  • New messages in the Deployment web service
  • New entities
  • New privileges
  • New NuGet packages

Lots of new things to read and find. Hope it helps!

Attach Logic to Sub-Grid after being Loaded in CRM 2013

I did not find a script online for CRM 2013 that could help. So here it goes:

 

function subGridOnload()
{
var grid = $(‘#gridname’);  //Replace Grid name here
if (grid == null)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
 
if(grid[0] == undefined)
{
  // delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
 
  if(grid[0].control == undefined)
{
  // delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
 
  if(grid[0].control == null)
{
  // delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}
 
if (grid[0].control.get_totalRecordCount() == -1)
{
   // delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}

//Logic goes here

}

Note: This is unsupported and might break in future!

Hope it helps!

Adding Row Colours to CRM 2013 Sub-Grids dynamically based on value in cells

Sometimes we get requirement to show colour encoding on sub-grid in CRM 2013 forms. One of the

Queries I received was ways to achieve them. Here is a sample of what I tried on Case sub-grid on

Vanilla CRM Account form:

clip_image001

Here is the script:

I have got of lot of feedback to put more details of where to put scripts and stuff, so here it goes.

Sub-grid name can be found from FORM EDITOR. Refer screen below(Double click the sub-grid will give a property window):

image

Now the script, Add the below function to form onload

function subGridOnload()
{
var grid = $(‘#accountcasessgrid’);  //Replace Grid name here
if (grid == null)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}

if(grid[0] == undefined)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}

if(grid[0].control == undefined)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}

if(grid[0].control == null)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}

if (grid[0].control.get_totalRecordCount() == -1)
{
// delay one second and try again.
setTimeout(subGridOnload, 1000);
return;
}

// logic Replace status names and colours as required

$(‘#accountcasessgrid td’).filter(function() {
return $(this).text() == ‘Resolved’;
}).closest(‘tr’).css(‘background-color’, ‘green’);

$(‘#accountcasessgrid td’).filter(function() {
return $(this).text() == ‘Active’;
}).closest(‘tr’).css(‘background-color’, ‘yellow’);

}

Hope it helps!

Ask your Query : Click here

Note: It is unsupported way and may break in future if Microsoft changes rendering of sub-grids in a future release.
Trying to Learn Dynamics CRM: Download!


Learn Dynamics CRM App on Google Play store

{Step by Step}Turning Tracing on for IIS on Windows Server 2012

I recently needed to enable tracing on IIS for Windows Server 2012 and thought its worthwhile to share for others.

· Go to Server Manager and Click Manager(Top Right corner):

clip_image002[4]

· Pick Manage and Add Roles and Features:

clip_image003[4]

· Click Next on below screen:

clip_image005

· Pick first option as below screen:

clip_image007

· Choose server on below screen and click Next:

 clip_image011

· On Next screen expand Web Server:

clip_image013[4]

· Pick Tracing as shown in below screen, Click Next:

clip_image015

· Click Next on the below screen:

clip_image017

· Click Install on below screen(Tick Restart checkbox if needed):

clip_image019

· Click Close once Installation is complete:

clip_image021[4]

You are done. Hope it helps!