-
Notifications
You must be signed in to change notification settings - Fork 15
Tutorial 3
PhuocLe edited this page Aug 24, 2018
·
8 revisions
- When creating lead, topic field always uppercase. But when editing, it cannot edit
- When creating/editing lead, if user enter Business Phone they should be enter Mobile Phone too and vice versa. Otherwise, 2 fields can be blank
- Finish Tutorial 1
- Finish Tutorial 2
- Add
New Project
5. C# WebResource Project
to your solution- A popup form
Add new WebResource Project
opened - Click button
><
to create/select a Dynamics 365 connection - After connected, click
OK
-
PL.DynamicsCrm.DevKit
created project name:Paz.LuckeyMonkey.WebResource
- A popup form
- Rebuild solution to restore
NuGet
packages - Open file
PL.DynamicsCrm.DevKit.Cli.json
by Notepad and edit these information in section:webresources.profile = "DEBUG"
webresources.solution= "LuckeyMonkey"
webresources.prefix= "paz_"
- Add
New Item
7. JavaScript Form
toentities
folder ofPaz.LuckeyMonkey.WebResource
project- A popup form
Add new Js Form Class
opened - Click button
><
to create/select a Dynamics 365 connection - After connected
PL.DynamicsCrm.DevKit
loaded all entities and bind to dropdownEntity
- Select
Lead
in theEntity
then clickLoad Forms
button - Select
Lead
in the list checkbox (This list load all formsLead
) - Click
OK
- A popup form
-
PL.DynamicsCrm.DevKit
created3
JavaScript files-
Lead.js
write your JavaScript code here, deploy this file to Dynamics 365 -
Lead.form.js
DON'T changes this file, it will be lost when you re-generate, deploy this file to Dynamics 365 -
Lead.intellisense.js
DON'T changes this file, it will be lost when you re-generate. DON'T deploy this file to Dynamics 365
-
- If you are using
Visual Studio 2017
pleaseturn off
Enable the new JavaScript language service
in theTools
->Options
->Text Editor
->JavaScript/TypeScript
->Language Service
and restartVisual Studio
- Open
Lead.js
and begin coding the task.
///<reference path='Lead.intellisense.js' />
var formLead = (function () {
function onLoad(executionContext) {
var form = new LuckeyMonkey.FormLead(executionContext);
if (form.FormType !== OptionSet.FormType.Create) {
form.Body.Subject.Disabled = true;
}
else {
form.Body.Subject.AddOnChange(SubjectAddOnChange);
}
form.Body.Telephone1.AddOnChange(PhoneAddOnChange);
form.Body.MobilePhone.AddOnChange(PhoneAddOnChange);
}
function onSave(executionContext) {
}
function SubjectAddOnChange(executionContext) {
var form = new LuckeyMonkey.FormLead(executionContext);
if (form.Body.Subject.Value !== null) {
form.Body.Subject.Value = form.Body.Subject.Value.toUpperCase();
}
}
function PhoneAddOnChange(executionContext) {
var form = new LuckeyMonkey.FormLead(executionContext);
if (form.Body.Telephone1.Value !== null &&
form.Body.MobilePhone.Value !== null) {
form.Body.Telephone1.RequiredLevel = OptionSet.FieldRequiredLevel.Required;
form.Body.MobilePhone.RequiredLevel = OptionSet.FieldRequiredLevel.Required;
}
else {
form.Body.Telephone1.RequiredLevel = OptionSet.FieldRequiredLevel.None;
form.Body.MobilePhone.RequiredLevel = OptionSet.FieldRequiredLevel.None;
}
}
return {
OnLoad: onLoad,
OnSave: onSave
};
})();