8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 1/18
Getting Started with MS Dynamics CRM
Working With Rules and Events in MS Dynamics
CRM
Description:BISP is committed to provide BEST learning material to the beginners and
advance learners. In the same series, we have prepared a complete end-to
end Hands-on Beginner’s Gide !or "icroso!t #$namics %&". The
docment !ocses on wor'ing with &les and Events. (oin or pro!essional
training program and learn !rom e)perts.
History:Version Description Change Author u!lishDate"#$ %nitial Dra&t Chandra rakash Sharma $"th Sep'"$("#$ Revie)*$ Sumit +oyal '$st Sep '"$(
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 2/18
Contents&les and Events.............................................................................................................+
orm load event ......................................................................................................... +
How to set orm load event in "s #$namics %&" online ........................................+
orm Save event sage ..............................................................................................
How to appl$ orm Save Event in "S #$namics %&" online ...................................
ield change event sage............................................................................................./
ield change Event in "S #$namics %&" online ...................................................../
0or'ing with tabs and sections....................................................................................... 1
%ombining events.......................................................................................................... *2
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page 3
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 3/18
Rules and Events"S #$namics %&" handle speci4c event5s, while (avaScript has its own event handling
model, wor'ing with #$namics %&", It provide di6erent set o! events that we can ta'e
advantage.
%t provide may type,s event &or MS Dynamics CRM :
orm load event sage.
orm save event sage.
ield change event sage.
0or'ing with tabs and sections.
%ombining events.
En!orcing bsiness rles.
See !elo) event type list :
Dynamics CRM -avaScrip
t
Description
7n8oad onload This is a !orm event. E)ectes when a !orm is loaded.7nSave onsbmit It e)ectes when a !orm is saved.
TabState%hange 9:; It e)ectes when the #ispla$State o! the tabchanges.
7n%hange onchange This is a 4eld speci4c event. It e)ectes when
tabbing ot o! a 4eld where $o5ve changed the
vale.7n&ead$State%om
plete
9:; This event indicates that the content o! an Irame
has completed loading.
.orm load event :
;!ter the Initiali<e event, 8oad event 4res when the orm is loaded in the memor$. This
orm event is invo'ed !or assigning vales to a control5s propert$ and !or initiali<ing
variables.
orm load event will !ocs on e)ecting a !ew operations triggered b$ the !orm load
event. 0e can chec' the vale o! a speci4c 4eld on the !orm, and based on that we can
decide to hide a tab, hide a 4eld, and pre poplate a te)t 4eld with a prede4ned vale.
"icroso!t #$namics %&" !orms are the primar$ inter!ace sed to interact with cstomer
data. The more $o cstomi<e $or !orms, the more $o will imagine valable wa$s to
interact with $or data.
Some o! the most common e)amples o! sing !orm event programming are
;tomaticall$ de!alt vales o! certain 4elds when the vale o! another 4eld is
set Trigger a loo'p o! some data based on the entered vale o! some 4eld
%reate calclated vales based on varios 4eld vales on the !orm.
=alidate data entr$ b$ correcting invalid data.
;lert sers to data isses.
"a'e 4elds visible:invisible or enabled:disabled based on varios sitations.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page +
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 4/18
Ho) to set .orm load event in Ms Dynamics CRM online :
Step $ : %reate one !nction (avaScript and save it >ilename>.?s.
!nction "$Test@A
alert@>This is Page load...>AC
DStep ' : Then go navigation bar, clic' on settings, %stomi<ation, then clic' on
soltions. ;!ter then select web &esorce, then clic' on 9ew btton.
Step / : Enter name, #ispla$ name, Select T$pe, Select 8angage, browse .?s 4le, then
clic' on Save, a!ter then clic' on pblish btton.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page 2
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 5/18
Step ( : Here $o can see $or (avaScript 4le is available, then clic' on Save and close
btton.
Step 0 : ;gain go to navigation bar, settings, cstomi<ation, then clic' on Soltions.
select entities nder the entit$ section, then clic' on orm. a!ter then clic' on .orm
roperties.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 6/18
Step 1 : clic' on ;dd btton and browse (S 4le which on $o pload on web recorse,
then go to event handlers part and select here control name as a orm, then select
Event, then clic' on add btton here select librar$ name and write here !nction name.
ma'e sre !nction name shold be same .
then clic' on o' btton, a!ter then clic' on o' btton.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page F
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 7/18
Step 2 : Then clic' on save btton, Pblish, Save and %lose btton.
Step 3 : then go to opportnit$ clic' on an$ record then $o got the popp message.
see below.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 8/18
.orm Save event usage :
.orm Save : This is a !orm event. It e)ectes when a !orm is saved. "ost common se
is to stop an operation !rom e)ecting, as a reslt o! a !ailed validation procedre.
The 7nSave event occrs once when the ser clic's on an$ one o! the three save
bttons @Save, Save %lose and Save 9ewA or when code !orces the !orm to save.
Similar to 7n8oad, an$ nmber o! event handlers can be registered !or 7nSave o! orm.
7nSave event can be sed !or data validation and data maniplation.
Ho) to apply .orm Save Event in MS Dynamics CRM online :
4ote : Step $ to Step 0 same as previews topic.
Step 1 : Here select event as a > 5nSave >, then clic' on 7' btton.
4ote : ;gain Step 2 and Step 3 are same as previews.
.ield change event usage
ield change event sage on speci4c 4eld, It e)ectes when tabbing ot o! a 4eld
where $o5ve changed the vale.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page /
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 9/18
The 7n%hange event occrs at the 4eld level. 7n%hange event triggers whenever data
in a !orm 4eld changes or !ocs is lost. #ata validation happens be!ore and a!ter the
7n%hange event. Similar to 7n8oad, an$ nmber o! event handlers can be registered
!or 7n%hange o! a 4eld.
.ield change Event in MS Dynamics CRM online :
Select here an$ controller name and select Event name as a 7n%hange Event.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page 1
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 10/18
Working )ith ta!s and sectionsBsiness &les within "icroso!t #$namics %&" 3*+ allows sers to add !nctionalit$
to the s$stem that in previos versions o! #$namics %&" reired development.
Previosl$, (avaScript wold be sed to hide 4elds and tabs on !orms in order to onl$
present sers with relevant 4elds.
Ho) to customi6e ta!s and section :Step $ : Go to 9avigate bar Select Settings J Customi6ations J Customi6e the
System. 7pen the entit$ !orm that needs to be cstomi<ed.
Step ' : Knder the Insert Tab, select the Section btton and add a one colmn
section.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 11/18
Step / : %lic' on the section and then sing the 4eld e)plorer, doble clic' 4elds or
drag and drop 4eld to add them to the section.
Step ( : Select each 4eld that was added and clic' the %hange Properties. In the 4eld
properties window, nchec' the bo) !or >=isible b$ de!alt> and ma'e sre the bo) is
chec'ed !or >#ispla$ label on !orm>. Then clic' on 7L btton.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page **
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 12/18
Step 0 : Select the section, clic' %hange Properties !rom the ribbon and then give the
section a meaning!l name and label !or that groping o! 4elds. %hec' the bo)es ne)t
to >Show the label o! this section on the orm> and >Show a line at the top o! the
section. then clic' on 7L btton
.
Step 1 : In Entit$ e)pend, then e)pend Entities, clic' the Bsiness &les btton. then
clic' 9ew Bsiness &le at the bottom o! the Bsiness &les E)plorer. ; new windowwill open.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *3
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 13/18
Step 2 : Give the Bsiness &le a descriptive name. Knder the %ondition area, clic' the
pls sign.
Step 3 : Knder ;ction section Select Set visibilit$, then clic' on right icon. ;dd a
description !or the Bsiness &le, ;t the top o! the window clic' Save and clic'
;ctivate.
Step 7 : %lic' Save ;s !rom the top o! the Bsiness &le window. The s$stem will
create a cop$ o! the Bsiness &le.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *+
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 14/18
Step $" : In the new Bsiness &le, pdate the name o! the Bsiness &le, pdate the
%ondition operator to >#oes 9ot Eal>, pdate the 4eld visibilities nder ;ction to
statses o! >Hide ield> and pdate the description. 0hen 4nished, Save and ;ctivate
the second bsiness rle. %lose the bsiness rles.
Step $$ : %lic' on Pblish ;ll %stomi<ation.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *2
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 15/18
Step $' : I! %it$ 9ot Eal to pne ;dd 9ew Tab section is hide . i! %it$ Eal to pne it
show. see below.
Com!ining events8he &ollo)ing is )hat )e )ant to achieve:
0hen a ser opens a record, i! the record is mar'ed as special cstomer, we want
to collect additional in!ormation abot him:her.
0hen a ser opens a record that is not mar'ed as special cstomer, we want to hide
the additional 4elds.
0hen a ser changes a record !rom special to not special or bac', we want the !orm
to d$namicall$ show or hide the 4elds.
Step $ : ;dd one 4le in general tab as a special cstomer@#ata T$pe 7ption T$peMNes:9oOA, and add new tab !or special %stomer nder the tab $o can add some
4eld5s. see below.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 16/18
Step ' : ;dd this ?ava script 7n%hange event !or Special %stomer@Nes:9oA.
&unction ChangeCustomer9
;
var <isSpecialSelection = null>
var <isSpecial = ?rm#age#getAttri!ute9@!ispdata<ne)<isspecialcustomer@>
i&9<isSpecial = null ;
<isSpecialSelection = <isSpecial#getValue9>
B
i&9<isSpecialSelection == &alse;
hide the Special Customer ta!
?rm#age#ui#ta!s#get9@ta!</@#setVisi!le9&alse> hide the Customer Classication eld
?rm#age#ui#controls#get9@!ispdata<mo!ileno@#setVisi!le9&alse>
hide the artner eld
?rm#age#ui#controls#get9@!isp<emailid@#setVisi!le9&alse>
B
else i&9<isSpecialSelection == true;
sho) the Special Customer ta!
?rm#age#ui#ta!s#get9@ta!</@#setVisi!le9true>
sho) the Customer Classication eld
?rm#age#ui#controls#get9@!ispdata<mo!ileno@#setVisi!le9true> sho) the artner eld
?rm#age#ui#controls#get9@!isp<emailid@#setVisi!le9true>
B
B
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *F
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 17/18
Step / : ;!ter add open $o ield see reslt below.
I! select option Nes it show $o special tab else it hide special tab.
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page *
8/10/2019 Rules and Events in MS Dynamics CRM
http://slidepdf.com/reader/full/rules-and-events-in-ms-dynamics-crm 18/18
www.bispsoltions.com www.bisptrainigs.com www.h$periongr.com Page */