Hi Folks,
Scenario: I have an Account Entity where , my customer requirement is to view all the Emails to be displayed in a grid on selection of Account from the Lookup.
Solution:
1.Create a Javascript webresource with the following Code
function loadActivity()
{
//get selected value from the Account lookup
var lookupItem = new Array;
lookupItem = Xrm.Page.getAttribute(CRMFieldSchemaName).getValue();
if (lookupItem[0] != null)
{
var id=lookupItem[0].id;
}
var viewDisplayName = "Test View"; // Custom name for the lookup window
//Get the fetch XML using Advance Find available in MSCRM 2011
var fetchXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='activitypointer'>
<attribute name='activitytypecode"'/>
<attribute name='subject'/>
<attribute name='statecode'/>
<attribute name='prioritycode'/>
<attribute name='modifiedon'/>
<attribute name='activityid'/>
<attribute name='instancetypecode'/>
<order attribute='modifiedon' descending='false'/>
<filter type="and">
<condition attribute='regardingobjectid' operator='eq' uitype='opportunity' value='+id+' />
</filter>
</entity>
</fetch>";
//Create a view that needs to be displayed in the grid
var layoutXML = "<grid name='resultset' object='1' jump='new_primary' select='1' icon='1' preview='1'>";
layoutXML += "<row name='result' id='new_name'>";
layoutXML += "<cell name='new_code' width='150' />";
layoutXML += "</row>";
layoutXML += "</grid>";
//Set the View created to the Grid Control
Xrm.Page.getControl("Grid Namel").addCustomView(viewId, entityName, viewDisplayName, fetchXML , layoutXML, true);
}
Scenario: I have an Account Entity where , my customer requirement is to view all the Emails to be displayed in a grid on selection of Account from the Lookup.
Solution:
1.Create a Javascript webresource with the following Code
function loadActivity()
{
//get selected value from the Account lookup
var lookupItem = new Array;
lookupItem = Xrm.Page.getAttribute(CRMFieldSchemaName).getValue();
if (lookupItem[0] != null)
{
var id=lookupItem[0].id;
}
var viewDisplayName = "Test View"; // Custom name for the lookup window
//Get the fetch XML using Advance Find available in MSCRM 2011
var fetchXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='activitypointer'>
<attribute name='activitytypecode"'/>
<attribute name='subject'/>
<attribute name='statecode'/>
<attribute name='prioritycode'/>
<attribute name='modifiedon'/>
<attribute name='activityid'/>
<attribute name='instancetypecode'/>
<order attribute='modifiedon' descending='false'/>
<filter type="and">
<condition attribute='regardingobjectid' operator='eq' uitype='opportunity' value='+id+' />
</filter>
</entity>
</fetch>";
//Create a view that needs to be displayed in the grid
var layoutXML = "<grid name='resultset' object='1' jump='new_primary' select='1' icon='1' preview='1'>";
layoutXML += "<row name='result' id='new_name'>";
layoutXML += "<cell name='new_code' width='150' />";
layoutXML += "</row>";
layoutXML += "</grid>";
//Set the View created to the Grid Control
Xrm.Page.getControl("Grid Namel").addCustomView(viewId, entityName, viewDisplayName, fetchXML , layoutXML, true);
}
No comments:
Post a Comment