Sage CRM Developers Course Workflow 2 Looking ahead

  • Slides: 23
Download presentation
Sage CRM Developers Course Workflow (2)

Sage CRM Developers Course Workflow (2)

Looking ahead to the classes DP 01: Introduction to the Development Partner Program DP

Looking ahead to the classes DP 01: Introduction to the Development Partner Program DP 02: Entities and the Data Model (Part 1 of 2) DP 03: Entities and the Data Model (Part 2 of 2) DP 04: Implementing Screen Based Rules (Part 1 of 2) DP 05: Implementing Screen Based Rules (Part 2 of 2) DP 06: Screen and User Independent Business Rules DP 07: Workflow (Part 1 of 2) DP 08: Workflow (Part 2 of 2) DP 09: Using the API Objects in ASP Pages (Part 1 of 2) DP 10 : Using the API Objects in ASP Pages (Part 2 of 2) DP 11: Using the Component Manager DP 12: Programming for the Advanced Email Manager DP 13: Using the Web Services API DP 14: Using the Web Services API (Part 2 of 2) DP 15: Coding the Web Self Service COM API (Part 1 of 2) DP 16: Coding the Web Self Service COM API (Part 2 of 2) DP 17: Using the. NET API (Part 1 of 2) DP 18: Using the. NET API (Part 2 of 2)

Agenda Workflow 2 Escalations and Simple Notifications – Mechanisms Used – Escalation Service Workflow

Agenda Workflow 2 Escalations and Simple Notifications – Mechanisms Used – Escalation Service Workflow Rules Table Escalation Table Building Escalation rules using views Structure of an escalation rule Controlling the firing point Concept of Succession and Interactions with other rules Limitations and available actions for escalation rules

Workflow Control of process and data tasks CRM offers graphical representation Progress through logical

Workflow Control of process and data tasks CRM offers graphical representation Progress through logical arbitrary steps/states using ‘rules’ that govern transition Rules Time driven action – Uses SQL to check the data and time condition – E. g. whether the rule is executed 2 types of rule (Quick) Notification Escalation rules

Workflow Configuration 1 The Reminder field on the Enter New Task and Enter New

Workflow Configuration 1 The Reminder field on the Enter New Task and Enter New Appointment pages is enabled. Setting this field to, for example, 10 minutes, displays a notification message on the user's screen 10 minutes prior to the planned time of the communication. Quick Notifications are activated. Escalation rules within Administration Timings Service Level Agreements are activated. Escalation Notify Interval This is the "Master Switch" that activates notification reminders and escalation rules. When this is set to Yes the follow behavior changes All escalation-type rules within workflow are activated. All escalation-type rules outside of workflow, including the default escalation rules supplied with the system are activated. The interval expressed in seconds between the server polling clients for notification reminders or escalation rules to be run if the CRM Escalation Service is not being used. If you are using the CRM Escalation Service, the minimum is 5 minutes by default. (300 second = 5 minutes)

Workflow Configuration 2 Notification Display Count The most commonly used type of workflow action

Workflow Configuration 2 Notification Display Count The most commonly used type of workflow action associated with escalation rules is the "Notification", the on screen alert. This setting controls the number of notifications that can be shown on-screen at any one time. Notify E-mail Name If your Escalation rules or Quick Notifications are set to issue emails, then this field holds the name that appears on any email sent by the rules. Notify E-mail Address The valid e-mail account that is used to send the e-mails. Escalation Engine Tuned For Selecting "Immediate Delivery" means that the notification gets processed when the Communication, or associated entity record, is created or edited, as well as every time the system polls at the Notification Interval.

Notifications & Escalations Notifications are much easier for the System Administrator to define but

Notifications & Escalations Notifications are much easier for the System Administrator to define but are more limited in scope. Both expressed using SQL Both stored in workflow rules table – To list existing escalation rules from database use: – select * from workflowrules – where wkrl_ruletype = 'Time‘ Both fired and controlled by the escalation mechanism Both logged in escalations and SQL logs Notifications tied to the use of the Escalations table Table data used for basis of timings and SLA data.

Tracking Rule behaviour Nov 19 2007 21: 44: 50. 031 1160 2148 3 fselectsql,

