Saturday, April 7, 2012

Startup script Onload AND Onsave! Basic's for every Jscript!

Tired of having XX web-resurces on a form? Well.. Now you can controll everything within one JS with only 1. trigger:
- OnChange
- Onload
- OnSave

as well as:
- For all form types: OnCreate, OnNewForm, onReadonly ++

Read more about this in my previous post: Best javascript startup script ever
/* Script Entry Point */
function OnCrmPageLoad() {
 var FormTypes =
 {
Undefined: 0,
Create: 1,
Update: 2,
ReadOnly: 3,
Disabled: 4,
QuickCreate: 5,
BulkEdit: 6
 }
 runAlways();
 switch (crmForm.FormType) {
 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() {
}
function OnUpdateFormLoad() {}
function OnReadOnlyFormLoad() { }
function OnDisabledFormLoad() { }
function OnQuickCreateFormLoad() { }
function OnBulkEditFormLoad() { }
/******************** OnChange and OnSave functions ***************************/
function onchange(){
 //Skriv inn alle felter som skal ha OnChange
 Xrm.Page.data.entity.attributes.get("prefix_field").addOnChange(Summering);
}
function addToOnSave() {
 var SAVE_MODE_SAVE = 1;
 var SAVE_MODE_SAVEANDCLOSE = 2;
 // Validate only if the user clicked "Save".
 switch (event.Mode){
 case SAVE_MODE_SAVE:
  //Do something for "save"
  if(/*write you check*/) {
   // Cancel the save operation.
   event.returnValue = false;
   return false;
  }
  break;
 case SAVE_MODE_SAVEANDCLOSE:
  //Do something for "Save and close"
  if(/*write you check*/) {
   // Because this is a "Save and Close",
   // just save the form.
   return true;
  }
  break;
 }
}
/*************** End OnChange and OnSave functions ***************************/
/* --------------- Private functions ---------------------*/
function Summering(){
alert("You are inside a function triggerd from a onChange");
}
/* ------------ End Private functions------------------*/

Tuesday, March 6, 2012

Creating a "Update Account Dialog"

Soon I'm going to publish a dialog that updates an account. with several information:
- Contacts and roles that are req for business regarding marketing, sales ++

Senario:
A company need to update all accounts with certain roles (g.ex IT responseble, CEO, Sales responseble) before a huge invitation is sendt thou CRM, and plan to give this task to the account owners (account responsebles).. They want a sort of easy way to remind the account responsebles to do this, and do it the fastest way posseble..



This video only dispaly an example, you could easly update this dialog gathering other kind of information!

Thursday, March 1, 2012

Nye muligheter med Microsoft Dynamics CRM 2011

Crayon Solutions har gleden av å invitere deg til frokostmøte 21. mars.
Page Cont
​​Her får du en oversikt over de viktigste nyhetene i Microsoft Dynamics CRM 2011 og hvilke muligheter og metode som finnes for oppgradering fra Microsoft Dynamics CRM 4.0.
Vi håper du har anledning til å delta, og vi gleder oss til å treffe deg! Inviter gjerne andre i din virksomhet som dette kan være relevant for.

Sted:
Lysaker Torg 45 i Microsoft sine lokaler.
Dato: Onsdag 21. mars
Tid: kl.09:00-11:00 (registrering og frokost fra kl. 08:30)