Business Process
Business Process/Logic
Implenting Business Processes
- can be used for
- preserving data quality
- automatic processes
- keeping processes from getting ‘stuck’
- keeping systems in sync
- auditing
- Features
- Formula fields
- Validation rules
- Approval process
- Workflow Rules
- Outbound Messaging
- Field History Tracking
- Setup Audit Trail
- Functions
- ischanged – compares with previous value and returns true if it is changed
- priorvalue – returns the previous value of the field
- isnew – checks if a formula is running during creation of new record and returns true if it is
- ispickval – determines if the value of pickuplist is equal to specified string
- regex – string used to describe the format of the string according to certain syntax rules. It compares a text field to regular expression and returns true, if there is a match
- vlookup – returns value by looking up a record value in a custom object. It checks against a key and returns value from that key.
- isnumber – returns true if a text value is number
- case – checks against a series of values
- image – inserts an image
- htmlencode – encodes text stings and merge field values for use in html (e.g. ‘<’)
- jsencode – encodes text strings and merge field values for use in javascript (e.g. apostrophe)
- jsinhtmlencode – encodes text strings and merge field values for use in javascript within html tags
- urlencode – encodes text strings and merge field values for use in URLs
- System Logs
- display logging info, cumulative limits and source code of transaction
- used for debugging code snippets
- used to view debug log or execute anonymous code blocks
- display system resource info
- Log levels
- from lowest to highest
- Error – lowest, produces distinct results and only error messages
- warn – warn and error
- info – info, warn and error
- debug – includes low level and calls to system.debug
- Fine/Finer – system.debug, dml, soql/sosl, entrance and exit
- Finest – includes all messages in previous levels and on apex scripts
- Debug Logs
- contain info on database changes, automated workflow processes, validation rules
- request-response xml, apex script errors, and resources used by an apex script
- records errors and system processes that occur in an org
- can be retained and managed for specific users
- 20 logs can be retained for an org, when max is reached, oldest one is overwritten
- debug log is different system log
- system log refers to console link at the top of the page
- underlying logging system is same
- sysetm log is live console, debug log is persistent store
Preserving Data Quality
- Validation Rules
- used to verify that the data entered meets the standards before the user saves the record.
- Can contain formulas or expressions that evaluate the data in one or more fields
- return true or false
- are executed for fields that are stored in the object, but not part of the displayed page layout
- can be used for
- enforce conditionally required fields
- enforce required data formats
- enforce data consistency
- prevent data loss
- can be used in conjunction with a roll-up summary field can be used to prevent users from adding or deleting records
Automating Business Processes with Workflow
- Workflow Rules
- Entry Criteria then Immediate Actions or Time dependent actions
- Steps
- Specify the object (both standard & custom objects are ok)
- Select Evaluation Criteria
- only when a record is created
- when it’s created or edited and now meets the cirteria
- every single time the record is created or updated
- Define rule criteria
- filters or formulas
- Workflow Actions: immediate or later time
- Tasks – can be assigned to user, role or record owner
- Email Alerts – can send email to one or more recipients (from address can be current user address or org wide address)
- Field Updates – can update a field value on a record (including record type/owner)
- Outbound Messages – can send specific info to designated endpoint in form of API/SOAP message
- Time-Dependent Workflow
- triggered depending on elapsed time (evaluated off of any date field in Salesforce)
- time-dependent actions have a time trigger
- the action is queued to fire
- Some considerations
- cannot use time-dependent workflow when a rule is set for evaluation, every time a record is created or updated
- when a new workflow rule is created, it does not affect existing records
- can monitor and remove pending actions by viewing the time-dependent workflow queue
- if a record that has an action pending against it in the time-based workflow queue is modified so that the record no longer meets the criteria or the timing changes, the action will be updated in the queue
- if a record no longer meets the time-based workflow rule criteria, the action is removed from queue
Automating business processes with Approval Processes
- automates routing of records for approval
- contain one or more steps and can be logically split into 6 steps
- not automatically sent for approval, user has to submit
- steps
- process definition
- it is determined which records should enter the process and what settings should apply to the whole process.
- initial submission actions
- developers decide what happens to a record after it is submitted for approval – actions are locking a record, assigning a task, sending an email, updating a field, sending an outbound message
- step definition
- developers determine whether all records should enter the step or whether records only meeting the criteria are chosen.
- if later is chosen, developer defines the criteria for entry to the step. developer also assigns the approver and determine whether the approver can delegate
- if there are multiple steps, developers can decide what should happen if a record is rejected at a step after the first step: should it go back one step, or should it be considered a final rejection
- developers determine whether all records should enter the step or whether records only meeting the criteria are chosen.
- final rejection actions
- developers define the actions to be taken when a record is rejected
- actions are: unlock a record, assign a task, send an email, update a field, send an outbound message
- final approval actions
- developers define actions to be taken when a record is approved
- actions are: unlock a record, assign a task, send an email, update a field, send an outbound message
- recall actions
- developers define actions to be taken when a record is recalled from the process.
- process definition
- Workflow Rule vs Approval Process
- Workflow rule
- are triggered upon save
- consist of one set of criteria and actions
- can be modified or deleted
- Approval process
- triggered only when a user clicks submit for approval
- consist of multiple steps, have entry criteria, step criteria and step actions; have initial submission actions, rejection and approval actions and actions for each step
- some attributes can’t be modified, processes must be deactivated before they can be deleted
- Workflow rule
- Skipping steps
- allows developers to skip steps within an approval process based on specific criteria
- skip step is a step that has criteria defined to determine whether or not approval is required
- 3 options
- go to next step
- approve record
- reject record
- considerations
- Go to next step” option is only available when editing a step that already has an ensuing step (so first create ensuing step)
- selection the “go to next step” option in a step and subsequently delete all ensuing steps, sf changes the step to automatically reject record, if the step criteria are not met
- selecting the “go to next step” in the first step when the record does not meet the criteria for any of the steps in the approval process, rejects the record
- Parallel approval process
- can send approval upto 25 different users simultaneously
- Dynamic Approval Process
- Used to route records for approval based on complex approval matrices
- Used to route approval requests to users listed in lookup fields on the record requiring approval
- Steps
- create a lookup fields on the object beign approved
- uses lookup relationship
- if it requires 3 approvers, then create 3 lookup relationships
- Create a custom object as an approval matrix
- Populate the approval matrix
- Create Apex code to fill in the lookup fields from the approval matrix
- Create or update an approval process to utilize the new lookup fields
- create a lookup fields on the object beign approved
- Automated processes occur in the following order
- Validation Rules->Assignment rules->Auto-Response rules->Workflow rules->Escalation rules
Auditing Processes
- Setup Audit Trail
- tracks changes made to the setup of an org
- lists the date of the change, the name of the user who made the change and a description of the change
- displays 20 most recent changes
- tracks changes for 180 days
- can choose upto 20 fields per object for tracking changes
- Field History Tracking
- allows to track the history related lists for cases, contacts, leads, opportunities, solutions, accounts, contracts, and custom objects
- modification to any standard or custom field, whose history is set to be tracked, results in a new entry in the History related list
- for most field types, both the old and new values are captured in the History related list; however those values are not tracked for long text area and multi-select picklist type fields
- tracks changes for upto 20 fields
- 3 tools
- debug logs, setup audit trail, field history
Leave a comment
Comments 0