Microsoft Dynamics CRM 2011 Create new case from account's homepage ribbon Or cut the clicks
The idea behind it was to cut the time for creating new case, Instead of going to account homepage, opening the account form, click on case sub grid and then create the case, It will be just go to account homepage choose the account and create new case.
This is a real time saver.
1) Create new solution.
2) Add new web resource type JavaScript
2) Add new web resource type JavaScript
var CASE_URL = "/main.aspx?etc=112&extraqs=%3f_CreateFromId%3d%257b{ACCOUNTID}%257d%26_CreateFromType%3d1&pagetype=entityrecord";
CreateNewCaseFromAccount = function(id)
{
//get
accountid
var
nakedId = id.replace("{", "").replace("}",
"");
var
caseUrl = CASE_URL.replace("{ACCOUNTID}", nakedId);
var
caseUrl = Xrm.Page.context.prependOrgName(caseUrl);
window.open(caseUrl);
}
3) Add button to account's homepage
ribbon to call CreateNewCaseFromAccount function. Two ways for adding the
button to account.
1) Use Ribbon workbench.
2) The old fashion way, do it yourself.
1) Use Ribbon workbench.
2) The old fashion way, do it yourself.
a. Add account to solution.
b. Export solution.
c. Extract the solution file.
d. Open customizations.xml using
your favorite notepad
e.Add the button to the
RibbonDiffXml:
<RibbonDiffXml>
<CustomActions>
<CustomAction
Id="HomepageGrid.account.MainTab.Actions.CreateNewCase.CustomAction"
Location="Mscrm.HomepageGrid.account.MainTab.Actions.Controls._children"
Sequence="41">
<CommandUIDefinition>
<Button Id="HomepageGrid.account.MainTab.Actions.CreateNewCase"
Command="HomepageGrid.account.MainTab.Actions.CreateNewCase.Command"
Sequence="20" ToolTipTitle="Create New Case"
LabelText="Create New Case" ToolTipDescription="Create New
Case" TemplateAlias="o1" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates
Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition
Id="HomepageGrid.account.MainTab.Actions.CreateNewCase.Command">
<EnableRules>
<EnableRule
Id="HomepageGrid.account.MainTab.Actions.CreateNewCase.Command.EnableRule.SelectionCountRule"
/>
</EnableRules>
<DisplayRules />
<Actions>
<JavaScriptFunction
FunctionName="CreateNewCaseFromAccount"
Library="$Webresource:new_/CreateNewCase/CreateNewCase.js">
<CrmParameter
Value="FirstSelectedItemId" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules>
<EnableRule Id="HomepageGrid.account.MainTab.Actions.CreateNewCase.Command.EnableRule.SelectionCountRule">
<SelectionCountRule
AppliesTo="SelectedEntity" Maximum="1"
Minimum="1" Default="true" />
</EnableRule>
</EnableRules>
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>
f. Import the solution back and publish.
Good luck.
This post was written before Dynamics CRM 2011 RU 8 and the new Xrm.utility, It changes only the way of opening new form the basic idea of this post stays the same.
For more information about Xrm.utility go to
http://jonasrapp.cinteros.se/2012/08/xrmutility-methods-in-ms-dynamics-crm.html
or many other posts that explains the new functions available.
This post was written before Dynamics CRM 2011 RU 8 and the new Xrm.utility, It changes only the way of opening new form the basic idea of this post stays the same.
For more information about Xrm.utility go to
http://jonasrapp.cinteros.se/2012/08/xrmutility-methods-in-ms-dynamics-crm.html
or many other posts that explains the new functions available.
No comments:
Post a Comment