sage crm developers course

23
Sage CRM Developers Course Workflow (2)

Upload: byron

Post on 23-Feb-2016

33 views

Category:

Documents


0 download

DESCRIPTION

Sage CRM Developers Course. Workflow (2). Looking ahead to the classes. DP01: Introduction to the Development Partner Program DP02: Entities and the Data Model (Part 1 of 2) DP03: Entities and the Data Model (Part 2 of 2) DP04: Implementing Screen Based Rules (Part 1 of 2) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Sage CRM Developers Course

Sage CRM Developers Course

Workflow (2)

Page 2: Sage CRM Developers Course

Looking ahead to the classes

DP01: Introduction to the Development Partner ProgramDP02: Entities and the Data Model (Part 1 of 2)DP03: Entities and the Data Model (Part 2 of 2)DP04: Implementing Screen Based Rules (Part 1 of 2)DP05: Implementing Screen Based Rules (Part 2 of 2)DP06: Screen and User Independent Business RulesDP07: Workflow (Part 1 of 2)DP08: Workflow (Part 2 of 2)DP09: Using the API Objects in ASP Pages (Part 1 of 2)DP10 : Using the API Objects in ASP Pages (Part 2 of 2)

DP11: Using the Component ManagerDP12: Programming for the Advanced Email ManagerDP13: Using the Web Services APIDP14: Using the Web Services API (Part 2 of 2)DP15: Coding the Web Self Service COM API (Part 1 of 2)DP16: Coding the Web Self Service COM API (Part 2 of 2)DP17: Using the .NET API (Part 1 of 2)DP18: Using the .NET API (Part 2 of 2)

Page 3: Sage CRM Developers Course

Agenda

Workflow 2Escalations and Simple Notifications– Mechanisms Used– Escalation ServiceWorkflow Rules TableEscalation TableBuilding Escalation rules using viewsStructure of an escalation ruleControlling the firing pointConcept of Succession and Interactions with other rulesLimitations and available actions for escalation rules

Page 4: Sage CRM Developers Course

Workflow

Control of process and data tasksCRM offers graphical representationProgress through logical arbitrary steps/states using ‘rules’ that govern transition

RulesTime driven action– Uses SQL to check the data and time condition

– E.g. whether the rule is executed

2 types of rule(Quick) NotificationEscalation rules

Page 5: Sage CRM Developers Course

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.

EscalationThis is the "Master Switch" that activates notification reminders and escalation rules. When this is set to Yes the follow behavior changesAll 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.

Notify Interval 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)

Page 6: Sage CRM Developers Course

Workflow Configuration 2

Notification Display CountThe 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 e-mail 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.

Page 7: Sage CRM Developers Course

Notifications & Escalations

Notifications are much easier for the System Administrator to define but are more limited in scope.

Both expressed using SQLBoth 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 mechanismBoth logged in escalations and SQL logs

Notifications tied to the use of the Escalations tableTable data used for basis of timings and SLA data.

Page 8: Sage CRM Developers Course

Tracking Rule behaviour

Nov 19 2007 21:44:50.031 1160 2148 3 fselectsql,time,sql 31 select * from vWorkflowRulesTransitionInfo where ( WkRl_WorkflowId IS NULL OR (WkTr_TransitionId IS NOT NULL AND Work_Enabled = N'y')) AND WkRl_RuleType = N'Time' AND ((WkRl_NextRunTime < '20071119 21:44:50' OR WkRl_NextRunTime is NULL) OR WkRl_RunInterval IS NULL) AND WkRl_Enabled = N'Y' order by WkRl_Entity

Nov 19 2007 21:44:50.046 1160 2148 3 fselectsql,time,sql 0 select * from vWorkflowActions where COALESCE(WkRl_RuleId, 0) = 65 AND Wkac_action = N'Notify‘

Nov 19 2007 21:44:50.046 1160 2148 3 fselectsql,time,sql 0 select * from vWorkflowActions where COALESCE(WkRl_RuleId, 0) = 117 AND Wkac_action = N'Notify‘

Nov 19 2007 21:44:50.093 1160 2148 3 fselectsql,time,sql 32 select * from vEscalationComms WITH (NOLOCK) WHERE Escl_DateTime<'20071119 21:44:50' And Escl_UserID=1 AND Upper(RTRIM(comm_status))=N'PENDING' ORDER BY Comm_CommunicationId

