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 CRMrepository into your Dirigible instance:- Switch to the
Gitperspective - Click on the
+button to clone Git repository - Set the
URLto https://github.com/dirigiblelabs/sample-crm.git - Click the
Clonebutton
- Switch to the
-
Setup a mail configuration:
-
Expand the
crm-configproject -
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
Workbenchperspective - Expand the
crmproject - Open the
model.edmfile - Drag & Drop new field to the
Accountentity - Rename the new field to
HomePage - Right click on the
HomePagefield and clickProperties - Go to the
Datatab and change theLengthproperty to64 - Go to the
User Interfacetab and set theWidget TypetoURLand change theLengthproperty to64 - Exit the
Propertiespage - Save the model
- Switch to the
-
Re-generate the application:
- Right click on the
model.modelfile - Click on the
Generateoption - Enter the following properties:
- Extension:
crm - Embedded:
true - Title:
CRM - Brand:
CRM
- Extension:
- Right click on the
-
Add sample data:
- Expand the
crmproject and select theindex.htmlfile - From the
Previewview copy the application URL and open it in separate tab - Open the
Accountentity - Edit some of the account entries and enter the
HomePagefield
- Expand the
-
Overview:
- Expand the
crm-quote-approvaland open thequote-approval.bpmnfile - 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 -> Amountis greaterr than10and mail notification is sentAutoApproveTask- auto approval of the createdQuoteif theAmountis less than10
- Expand the
-
Trigger the
Quote Approvalprocess:- Navigate to the
Salessection and select theQuotetile - Select the
Quotetab, if needed - Create new
QuotewithAmmountgreater than10
After few seconds, "Quote Approval" mail should be recieved:
- Navigate to the
-
Update the mail message template:
- Expand the
crm-quote-approvalproject and open themail.htmlfile - 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
QuotewithAmountless than10to trigger the notification process with the updated mail template
- Expand the
-
Update process:
- Other changes to
quote-approval.bpmcan 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
Saveicon - Right click on the
crm-quote-approvalproject and selectPublishfrom the menu - Wait around
30 sec.before triggering the updated process
- Click on the
- Open the
Create Quotelistener:- open the
quote-create.listenerfile - when
crm/Sales/Quote/Createevent is created, then thecrm-quote-approval/triggerApprovalProcess.jshandler will be triggered - open the
triggerApprovalProcess.jsfile to see how thequote-approvalprocess 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.modelandproject.json
- Delete all files under the "crm" project except
- Unpublish the
crmproject - Re-generated the application from the updated
model.model - Publish the
crmproject
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
Databaseperspective - Find the database table(s), to which incompatible changes were made
- Right click on it
- Select
Drop Tablefrom the menu
Otherwise execute SQL queries, to drop the table(s), from the SQL view:
drop table STUDENTSIn 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.











