Sample CRM Application
Required environment/configuration variables:
Name | Description | Default Value |
---|---|---|
MAIL_USER | The mailbox user | - |
MAIL_PASSWORD | The mailbox password | - |
MAIL_RECIPIENT | The mail recipient | - |
MAIL_PROTOCOL | The mailbox protocol | smtps |
MAIL_HOST | The mailbox host | smtp.gmail.com |
MAIL_PORT | The mailbox port | 465 |
MAIL_AUTH | The mailbox auth | true |
-
Setup Dirigible instance or use the trial one
- https://www.dirigible.io/help/setup.html
- https://www.dirigible.io ->
Try it Out
- or click on the button
-
Clone the
Sample CRM
repository into your Dirigible instance:- Switch to the
Git
perspective - Click on the
+
button to clone Git repository - Set the
URL
to https://github.com/dirigiblelabs/sample-crm.git - Click the
Clone
button
- Switch to the
-
Setup a mail configuration:
-
Expand the
crm-config
project -
Open
mail.js
-
Replace the following snippet with your values:
var mailUser = "<your-mail-user>"; var mailPassword = "<your-mail-password>"; var mailRecipient = "<the-mail-recipient>";
TIP: Since Google’s Gmail SMTP server is being used, you’ll have to make some adjustment to your Google security settings. You’ll have to turn on the “Less secure app access” so that this e-mail can go through to your inbox:
The first time, when mail is sent, a notification for "3rd party usage" in your Gmail mailbox will be sent, that needs to be confirmed.
-
-
Extend the
Entity Data Model
(model.edm) file:- Switch to the
Workbench
perspective - Expand the
crm
project - Open the
model.edm
file - Drag & Drop new field to the
Account
entity - Rename the new field to
HomePage
- Right click on the
HomePage
field and clickProperties
- Go to the
Data
tab and change theLength
property to64
- Go to the
User Interface
tab and set theWidget Type
toURL
and change theLength
property to64
- Exit the
Properties
page - Save the model
- Switch to the
-
Re-generate the application:
- Right click on the
model.model
file - Click on the
Generate
option - Enter the following properties:
- Extension:
crm
- Embedded:
true
- Title:
CRM
- Brand:
CRM
- Extension:
- Right click on the
-
Add sample data:
- Expand the
crm
project and select theindex.html
file - From the
Preview
view copy the application URL and open it in separate tab - Open the
Account
entity - Edit some of the account entries and enter the
HomePage
field
- Expand the
-
Overview:
- Expand the
crm-quote-approval
and open thequote-approval.bpmn
file - The process contains three steps and one flow condition:
StartProcessTask
- initial task to set the execution contextSendNotificationTask
- depending on the flow condition, the task is triggered when theQuote -> Amount
is greaterr than10
and mail notification is sentAutoApproveTask
- auto approval of the createdQuote
if theAmount
is less than10
- Expand the
-
Trigger the
Quote Approval
process:- Navigate to the
Sales
section and select theQuote
tile - Select the
Quote
tab, if needed - Create new
Quote
withAmmount
greater than10
After few seconds, "Quote Approval" mail should be recieved:
- Navigate to the
-
Update the mail message template:
- Expand the
crm-quote-approval
project and open themail.html
file - Replace the file content with this one:
<!DOCTYPE html> <head> </head> <body> <h1>[Approve Quote] ${quoteAccount} - ${quoteProduct}</h1> <hr> <p> <b>Account</b>: <i>${quoteAccount}</i> </p> <p> <b>Product</b>: <i>${quoteProduct}</i> </p> <p> <b>Discount</b>: <i>${quoteDiscount}</i> </p> <p> <b>Quote Amount</b>: <i>${approveAmount}</i> </p> <br> <a href="https://www.dirigible.io">Approve</a> </body> </html>
- Create new
Quote
withAmount
less than10
to trigger the notification process with the updated mail template
- Expand the
-
Update process:
- Other changes to
quote-approval.bpm
can be made, such as:- Update the flow condition (e.g. change it to greater than
100
) - Add new step(s)
- Add new flow condition(s)
- Update the flow condition (e.g. change it to greater than
- To apply the updated process follow these steps:
- Click on the
Save
icon - Right click on the
crm-quote-approval
project and selectPublish
from the menu - Wait around
30 sec.
before triggering the updated process
- Click on the
- Open the
Create Quote
listener:- open the
quote-create.listener
file - when
crm/Sales/Quote/Create
event is created, then thecrm-quote-approval/triggerApprovalProcess.js
handler will be triggered - open the
triggerApprovalProcess.js
file to see how thequote-approval
process is being started
- open the
- Other changes to
In some cases, when updating the Entity Domain Model (model.edm), incompatible changes may occur. To resolve these issues, here are some Tips & Tricks about it:
- Delete the generated files:
- Delete all files under the "crm" project except
model.edm
,model.model
andproject.json
- Delete all files under the "crm" project except
- Unpublish the
crm
project - Re-generated the application from the updated
model.model
- Publish the
crm
project
In most cases, the previous steps should be enough to resolve issues from an incompatible change in the model. However, if incompatible change in the Data
layer is made (e.g. Null
-> Not Null
, VARCHAR
-> INTEGER
, ...) then one addition step should be executed first:
- Go to the
Database
perspective - Find the database table(s), to which incompatible changes were made
- Right click on it
- Select
Drop Table
from the menu
Otherwise execute SQL queries, to drop the table(s), from the SQL
view:
drop table STUDENTS
In some cases the generated application view(s) may disappear or be closed by accident. To reset the default layout follow these steps:
- Click on the "Themese" menu
- Select the "Reset" option
This project is copyrighted by SAP SE and is available under the Eclipse Public License v 2.0. See LICENSE and NOTICE.txt for further details.