Nov 19 2007 21:44:50.109 1160 2148 3 fselectsql,time,sql 15 select * from vWorkflowActions where COALESCE(WkRl_RuleId, 0) = 10127 AND Wkac_action = N'Notify‘

Nov 19 2007 21:44:50.281 1160 2148 3 fselectsql,time,sql 172 select * from vNotificationOrders WITH (NOLOCK) WHERE orde_repricenotify = 'Y' and 1 = vNotificationOrders.orde_createdby AND ((Escl_EscalationId is NULL ) OR (Escl_WorkflowRuleId <> 10127 ) OR ((Escl_WorkFlowRuleId = 10127 ) AND Escl_Datetime < '20071119 21:44:50' AND Escl_UserId = 1)) ORDER BY Orde_OrderQuoteId

Nov 19 2007 21:44:50.296 1160 2148 3 fselectsql,time,sql 0 select * from vWorkflowActions where COALESCE(WkRl_RuleId, 0) = 10128 AND Wkac_action = N'Notify‘

Nov 19 2007 21:44:50.421 1160 2148 3 fselectsql,time,sql 110 select * from vNotificationQuotes WITH (NOLOCK) WHERE quot_repricenotify = 'Y' and 1 = vNotificationQuotes.quot_createdby AND ((Escl_EscalationId is NULL ) OR (Escl_WorkflowRuleId <> 10128 ) OR ((Escl_WorkFlowRuleId = 10128 ) AND Escl_Datetime < '20071119 21:44:50' AND Escl_UserId = 1)) ORDER BY Quot_OrderQuoteId

Nov 19 2007 21:44:50.437 1160 2148 3 fselectsql,time,sql 0 select * from vWorkflowActions where COALESCE(WkRl_RuleId, 0) = 10123 AND Wkac_action = N'Notify‘

Nov 19 2007 21:44:50.468 1160 2148 3 fselectsql,time,sql 16 select * from vEscalationQuotes WITH (NOLOCK) WHERE (quot_IsQuote is not null) AND UPPER(RTRIM(quot_Status))=UPPER(RTRIM(N'Active')) AND (Escl_DateTime<'20071119 21:44:50' And Escl_UserID=1) ORDER BY Quot_OrderQuoteId

LogsSQL LogEscalations LogSysAdmin extension

Page 9: Sage CRM Developers Course

Simple Notification Creation

Default Primary Entity SupportCasesCommunicationCompanyLeadOpportunityPerson

Rule basede.g. send an e-mail to john when case = high priority and customer = xxxx

Email Notifications use templates and can have attachments

Page 10: Sage CRM Developers Course

Building a Notification

Meta Data definitionWorkflowRules Tables

Automatic Implicit use of Escalation rulesWhen creating task with reminderInsert CommunicationInsert Communication LinkInsert Escalation record

Rules based on views that link main entity with escalation tablevNotificationCasesvNotificationCommunicationvNoticationCompanyvNotificationLeadvNotificationOpportunityvNotificationPerson

Page 11: Sage CRM Developers Course

Example Escalation Rules

