Call the function Form Load....
function LoadParentMemberAsFullMemberType() {
var viewId = "{65EC9B45-EE81-4F89-BAF6-E8603FF8E1E4}";
var entityName = "account";
var viewDisplayName = "Membership Types";
var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
"<entity name='account'>" +
"<all-attributes/>" +
" <link-entity name='mship_membershiptype' from='mship_membershiptypeid' to='mship_membershiptypeid' > " +
" <filter type='and'>" +
"<condition attribute='mship_type' operator='eq' value='Full Member' />" +
" </filter> " +
" </link-entity>" +
"</entity>" +
"</fetch>";
//build grid layout
var layoutXml = "<grid name='resultset' " +
"object='1' " +
"jump='account' " +
"select='1' " +
"icon='1' " +
"preview='1'>" +
"<row name='result' " +
"id='accountid'>" +
"<cell name='mship_companyname' " +
"width='300' />" +
"<cell name='accountnumber' " +
"width='300' />" +
"<cell name='mship_membershiptypeid' " +
"width='300' />" +
"</row>" +
"</grid>";
//add new view view
Xrm.Page.getControl("parentaccountid").addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);//Attach to the feild
// Chech The Chenged Field
var membershiptype = crmForm.all["parentaccountid"];
membershiptype.setAttribute("disableViewPicker", "1")
}
Wednesday, July 27, 2011
Tuesday, July 26, 2011
how to get number of days in a month in c# asp.net?
System.DateTime.DaysInMonth(int year, int month);
Monday, July 25, 2011
Add 1 month to the date time - C#
DateTime nextmonth =DateTime.Today()+ new System.TimeSpan (30, 0, 0, 0 );
Today is 2011/04/01
It Return 2011/05/01
Create Bat File To Start Windows Service in Windows 7
- Open notepad
- Write
net start
- Save as filename.bat
- Run as Administrator
Wednesday, July 20, 2011
CRM 2011 -Adding new activity types
How to create a new activity type
- Create a new entity and give it a name
- Check the ‘Define as an activity entity’ check box and keep the ‘Display in Activity Menus’ check box checked
- Change the primary field name to reflect your needs
- Save your new entity! Publish
- It will show in Create new activity >>> Drill Other Activity
Tuesday, July 19, 2011
Server Error in '/WCFApplication' Application (Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken)
To Resolve this type of Error >>>>
Description: An unhandled exception occurred during the execution of the current Web request. Review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
This error can occur when IIS is installed after installing .NET Framework 4, or if the 3.0 version of the WCF Http Activation module is installed after installing IIS and .NET Framework 4.
To resolve this problem, you must use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe,) to register the correct version of ASP.NET. This can be accomplished by using the –iru parameters when running aspnet_regiis.exe as follows:
aspnet_regiis.exe -iru
Before Set the Path in command prompt as C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Monday, July 18, 2011
CRM 2011 - Add Custom View To SubGrid Using Java Script
Method
function addSubgridCustomView(subgridID, entityTypeCode, displayName, fetchXML, layoutXML, filterType, isDefault) {
if (IsNull(subgridID)) { throw Error.argument("value", "ID of sub-grid to filter not provided"); return; }
if (IsNull(entityTypeCode)) { throw Error.argument("value", "Entype code of returned object by fetchXML not provided"); return; }
if (IsNull(fetchXML)) { throw Error.argument("value", "FetchXml not provide for custom view on sub-grid"); return; }
if (IsNull(layoutXML)) { throw Error.argument("value", "LayoutXml not provided for custom view on sub-grid"); return; }
var grd = document.getElementById(subgridID);
//Check if the sub-grid has any customViews already.
var customViews = (IsNull(grd.customViews) ? new Array() : grd.customViews);
var viewId = "{65EC9B45-EE81-4F89-BAF6-E8603FF8E1E9}";
//Create an object to hold the customView's information
var customView = new Object();
customView.fetchXml = fetchXML;
customView.id = viewId;
customView.layoutXml = layoutXML;
customView.name = (IsNull(displayName) || displayName == "" ? "Filtered Lookup" : displayName);
customView.recordType = entityTypeCode;
customView.Type = (!IsNull(filterType) ? filterType : 0);
//Add the customView object to the array of customViews
customViews.push(customView);
//Add the array of custom views to the sub-grid
grd.customViews = customViews;
//Set this view as the default if desired
if (isDefault) { grd.defaultViewId = viewId; }
}
Call
function SetProductCategoryView() {
formType = Xrm.Page.ui.getFormType();
if (formType == FORM_TYPE_UPDATE) {
var viewId = "{65EC9B45-EE81-4F89-BAF6-E8603FF8E1E9}";
var memberID = "";
var entityName = "fia_memberproductcategory";
var viewDisplayName = "Product Categories";
var fetchXml = "<fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">" +
"<entity name="fia_memberproductcategory">" +
"<attribute name="fia_memberproductcategoryid">" +
"<attribute name="fia_name">" +
"<order attribute="fia_name" descending="false">" +
"<link-entity ="" from="fia_MemberProductCategoryId" link-type="inner" name="fia_memberproductcategory" to="fia_memberproductcategoryId"> " +
"<link-entity ="" from="fia_memberproductid" link-type="inner" name="fia_fia_memberproduct_account" to="fia_memberproductid"> " +
" <filter type="and">" +
" <condition attribute="accountid" operator="eq" value="E03E2524-CDA6-E011-9F05-BC50FDF3E385">" +
" </condition></filter> " +
" </link-entity>" +
" </link-entity>" +
"</order></attribute></attribute></entity>" +
"</fetch>";
//build grid layout
var layoutXml = "<grid "="" +<br="" name="resultset"> "object='1' " +
"jump='fia_memberproductcategory' " +
"select='1' " +
"icon='1' " +
"preview='1'&>" +
"<row "="" +<br="" name="result">
"id='fia_name'&>" +
"<cell "="" +<br="" name="fia_name">
"width='300' /&>" +
"</cell></row>" +
"</grid>";
//add new view view
addSubgridCustomView("ProductCategory", getObjectTypeCode(entityName), viewDisplayName, fetchXml, layoutXml,0, true);
}
}
function getObjectTypeCode(entityName) {
try {
var lookupService = new RemoteCommand("LookupService", "RetrieveTypeCode");
lookupService.SetParameter("entityName", entityName);
var result = lookupService.Execute();
if (result.Success && typeof result.ReturnValue == "number") {
alert(result.ReturnValue);
return result.ReturnValue;
} else {
return null;
}
}
catch (ex) {
throw ex;
}
}
Subscribe to:
Posts (Atom)
