Hi again!
http://www.north52.com/ as their "Formula Manager" solution is life saving for all "none"-developing consultants! It make you create "excel-like" formulas who act as a plugin!
It's suuuuper easy to learn, extremely timesaving, very good ROI for you small customers , and give you the power of creating plugins in minutes without coding!!
I've used it in several projects (On-prem and On-dem) and the best thing, IT'S FREE UP TO A TOTAL OF 10 PLUGINS!
Also remember to take a look at the other cool solutions they have!!
Happy Xrm'ing!!
Friday, January 24, 2014
Tuesday, January 21, 2014
How to Update salesstage with javascript based on "processbar" in MS CRM 2013
Hi all, it's been a loooong time since i last updated this blog.. But here's a new nice tip :)
Microsoft have not given us the easiest way of updating fields on FORMS based on the new processbars feature on FORMS, but here's one way to do it With Javscript.. Supported!
Should work on opportunities.. AFTER YOU INSERT YOUR GUID's FOR
1. Field "processid"
2. Field "stageid"
3. Change name of "salesstage"
(Needed in setSalesStage function)
/* Script Entry Point */
function OnCrmPageLoad() {
var FormTypes =
{
Undefined: 0,
Create: 1,
Update: 2,
ReadOnly: 3,
Disabled: 4,
QuickCreate: 5,
BulkEdit: 6
}
runAlways();
switch (Xrm.Page.ui.getFormType()) {
case FormTypes.Create: OnNewFormLoad(); break;
case FormTypes.Update: OnUpdateFormLoad(); break;
case FormTypes.ReadOnly: OnReadOnlyFormLoad(); break;
case FormTypes.Disabled: OnDisabledFormLoad(); break;
case FormTypes.QuickCreate: OnQuickCreateFormLoad(); break;
case FormTypes.BulkEdit: OnBulkEditFormLoad(); break;
case FormTypes.Undefined: alert("Error"); break;
}
}
/* Implement each Form Type you wish to address */
function runAlways() {
onchange();
Xrm.Page.data.entity.addOnSave(addToOnSave);
}
function OnNewFormLoad() {
setSalesStage('new');
}
function OnUpdateFormLoad() {}
function OnReadOnlyFormLoad() { }
function OnDisabledFormLoad() { }
function OnQuickCreateFormLoad() { }
function OnBulkEditFormLoad() { }
/******************** OnChange and OnSave functions ***************************/
function onchange() {
//Add all fields who should have OnChange triggers
Xrm.Page.data.entity.attributes.get("prefix_fieldname").addOnChange(examplefunction);
}
function addToOnSave() {
//Check to see if stageid has changed
var attributes = Xrm.Page.data.entity.attributes.get();
for (var i in attributes) {
var attribute = attributes[i];
if (attribute.getIsDirty()) {
if (attribute.getName() == 'stageid') {
//Update Probability field - send a "dummy parameter"
setSalesStage('dummy');
}
}
}
}
/*************** End OnChange and OnSave functions ***************************/
/* --------------- Private functions ---------------------*/
function examplefunction() {
//No Operation
}
function setSalesStage(check) {
/*
UNIKE FOR EACH PROSESS AND CRM ORGANIZATION
Notes of GUID's steps in Prosess ID = 'bfc01b1c-9741-43b2-a016-3a41d91c234a' Display: "Solution Selling" on entity: opportunity
10% - 85bdfa9d-f067-42d4-82c3-0e1fd09f2b19
20% - 6a2020c4-7d10-28e3-1898-138b6c075259
40% - ae0c9ae4-55eb-cd1c-44ab-872d4aca4338
60% - 16b99584-143d-04ad-61c9-2b6a809e5608
80% - 93e08965-2e2a-4674-0e57-ec88633a0940
90% - 3a516491-d7cd-6cb1-a3e0-61be68c1857c
*/
var prosessId = Xrm.Page.getAttribute("processid");
var stageid = Xrm.Page.getAttribute("stageid");
var prob = Xrm.Page.getAttribute("salesstage");
//Check if new record
if (check == 'new') {
//sets first process name
prob.setValue('10% - Qualification');
}
//Not a new record, then it's an existing record
else {
if (prosessId.getValue() == 'bfc01b1c-9741-43b2-a016-3a41d91c234a') {
switch (stageid.getValue()) {
case '85bdfa9d-f067-42d4-82c3-0e1fd09f2b19':
//setter sannsynlighet
prob.setValue('10% - Qualification');
break;
case '6a2020c4-7d10-28e3-1898-138b6c075259':
prob.setValue('20% - Pain and Need');
break;
case 'ae0c9ae4-55eb-cd1c-44ab-872d4aca4338':
prob.setValue('40% - Proof of Concept');
break;
case '16b99584-143d-04ad-61c9-2b6a809e5608':
prob.setValue('60% - Closing');
break;
case '93e08965-2e2a-4674-0e57-ec88633a0940':
prob.setValue('80% - Offering accepted');
break;
case '3a516491-d7cd-6cb1-a3e0-61be68c1857c':
prob.setValue('90% - Contract signing');
break;
default:
alert("An error has occured!");
}
}
}
}
/* ------------ End Private functions------------------*/
Microsoft have not given us the easiest way of updating fields on FORMS based on the new processbars feature on FORMS, but here's one way to do it With Javscript.. Supported!
Should work on opportunities.. AFTER YOU INSERT YOUR GUID's FOR
1. Field "processid"
2. Field "stageid"
3. Change name of "salesstage"
(Needed in setSalesStage function)
/* Script Entry Point */
function OnCrmPageLoad() {
var FormTypes =
{
Undefined: 0,
Create: 1,
Update: 2,
ReadOnly: 3,
Disabled: 4,
QuickCreate: 5,
BulkEdit: 6
}
runAlways();
switch (Xrm.Page.ui.getFormType()) {
case FormTypes.Create: OnNewFormLoad(); break;
case FormTypes.Update: OnUpdateFormLoad(); break;
case FormTypes.ReadOnly: OnReadOnlyFormLoad(); break;
case FormTypes.Disabled: OnDisabledFormLoad(); break;
case FormTypes.QuickCreate: OnQuickCreateFormLoad(); break;
case FormTypes.BulkEdit: OnBulkEditFormLoad(); break;
case FormTypes.Undefined: alert("Error"); break;
}
}
/* Implement each Form Type you wish to address */
function runAlways() {
onchange();
Xrm.Page.data.entity.addOnSave(addToOnSave);
}
function OnNewFormLoad() {
setSalesStage('new');
}
function OnUpdateFormLoad() {}
function OnReadOnlyFormLoad() { }
function OnDisabledFormLoad() { }
function OnQuickCreateFormLoad() { }
function OnBulkEditFormLoad() { }
/******************** OnChange and OnSave functions ***************************/
function onchange() {
//Add all fields who should have OnChange triggers
Xrm.Page.data.entity.attributes.get("prefix_fieldname").addOnChange(examplefunction);
}
function addToOnSave() {
//Check to see if stageid has changed
var attributes = Xrm.Page.data.entity.attributes.get();
for (var i in attributes) {
var attribute = attributes[i];
if (attribute.getIsDirty()) {
if (attribute.getName() == 'stageid') {
//Update Probability field - send a "dummy parameter"
setSalesStage('dummy');
}
}
}
}
/*************** End OnChange and OnSave functions ***************************/
/* --------------- Private functions ---------------------*/
function examplefunction() {
//No Operation
}
function setSalesStage(check) {
/*
UNIKE FOR EACH PROSESS AND CRM ORGANIZATION
Notes of GUID's steps in Prosess ID = 'bfc01b1c-9741-43b2-a016-3a41d91c234a' Display: "Solution Selling" on entity: opportunity
10% - 85bdfa9d-f067-42d4-82c3-0e1fd09f2b19
20% - 6a2020c4-7d10-28e3-1898-138b6c075259
40% - ae0c9ae4-55eb-cd1c-44ab-872d4aca4338
60% - 16b99584-143d-04ad-61c9-2b6a809e5608
80% - 93e08965-2e2a-4674-0e57-ec88633a0940
90% - 3a516491-d7cd-6cb1-a3e0-61be68c1857c
*/
var prosessId = Xrm.Page.getAttribute("processid");
var stageid = Xrm.Page.getAttribute("stageid");
var prob = Xrm.Page.getAttribute("salesstage");
//Check if new record
if (check == 'new') {
//sets first process name
prob.setValue('10% - Qualification');
}
//Not a new record, then it's an existing record
else {
if (prosessId.getValue() == 'bfc01b1c-9741-43b2-a016-3a41d91c234a') {
switch (stageid.getValue()) {
case '85bdfa9d-f067-42d4-82c3-0e1fd09f2b19':
//setter sannsynlighet
prob.setValue('10% - Qualification');
break;
case '6a2020c4-7d10-28e3-1898-138b6c075259':
prob.setValue('20% - Pain and Need');
break;
case 'ae0c9ae4-55eb-cd1c-44ab-872d4aca4338':
prob.setValue('40% - Proof of Concept');
break;
case '16b99584-143d-04ad-61c9-2b6a809e5608':
prob.setValue('60% - Closing');
break;
case '93e08965-2e2a-4674-0e57-ec88633a0940':
prob.setValue('80% - Offering accepted');
break;
case '3a516491-d7cd-6cb1-a3e0-61be68c1857c':
prob.setValue('90% - Contract signing');
break;
default:
alert("An error has occured!");
}
}
}
}
/* ------------ End Private functions------------------*/
Etiketter:
CRM 2013,
Javascript CRM 2013
Wednesday, September 5, 2012
How to open CRM FORMS and Web Resources correctly!?
Some CRM implementations require the use of custom Jscript to pop open a new entity form window or a window displaying an existing record in CRM. Previously, there was no “supported” way to do this, since we had to use the window.open Jscript object which relies on the use of the Document Object Model (DOM).
Update rollup 8 provides new SDK functions which CRM configurators can use to open CRM forms and web resources in a nice supported way.
The Old Way - Making the URL static with parameters:
Here is an example of how to pop open an existing Account using Jscript:
function popAccount() {
var accountId = "8FB2CCE4-20E4-E111-9700-00155D042F0D";
var url = Xrm.Page.context.getServerUrl() + "/main.aspx?etn=account&id=" + accountId + "&pagetype=entityrecord";
window.open(url);
}
Here is an example of how to pop open an HTML Web Resource using Jscript:
function popHTML() {
var url = Xrm.Page.context.getServerUrl() + "//WebResources/iaf_/html/test.html";
window.open(url);
}
Although these methods do work, they could potentially break as new rollups are applied to your system, or when CRM 2011 is available on multiple browsers.
The New way - New functions :)
function popAccount() {
var accountId = "8FB2CCE4-20E4-E111-9700-00155D042F0D";
Xrm.Utility.openEntityForm("account", accountId);
}
If we wanted to pop open a new Account form, we can exclude the ID parameter.
Here is an example of how to pop open an HTML Web Resource using Jscript:
function popWebResource() {
var webResourceName = "iaf_/html/test.html";
Xrm.Utility.openWebResource(webResourceName);
}
Please note this is only a few of New functions released in rollup 8 related to "Xrm.Utility" :)
Happy Xrm'ing!
Source: http://blogs.msdn.com/b/crm/archive/2012/07/18/new-xrm-utility-functions-in-update-rollup-8-for-microsoft-dynamics-crm-2011-and-microsoft-dynamics-crm-online.aspx
Subscribe to:
Posts (Atom)