Escalation RuleState to State in workflowsTime based (Escalation service)Escalation Rule is set to trigger an action or series of actions based on an SQL WHERE clause.– (OrQu_ExpireDelivery<#T) AND (OrQu_IsQuote is not null) AND

(UPPER(RTRIM(OrQu_Status))=UPPER(RTRIM(N'Active')))

#Codes

Page 12: Sage CRM Developers Course

# Codes

Code MeaningEscalation Rules SQL

Dashboard Blocks SQL

OrderQuotes Configuration

#U Current User ID P P P#L Current User Logon Name P P O#T Current System Date/Time P P O#C Current User Team ID P P P#D Current User Team Name P P O#I Current Order/Quote ID O O P#R Recent List Info O P O#O Current Opportunity ID O O P#N

Current Version Order/Quote O O P

Page 13: Sage CRM Developers Course

Action Availability

Set Colum

n Value

Reset

Colum

n Value

Display Fiel

d for Amendment

Show

Messag

e on

Screen

Show

Notification

on Screen

Send

Email

Send

SMS

Messag

e

Create Tas

k

Create

Opportunity

Create

Case

Create Lea

d

Create Solutio

n

Create

Merge

Document

Execut

e SQ

L Stateme

nt

Run Stor

ed Procedure

Create Tas

k for Target

List

Create

Docume

nt for

Target

List

Export Target

List to

File

Create

Outbou

nd Call List

Primary P P P P O P P O O O O O O P P O O O OTransitional P P P P O P P P P P P P P P P P P P PGlobal P P P P O P P P P P P P P P P P P P PConditional P P P P O P P P P P P P P P P P P P PEscalation P P NA NA P P P O O O O O O P P O O O O

Page 14: Sage CRM Developers Course

Dates and Times in Escalation RulesExample Trigger clause 1(quot_IsQuote is not null) AND UPPER(RTRIM(quot_Status))=UPPER(RTRIM(N'Active')) AND (Escl_DateTime<#T And Escl_UserID=#U)

#T and #U codes represent the current time and the currently logged on user. #T is equivalent to getDate in an implementation on SQL Server.

(quot_IsQuote is not null) AND UPPER(RTRIM(quot_Status))=UPPER(RTRIM(N'Active')) AND (Escl_DateTime #T ) and ((oppo_targetclose - 28) < #T)

Example Trigger Clause 2

case_assigneduserid=#U and (case_notifytime+7)>#T

OrDATEDIFF (mi, case_notifytime, getdate()) > 30

Page 15: Sage CRM Developers Course

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 ActionText and the Capt_FamilyType 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 vEscalationQuotes but you must name the Escalation table here.

Page 16: Sage CRM Developers Course

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.

Page 17: Sage CRM Developers Course

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 tableCase – vNotificationCasesCommunication – vNotificationCommunicationCompany – vNoticationCompanyLead – vNotificationLeadOpportunity – vNotificationOpportunityPerson- vNotificationPersonThese 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.

Page 18: Sage CRM Developers Course

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(CmLi_Comm_NotifyTime<#T) AND(UPPER(RTRIM(Comm_Status))=UPPER(RTRIM(N'Pending'))) AND (CmLi_SMSMessageSent ISNULL) 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 CmLi_SMSMessageSent 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.

Page 19: Sage CRM Developers Course

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 extractNov 19 2007 21:44:50.031 1160 2148 3 fselectsql,time,sql 31 select * fromvWorkflowRulesTransitionInfo where ( WkRl_WorkflowId IS NULL OR(WkTr_TransitionId IS NOT NULL AND Work_Enabled = N'y')) AND WkRl_RuleType =N'Time' AND ((WkRl_NextRunTime < '20071119 21:44:50' OR WkRl_NextRunTimeis NULL) OR WkRl_RunInterval IS NULL) AND WkRl_Enabled =N'Y' order byWkRl_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 (WkRl_RuleType = N'Time') which are enabled (Work_Enabled = N'y')) and whether they are due to fire.WkRl_NextRunTime < '20071119 21:44:50' OR WkRl_NextRunTime is NULL) ORWkRl_RunInterval IS NULL

Each escalation rule has a field called WkRl_NextRunTime. If the rule has an interval defined the WkRl_NextRunTime 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 7am and 9am every day to the assigned user reminding them of its importance.

Page 20: Sage CRM Developers Course

Succession and Recursion

SuccessionYou 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.RecursionIt is possible to create rules that trigger rules that trigger the original rules.

Page 21: Sage CRM Developers Course

Q&A

Page 22: Sage CRM Developers Course

Looking ahead to the classes

DP01: Introduction to the Development Partner ProgramDP02: Entities and the Data Model (Part 1 of 2)DP03: Entities and the Data Model (Part 2 of 2)DP04: Implementing Screen Based Rules (Part 1 of 2)DP05: Implementing Screen Based Rules (Part 2 of 2)DP06: Screen and User Independent Business RulesDP07: Workflow (Part 1 of 2)DP08: Workflow (Part 2 of 2)DP09: Using the API Objects in ASP Pages (Part 1 of 2)DP10 : Using the API Objects in ASP Pages (Part 2 of 2)

DP11: Using the Component ManagerDP12: Programming for the Advanced Email ManagerDP13: Using the Web Services APIDP14: Using the Web Services API (Part 2 of 2)DP15: Coding the Web Self Service COM API (Part 1 of 2)DP16: Coding the Web Self Service COM API (Part 2 of 2)DP17: Using the .NET API (Part 1 of 2)DP18: Using the .NET API (Part 2 of 2)

Page 23: Sage CRM Developers Course