Tracking Rule behaviour Nov 19 2007 21: 44: 50. 031 1160 2148 3 fselectsql, time, sql 31 select * from v. Workflow. Rules. Transition. Info where ( Wk. Rl_Workflow. Id IS NULL OR (Wk. Tr_Transition. Id IS NOT NULL AND Work_Enabled = N'y')) AND Wk. Rl_Rule. Type = N'Time' AND ((Wk. Rl_Next. Run. Time < '20071119 21: 44: 50' OR Wk. Rl_Next. Run. Time is NULL) OR Wk. Rl_Run. Interval IS NULL) AND Wk. Rl_Enabled = N'Y' order by Wk. Rl_Entity Nov 19 2007 21: 44: 50. 046 1160 2148 3 fselectsql, time, sql 0 select * from v. Workflow. Actions where COALESCE(Wk. Rl_Rule. Id, 0) = 65 AND Wkac_action = N'Notify‘ Nov 19 2007 21: 44: 50. 046 1160 2148 3 fselectsql, time, sql 0 select * from v. Workflow. Actions where COALESCE(Wk. Rl_Rule. Id, 0) = 117 AND Wkac_action = N'Notify‘ Nov 19 2007 21: 44: 50. 093 1160 2148 3 fselectsql, time, sql 32 select * from v. Escalation. Comms WITH (NOLOCK) WHERE Escl_Date. Time<'20071119 21: 44: 50' And Escl_User. ID=1 AND Upper(RTRIM(comm_status))=N'PENDING' ORDER BY Comm_Communication. Id Nov 19 2007 21: 44: 50. 109 1160 2148 3 fselectsql, time, sql 15 select * from v. Workflow. Actions where COALESCE(Wk. Rl_Rule. Id, 0) = 10127 AND Wkac_action = N'Notify‘ Nov 19 2007 21: 44: 50. 281 1160 2148 3 fselectsql, time, sql 172 select * from v. Notification. Orders WITH (NOLOCK) WHERE orde_repricenotify = 'Y' and 1 = v. Notification. Orders. orde_createdby AND ((Escl_Escalation. Id is NULL ) OR (Escl_Workflow. Rule. Id <> 10127 ) OR ((Escl_Work. Flow. Rule. Id = 10127 ) AND Escl_Datetime < '20071119 21: 44: 50' AND Escl_User. Id = 1)) ORDER BY Orde_Order. Quote. Id Logs SQL Log Escalations Log Sys. Admin extension Nov 19 2007 21: 44: 50. 296 1160 2148 3 fselectsql, time, sql 0 select * from v. Workflow. Actions where COALESCE(Wk. Rl_Rule. Id, 0) = 10128 AND Wkac_action = N'Notify‘ Nov 19 2007 21: 44: 50. 421 1160 2148 3 fselectsql, time, sql 110 select * from v. Notification. Quotes WITH (NOLOCK) WHERE quot_repricenotify = 'Y' and 1 = v. Notification. Quotes. quot_createdby AND ((Escl_Escalation. Id is NULL ) OR (Escl_Workflow. Rule. Id <> 10128 ) OR ((Escl_Work. Flow. Rule. Id = 10128 ) AND Escl_Datetime < '20071119 21: 44: 50' AND Escl_User. Id = 1)) ORDER BY Quot_Order. Quote. Id Nov 19 2007 21: 44: 50. 437 1160 2148 3 fselectsql, time, sql 0 select * from v. Workflow. Actions where COALESCE(Wk. Rl_Rule. Id, 0) = 10123 AND Wkac_action = N'Notify‘ Nov 19 2007 21: 44: 50. 468 1160 2148 3 fselectsql, time, sql 16 select * from v. Escalation. Quotes WITH (NOLOCK) WHERE (quot_Is. Quote is not null) AND UPPER(RTRIM(quot_Status))=UPPER(RTRIM(N'Active')) AND (Escl_Date. Time<'20071119 21: 44: 50' And Escl_User. ID=1) ORDER BY Quot_Order. Quote. Id

Simple Notification Creation Default Primary Entity Support Cases Communication Company Lead Opportunity Person Rule

Simple Notification Creation Default Primary Entity Support Cases Communication Company Lead Opportunity Person Rule based e. g. send an e-mail to john when case = high priority and customer = xxxx Email Notifications use templates and can have attachments

Building a Notification Meta Data definition Workflow. Rules Tables Automatic Implicit use of Escalation

