var beEnt = new BusinessEntity("task"); beEnt.attributes["regardingobjectid"] = "F5E42F4A-8539-E011-8602-005056A61424"; //GUID of record beEnt.attributes["regardingobjectid"].name = "ABC and Company"; //name of the record beEnt.attributes["regardingobjecttypecode"] = "account"; //type of record beEnt.attributes["subject"] ="sample subject"; beEnt.attributes["description"] = "Sample body"; oService.Create(beEnt);
Jul 30, 2013
Setting regarding object in JavaScript
When programmatically creating a task/activity, I found it is little tricky the way we need to assign regarding object. For the benefit of others, though of sharing the code snippet. I am using Ascentium CrmService for my client side operations.
Labels:
code snippet,
JavaScript
Jul 7, 2013
Coloring the Subgrid rows
As we discussed previously, we can use colours for branding purposes and improve the useability. Most clients seem happy to have different colours for different rows within the Subgrid depending on their status or etc.
For example: In my cases I have an Institute entity where sub institutes are in a Subgrid. I am going to give a colour for profit making institutes. (Highlighting expensive quote products within a Quote would make more sense for you). Outcome would be something like this;
How we going to achieve this? This consists of three steps.
1) Wait till Subgid is loaded
Biggest challenge of playing with Subgids is they load in an Asynchronous manner. In that case normal onload would not fire. So we attach a method for loading with a Delay. This is the code in loading;
Now we will implement the relevant method. This got a trick. In catch statement delays and calls the method again. This allows you to wait and load the code again to see if Subgrid is loaded. Your real code will run only after that is accomplished.
2) Determine the criteria
Now you need to determine the criteria of the records to be coloured. Actually you need to read the relevant Guids. Read the relevant Fetch XML as below. If you uncomment the second line, you will see the fetch xml statement of the Subgrid. Now you are free to retrieve those records and determine the Guids according to your criteria.
3) Colouring the row
Now you have the Guids ready. Now perform this code within a loop for your Guids; (I am just using one single record to make it clearer)
Limitation;
As you may guess, this doesn’t work for next pages if paging is performed for Subgrid. What you can do is increase the items in the Subgrid allowing to have a scrollbar and ignore the paging option.
For example: In my cases I have an Institute entity where sub institutes are in a Subgrid. I am going to give a colour for profit making institutes. (Highlighting expensive quote products within a Quote would make more sense for you). Outcome would be something like this;
How we going to achieve this? This consists of three steps.
1) Wait till Subgid is loaded
Biggest challenge of playing with Subgids is they load in an Asynchronous manner. In that case normal onload would not fire. So we attach a method for loading with a Delay. This is the code in loading;
setTimeout("attachGridAction();", 500);
Now we will implement the relevant method. This got a trick. In catch statement delays and calls the method again. This allows you to wait and load the code again to see if Subgrid is loaded. Your real code will run only after that is accomplished.
function attachGridAction() { try { var _grid = document.getElementById("Sub_Org_List"); if ((_grid) && (_grid.readyState == 'complete')) { // Code goes here } } catch (err) { setTimeout("attachGridAction();", 500); } }
2) Determine the criteria
Now you need to determine the criteria of the records to be coloured. Actually you need to read the relevant Guids. Read the relevant Fetch XML as below. If you uncomment the second line, you will see the fetch xml statement of the Subgrid. Now you are free to retrieve those records and determine the Guids according to your criteria.
var _fetch = document.getElementById("effectiveFetchXml"); //alert(_fetch.value);
3) Colouring the row
Now you have the Guids ready. Now perform this code within a loop for your Guids; (I am just using one single record to make it clearer)
var _checkbox = document.getElementById('checkBox_{4ACC296A-0CE5-E211-A9C3-00155D467A0E}'); var _checkboxParentParent = _checkbox.parentNode.parentNode; _checkboxParentParent.bgColor = 'DarkKhaki';
Limitation;
As you may guess, this doesn’t work for next pages if paging is performed for Subgrid. What you can do is increase the items in the Subgrid allowing to have a scrollbar and ignore the paging option.
Labels:
CRM 2011,
R and D,
useability engineering
Jul 2, 2013
Change colour of Fonts, Sections and Tabs
Though Microsoft Dynamics CRM 2011 forms are nicely presented, there could be instances that you may need to change the colours. It can be for branding purposes or to improve useability aspects. Most of them could be done through loading Java Scripts. We will check some of basics here.
In these codes colour can be determined by HTML code or standard name.
Click this for a basic list of such names and relevent HTML codes.
1) Fonts and backgrounds of the Fields
2) Tabs
3) Sections
We will look into much complex colouring options in another post.
In these codes colour can be determined by HTML code or standard name.
Click this for a basic list of such names and relevent HTML codes.
1) Fonts and backgrounds of the Fields
//Colouring the background of the label document.getElementById('new_name_c').style.backgroundColor="CornflowerBlue"; //Colouring the field value document.getElementById('new_name').style.color="#8B0000"; //Colouring the label document.getElementById('new_contactperson_c').style.color="DarkOrange"; //Colouring the background of the field value document.getElementById('new_contactperson').style.backgroundColor = 'Gold'
2) Tabs
document.getElementById("tab1").style.backgroundColor = '#F0E68C';
3) Sections
document.getElementById('{883d8330-156d-e4e5-130b-934752157dd3}').style.backgroundColor = 'DeepSkyBlue';
We will look into much complex colouring options in another post.
Labels:
CRM 2011,
UI,
useability engineering
Subscribe to:
Posts (Atom)