Building a Notification Meta Data definition Workflow. Rules Tables Automatic Implicit use of Escalation rules When creating task with reminder Insert Communication Link Insert Escalation record Rules based on views that link main entity with escalation table v. Notification. Cases v. Notification. Communication v. Notication. Company v. Notification. Lead v. Notification. Opportunity v. Notification. Person

Example Escalation Rules Escalation Rule State to State in workflows Time based (Escalation service)

Example Escalation Rules Escalation Rule State to State in workflows Time based (Escalation service) Escalation Rule is set to trigger an action or series of actions based on an SQL WHERE clause. – (Or. Qu_Expire. Delivery<#T) AND (Or. Qu_Is. Quote is not null) AND (UPPER(RTRIM(Or. Qu_Status))=UPPER(RTRIM(N'Active'))) #Codes

# Codes Code Meaning #U Current User ID #L Current User Logon Name #T

# Codes Code Meaning #U Current User ID #L Current User Logon Name #T Current System Date/Time #C Current User Team ID #D Current User Team Name #I Current Order/Quote ID #R Recent List Info #O Current Opportunity ID Current Version Order/Quote #N Escalation Rules Dashboard SQL Blocks SQL Order. Quotes Configuration P P P O O O P P P O P O P O O P

Primary Global Escalation Transitional P P Conditional P P P P O P P

Primary Global Escalation Transitional P P Conditional P P P P O P P NA NA P P P O O O O O Create Outbound Call List Export Target List to File Create Task for Target List Create Document for Target List Run Stored Procedure Execute SQL Statement Create Merge Document Create Solution Create Lead Create Case Create Opportunity Create Task Send SMS Message Send Email Show Notification on Screen Show Message on Screen Display Field for Amendment Reset Column Value Set Column Value Action Availability O O P P P P P P P P P P P P P P O

Dates and Times in Escalation Rules Example Trigger clause 1 Example Trigger Clause 2

Dates and Times in Escalation Rules Example Trigger clause 1 Example Trigger Clause 2 (quot_Is. Quote is not null) AND UPPER(RTRIM(quot_Status))=UPPER(RTR case_assigneduserid=#U and IM(N'Active')) AND (Escl_Date. Time<#T And (case_notifytime+7)>#T Escl_User. ID=#U) Or #T and #U codes represent the current time and the currently logged on user. #T is equivalent to get. Date in an implementation on SQL Server. (quot_Is. Quote is not null) AND UPPER(RTRIM(quot_Status))=UPPER(RTR IM(N'Active')) AND (Escl_Date. Time #T ) and ((oppo_targetclose - 28) < #T) DATEDIFF (mi, case_notifytime, getdate()) > 30

Notification Actions A rule will fire regularly according to the Notification interval. When it

Notification Actions A rule will fire regularly according to the Notification interval. When it fires it will refresh the Notification on the screen. Column: This is the datetime field that is referenced in the trigger clause of the rule. If it is left blank, then the notifications may not be dismissed. When a notification is dismissed the column value in the database is set to null. When the snooze option is used the datetime is changed by the amount indicated. Message: Enter the "Name" of the message. This creates entry in the translation table, custom_captions. The capt_code is the name you have provided, the Capt_Family is Action. Text and the Capt_Family. Type will be Tags. To define the actual notification message that appears on the screen you have to edit the message once the action has been saved. In escalation actions, you can use #[field name]# with any field from the current table or any field from the user table. You can use HTML tags such as <BR> to force new lines. Or you can use tags such as <B> and <STRONG> Table: This is the table to be updated. The example rule under discussion "Quote Expiry" is based on the view v. Escalation. Quotes but you must name the Escalation table here.

Xxxx_notifytime Tables such as Opportunity and Cases have a field called xxxx_notifytime e. g

Xxxx_notifytime Tables such as Opportunity and Cases have a field called xxxx_notifytime e. g oppo_notifytime. To create an escalation rule that uses this field then your SQL trigger clause should include the predicate xxxx_notifytime < #T Note: New for cases and opportunities the xxxx_notifytime will be blank unless you define the field in the Primary rule to set the xxxx_notifytime to a valid datetime. If the field is null it means that the notification will never fire.

The Escalation Table The two of the default example rules, – Quote Expiry –

The Escalation Table The two of the default example rules, – Quote Expiry – Communication Reminder are based on views that include the escalation table. Quick Notification Rules are also based on views that link a main entity with escalation table Case – v. Notification. Cases Communication – v. Notification. Communication Company – v. Notication. Company Lead – v. Notification. Lead Opportunity – v. Notification. Opportunity Person- v. Notification. Person These types of rules are relying on some inbuilt behavior within CRM to populate the escalation table with the needed row. For example there is automatic implicit use of Escalation rules when you create a task and set a reminder. Not only is there a communication and a comm_link record created but there will also be an escalation record created.

The Stop Clause concept The repeated firing of a rule is not an issue

The Stop Clause concept The repeated firing of a rule is not an issue with on screen notifications but it would be an issue for a rule that repeatedly fired emails! How do we stop an escalation rule from re-sending emails every 5 minutes? The default escalation rule Email Reminder has the following SQL trigger clause (Cm. Li_Comm_Notify. Time<#T) AND (UPPER(RTRIM(Comm_Status))=UPPER(RTRIM(N'Pending'))) AND (Cm. Li_SMSMessage. Sent IS NULL) AND (UPPER(RTRIM(Comm_SMSNotification))=UPPER(RTRIM(N'Y'))) It has 2 actions. The first is the sending of the email. The second is an action to set a field value. – The field Cm. Li_SMSMessage. Sent is being used as the "Stop Clause". – The email message is only sent when the field is null and after the email is sent the field is set to "Y". – The action of firing the rule will create the condition that prevents it firing again.

The Interval In the definition of an Escalation rule there is a field called

The Interval In the definition of an Escalation rule there is a field called "Interval". This defines the interval, expressed in minutes, at which the rule will run. If the Interval is set to 60 minutes, the escalation rule will run every hour. SQL log extract Nov 19 2007 21: 44: 50. 031 1160 2148 3 fselectsql, time, sql 31 select * from v. Workflow. Rules. Transition. Info where ( Wk. Rl_Workflow. Id IS NULL OR (Wk. Tr_Transition. Id IS NOT NULL AND Work_Enabled = N'y')) AND Wk. Rl_Rule. Type = N'Time' AND ((Wk. Rl_Next. Run. Time < '20071119 21: 44: 50' OR Wk. Rl_Next. Run. Time is NULL) OR Wk. Rl_Run. Interval IS NULL) AND Wk. Rl_Enabled = N'Y' order by Wk. Rl_Entity Escalation rules are checked for firing at the interval that is specified in the Workflow Configuration screen. (Default 300 seconds) The system looks for all escalation and notification rules (Wk. Rl_Rule. Type = N'Time') which are enabled (Work_Enabled = N'y')) and whether they are due to fire. Wk. Rl_Next. Run. Time < '20071119 21: 44: 50' OR Wk. Rl_Next. Run. Time is NULL) OR Wk. Rl_Run. Interval IS NULL Each escalation rule has a field called Wk. Rl_Next. Run. Time. If the rule has an interval defined the Wk. Rl_Next. Run. Time is updated with a new future due time based on the interval from the time it fires. The Interval can be used to cause rules to fire repeatedly but within certain time frames. For example, for high priority cases we could specify an email is to be sent between 7 am and 9 am every day to the assigned user reminding them of its importance.

Succession and Recursion Succession You can create a rule that when it fires will

Succession and Recursion Succession You can create a rule that when it fires will cause the conditions that will trigger another rule. Proper succession will progress until data is stable. Recursion It is possible to create rules that trigger the original rules.

Q&A

Q&A

Looking ahead to the classes DP 01: Introduction to the Development Partner Program DP

Looking ahead to the classes DP 01: Introduction to the Development Partner Program DP 02: Entities and the Data Model (Part 1 of 2) DP 03: Entities and the Data Model (Part 2 of 2) DP 04: Implementing Screen Based Rules (Part 1 of 2) DP 05: Implementing Screen Based Rules (Part 2 of 2) DP 06: Screen and User Independent Business Rules DP 07: Workflow (Part 1 of 2) DP 08: Workflow (Part 2 of 2) DP 09: Using the API Objects in ASP Pages (Part 1 of 2) DP 10 : Using the API Objects in ASP Pages (Part 2 of 2) DP 11: Using the Component Manager DP 12: Programming for the Advanced Email Manager DP 13: Using the Web Services API DP 14: Using the Web Services API (Part 2 of 2) DP 15: Coding the Web Self Service COM API (Part 1 of 2) DP 16: Coding the Web Self Service COM API (Part 2 of 2) DP 17: Using the. NET API (Part 1 of 2) DP 18: Using the. NET API (Part 2 of 2)