Discover the Anyleads suite | Find emails, verify emails, install a chatbot, grow your business and more!.
blog

What is process instance in Salesforce?



What is process instance in Salesforce?


If you are newbie to sales force, this article will be helpful for you. I am going to explain what an approval process is and how it works through an example.

An approval process is a set of steps that needs to follow when there is any changes made on record or records by users. It's like approvals needed before user can make those changes on records. If your company has many employees, you must have seen some processes where one employee makes change on record without proper approvals. This is not good practice as if no approvals made then other people won't know about these changes. In short, approval process helps avoid such mistakes so that everyone gets notified at once.

Let us see how it works. We'll create two different objects named "Account" & "Opportunity". For now, let's assume that both Account and Opportunity belongs to same object type (i.e. Custom Object). Now we need to create an approval group which consists of three fields. First field name should be "Status", second field is called "Reason Code" and third field is called "Comments". Once we've created our first approval group, next step is to add a few rules under each status.

In my case, I want to notify someone whenever they try to edit account details or opportunity owner. So here is what I'm doing. Instead of creating a rule based on Status = 'Approved', I'm setting up a Rule Based On statement instead.

1st Field: Status

I used the word "Fields" because only 1st field is mandatory while 2nd & 3rd fields optional. You can choose whatever you think appropriate to use but please keep them related to reason code and comments respectively. Here is what I did in my case.

2nd Fields: Reason Code

As per above screenshot, since I wanted to send email notification, I added comment field with value something like "Updated By User Name". Finally, I chose "User" from dropdown list. The drop-down lists most likely contains all active/external users who have access to particular record.

3rd Fields: Comments

This time I didn't do anything special just kept comments similar to previous status. However, you can also include multiple lines of comments depending upon your requirement. That said, feel free to leave message of more than three line(s) of comments. Just remember to put space between every single line.

Now we're almost done! One last thing left over is adding trigger. Go back to your design page and click on Home tab followed by My Pages. From the right side menu bar, select Workflow tab and finally scroll down till you find "Apex Trigger". Click on Create New Apex Trigger button. Select workflow as trigger type and check whether it matches what you selected earlier.

Once finished, go ahead and save your workbook and give it a meaningful name. Next step would be to test our newly created workflow using Developer Console. Open developer console and navigate to your recently saved WF file. From top ribbon panel, select Activities option and enter following command into search box: Test.CreateProcessInstance.

Click Enter after entering Command String and wait for few seconds until completion. At the end of testing, you'd get a pop-up window asking whether you wish to run another test instances of workflow. Let say Yes to continue further and after few seconds, you should receive an email notification stating that you successfully ran workflow.

That's it folks! We've just learned everything about approval process in Salesforce. Please note that you don't necessarily require apex triggers to implement approval process. You could simply write VBA script to achieve the same result too. But still, using apex triggers gives much better control over things. Hope you enjoyed reading this post and welcome to learn more about best practices in SFDC. Feel free to share feedback via comments below. Thanks.

Reference Links:-

https://www.youtube.com/watch?v=9tKf6GQp7q0&feature=youtu.be

https://www.youtube.com/watch?v=ZrVlj_BgSXc

https://www.youtube.com/watch?v=aJ4TkYhMdWw

Can we query approval process in Salesforce?

Yes, you definitely can! There are various ways to fetch data stored inside approval groups. Some of them being SOQL queries, Metadata API calls etc. If you're interested to learn more, kindly visit official documentation link given below.

http://docs.oracle.com/webfolder/html/SOQL_Language__QueryAPI____00211124324.htm#CHDEACAF

What is approval process in Salesforce?

Salesforce provides built-in functionality called "approvals". They provide a way to prevent unauthorized modifications on certain fields within custom objects. The idea behind approvals comes from real world situations like bank accounts or credit cards. When making payment, card holder must approve transaction before money actually goes to merchant store. Same concept applies here. Whenever any modification happens on record, anyone having permission level higher than current user can review and approve the action. Otherwise, others wouldn't know about these changes.

There are four types of approvals available in Salesforce. Each of the type serves unique purpose.

Type #1 - Simple Approve

Simple approve means that whenever any person tries to modify certain fields on records, he/she will automatically receive email containing information regarding why that specific action was denied. Also, simple approve doesn't allow users to cancel their own actions. Meaning, even though user tried to make changes on his own accord, system will reject it saying "Canceled by Owner". Below image shows how it looks like.

Type #2 - Reject

Rejection basically allows users to override simple approve settings. As mentioned previously, users cannot cancel their own action once approved. Therefore, sometimes users might make unwanted changes on records. To resolve this issue, you may opt to apply rejection. With rejection enabled, whenever any person attempts to make changes on record, s/he will immediately receive an email informing him why action was rejected. S/he can either accept or deny the request. Below image illustrates how it looks like.

Type #3 - Cancel

Similar to rejection, cancellation enables users to take back their already submitted changes. Unlike rejection, canceling action does allow users to accept it themselves. Meaning, if someone submits wrong info and later realizes mistake, s/he can always resubmit correct version of document. Below image explains cancellation in detail.

Type #4 - Manual Review

Manual review is mainly designed for cases wherein users submit incorrect values due to human error. Hence, manual review exists solely for reviewing submitted documents manually. Users aren't able to bypass manual reviews i.e. submitting erroneous changes again and again. Below image describes manual review in detail.


What is approval process in Salesforce with example?

One example scenario involves a customer trying to update account owner. He wants to change contact address but he isn't authorized to do so. Since his role is Customer Service Representative, you may want to block this kind of updates. Or else you may decide to let him make changes provided that he approves it himself. Either way, you'll need to utilize approval process. Let me show you how it works.

First off, create an object called "Customer Relationship" and open its definition form. Under Related Lists section, look out for "Relationship Detail" section. Choose Account as relationship type and pick Contact Address as source. After choosing Source, you'll notice that little icon appears next to field name. What this icon represents is whether user can delete or alter the target field. As shown in figure below, green color indicates that user can modify the target field. Whereas red color signifies that user can neither delete nor modify target field. Meaning, if you drag and drop Contact Address field onto Account object, you'll realize that blue circle attached to it keeps changing colors depending upon permissions.

Next, head over to customization screen and create an approval group. Make sure that you've chosen "Customize Grouping" radio button. Then fill in 4th row of columns with labels including Status, Comment, and Reason Code. Don't forget to assign unique ID to each column. In my case, I assigned id's starting from 10001 to 20005. Lastly, attach desired Rules to respective statuses. Remember, Rules are nothing but conditions. While defining Rules, you can specify criteria such as date range, number of days, lookup fields, external IDs, etc. Depending upon your requirements, you can play around with Rules definitions. Once you've completed setup, hit Save Changes. Be patient as it takes couple minutes to complete entire procedure.

Afterwards, return to customization screen and rename your new workflow. Rename it appropriately and then move forward to execute sample job. Navigate to Execute button located on upper part of customization pane. Input following command string into textbox provided underneath tool tip: /sobjects/[objectName]/processinstance.[piId]. Hit Enter and wait for few moments. Upon execution, you'll discover that workflow got triggered. Notice that popup window appeared indicating that workflow executed successfully.

There are few types of triggers that you could create and use for your application, such as after update or before delete. However there one type which has triggered more often than other ones. This is what I am talking about - workflow rules. In this article, I will show how to work with them using examples.

First things first! You need to know that these two terms "process" and "instance" have something common between themselves. A process represents an activity while an instance stands for each particular activity within the same process. For example if you want to add new task into Tasks list then it would be a process (addTask) and adding Task1, Task2 etc.. would be its instances. So now let's get started.

In order to understand better why do we need to involve those processes/activities let me give you some background information on how they actually help us out. The main idea behind creating any automation flow is to make sure that our users don't go through all the repetitive actions manually again and again. It should happen automatically without their intervention. That way they won't face too much problems.

Let's assume that you've got a simple sales team and every day they contact potential customers who might become future buyers of your product. To speed up the deal making process, you decide to introduce automated system where upon clicking button, user gets redirected directly to manager so he/she may start negotiations right away.

Of course you wouldn't like to lose control over data entered by your employees because not only this increases security risks but also makes it hard to monitor everything done. Therefore it is important to take care of both parties' interests. One way to do this is to allow employees to enter necessary info but prevent managers from altering anything until proper confirmation comes back. Also keep track of all changes made to database as well as customer record. If you're curious you may learn more about this topic here.

So far we discussed reasons why we'd like to include activities into processes. Now let's talk about actual implementation part. How exactly does it look like when we want to combine different objects together? This is usually achieved via visual layout called pageflow. Pageflowl basically consists of 3 parts - header area, body content and footer. Header contains general navigation bar like logo, menus etc., Body defines general layout of the whole screen and Footer section shows last updated date and current version number. All three areas interact with each other meaning that whenever you change something in header, body or footer, the corresponding action will occur somewhere else. Let's see how it works step-by-step.

To define flow visually we'll need to choose appropriate template for our case. We can find several readymade templates in Content Library. By default, you have access to five standard pagesflows: Account Overview, Contact Us, Employee List, New Order and Quote Request. Choose whichever suits best your needs. Afterward click on Settings icon located near top menu bar. Then navigate to Pages & Links tab followed by Templates subtab. Here you'll be able to customize existing flows according to your requirements. Make sure you check Enable Flow Designer option since it allows you to design your own layouts. Click Publish once you've finished designing. Next thing you must do is to assign a unique ID label to newly created pageflow.

Now let's proceed to defining what kind of tasks we wish to accomplish. First off, let's consider sending email notification. What we need to do is just create form and insert code snippet provided by SFDC developer community. Once you've added code, save changes and activate the pageflow. From now on, whenever someone opens specific link (for example /emailnotify), the message specified in form will appear instantly. But wait! There's still one problem left. When user clicks on Send Email button, nothing happens. Why is that? Well, this issue arises due to fact that we haven't yet defined what kind of event shall fire up when Submit button is clicked. Henceforth, we need to specify conditions under which certain events shall happen. There are three possible ways to achieve this goal: 1. Create dynamic Action Groups 2. Use Workflow Rules 3. Add Triggers 4. Define Conditions 5. Set Up Actions 6. Specify Trigger Events 7. Test Your Application 8. Deploy Changes 9. Monitor Results As mentioned previously, trigger events differ from normal methods used to execute actions and therefore require special attention. Firstly, let's discuss about dynamic action groups. These are essentially sets of predefined actions which are executed depending on input parameters given by users. They are useful mainly for situations when you want to perform similar actions multiple times. Secondly, lets talk about workflow rules. Basically they represent conditions which determine whether certain action(s) should be performed. Thirdly, let's move onto triggers. Although they sound pretty familiar, it doesn't hurt to briefly describe them as well. Finally, we'll conclude discussing conditional logic. This means setting up true-false statements which determines whether particular action should be carried out.

Next thing we'll try to figure out is how to integrate all elements described above. Since we already have pageflow setup, we simply need to select desired template from available options and drag it into design canvas. Do remember that you cannot modify preloaded items unless you have enabled customization option. Then head over to Script editor window. Open it and paste following script inside. Don't forget to replace PAGE_URL with your pageflow's unique id.

This script displays welcome message to whoever visits your website. It uses JavaScript function alert() to display message. Furthermore, we used parameter named msgId to pass extra piece of information along with greeting. Notice that variable name is msgID rather than MSG. This difference signifies that latter is intended to act as key whereas former serves merely decorative purpose. Now open browser console. Type document.getElementById("msg").innerHTML = 'Welcome!' and hit Enter. Congratulations! You've just learned how easy it is to build custom applications based on web services offered by SFDC platform.

However, you may ask yourself one question. Can we write trigger on process instance? Yes, we certainly can. Take a closer look at screenshot below. You'll notice that there is no red cross next to itemName field. Instead, it says Disabled. This is because disabled functionality is associated with most complex cases and requires additional effort to implement. On the contrary, enabling such feature takes mere seconds. Just follow these simple instructions: 1. Go to Setup Menu 2. Navigate to Customize Tab 3. Activate Checkbox labeled Show Activity History 4. Save Changes 5. Repeat Steps 1-4 for Item Name field. Please note that disabling individual fields is optional. You may leave it intact if you prefer to maintain old behavior. Anyway, feel free to play around with it as long as you didn't disable entire page flow.

On the final note, please bear in mind that although we managed to do quite a lot today, automating tasks related to your daily job shouldn't stop there. Keep learning more about various tools offered by SFDC development center and discover how to apply them properly.

Salesforce has made it easy for you to create and execute your processes with its latest release, Winter '19. With this update, users can now leverage their data from any location they want. They have also introduced new features like Workflow-Based Application (WBA) Builder that allows developers to build custom workflows. There are many other functionalities as well which will make sure your workflow runs smoothly on different platforms. One such functionality is the ability to add approvals or conditional logic to your flow so that multiple people don't need to approve every task separately. This article explains what an approval process instance is.

What is process instance?

An approval process instance is defined by attributes including name, status, start date/time, end date/time etc., The attribute "name" uniquely identifies each type of process. In addition to identifying the specific process, the name should be meaningful for both technical and non-technical audiences. For example, if the process involves creating some accounts then naming them as “Create Accounts” would make more sense than just using random names like “"Account". Another important thing about process instances is that they must not change during execution. When a user executes a particular process, he expects that there won't be any changes to the existing parameters.

The following diagram illustrates how an approval process works:

What is process instance in BPM?

A Business Process Modeling Notation (BPMN), developed by OASIS International Organization for Standardization, defines the general concepts and rules required to model business activities through visual modeling tools. It provides a standard way to describe business processes visually. A process instance represents a single activity within a business process. It consists of all related tasks and events of the process. To illustrate this concept let's consider our previous example where we had created two separate flows, one for filling out forms and another one for approving those forms. Now imagine that these two flows were combined into one flow. Each flow could consist of several steps that may include form submission, review, approval, assignee notification etc. The first step within each flow is called entry point because it starts the whole process. So when we combine all these individual steps into a single flow, we get something similar to this below image.

Each block here represents a unique step within a process. You might notice that each event or task inside blocks does not necessarily represent a complete action. Instead, it indicates the next logical step after completing the current one. If you look at the above figure carefully, you'll see that the green circle represents the completion of the task before moving onto the next step. Every time a record moves between states, it triggers an event. These events trigger actions. And once an action completes, it automatically resets the state back to normal. That means whenever a task finishes executing successfully, it gets reset to normal again without having to do anything manually. Also, remember that even though we've got four people involved in the entire process, only three nodes are shown since each person doesn't play a role twice.

What is process instance node Salesforce?

In order to understand better about how the approval process works in Salesforce, let's take a closer look at the nodes used therein. As mentioned earlier, one of the most common use cases of the approval process is to control access to records. But there might come times when you'd want to allow certain users to edit the same record while restricting others from doing so. Or maybe you're building a system that requires someone to pass through several levels of permission to enter information. This kind of scenario becomes easier to handle if you introduce approval process. Let me explain further. Imagine that you are developing a software application that manages medical prescriptions. Your goal is to ensure that doctors submit accurate prescription details but patients shouldn't be able to modify them. Therefore, you decide to implement an approval process for the latter group. Once the patient enters his contact number, the system checks whether he satisfies the conditions under which he needs to fill the prescription. Only if everything goes right, it sends him the prescription. Otherwise, he gets notified that his request was denied due to insufficient funds. Since you already know who needs to sign off on the prescription, you simply configure an approval rule based on their identity. Here's how that looks in the UI:

As you can see in the screenshot above, you have added condition fields that check against values entered by the user. Once you click save, the page refreshes itself with the updated settings. Similarly, you can add additional criteria too. All you need to do next is enable the approval option on the object's detail screen. Don't forget to specify the ruleset you wish to apply. Users can choose any value in the field provided and proceed to the next step depending upon the results.

Camunda vs. Salesforce

Now that you have understood how the approval process works in Salesforce, I'm going to tell you about my experience working with Camunda. First things first! Both of these systems offer great flexibility and support complex scenarios well. However, if you intend to migrate from one platform to another, keep in mind that migrating from Camunda to Salesforce isn't exactly straightforward. While transitioning from Camunda to Salesforce, you'll find yourself stuck behind numerous errors. Some notable differences you'll encounter are listed below:

1.) Visual representation: Camunda uses icons whereas Salesforce follows semantic markup standards. Thus, it offers greater visibility regarding how content is structured. On the contrary, Salesforce employs tables for rendering objects.

2.) Data sources supported: Camunda supports REST API, database, and file uploads. On the other hand, Salesforce leverages metadata files generated by third-party applications to pull data from various locations. Moreover, it utilizes databases like SQL Server, DB2, MySQL, Oracle, Microsoft Access, among others.

3.) Security controls: Camunda relies entirely on declarative security models whereas Salesforce implements procedural security policies.

4.) Dashboards: Although both platforms offer dashboard views, Camunda comes equipped with templates that contain predefined dashboarding styles. By contrast, Salesforce makes users customize the appearance according to requirements.

5.) Task list management: Though both systems provide task lists, Camunda lets you manage them via Kanban boards. Whereas, Salesforce keeps track of completed tasks using Gantt charts.

6.) User interface: Since Camuna integrates directly with Git version control, you aren't restricted to choosing a prebuilt template. However, you still have to design your own layout. Conversely, Salesforce gives you the freedom to customize the frontend design as per your preferences.

7.) Integration with external apps: Camunda enables integration with over 300+ services. Likewise, Salesforce facilitates native integrations with hundreds of apps.

8.) Reporting capabilities: Camunda allows you to export reports on demand. On the other hand, salesforce generates ad hoc reports based on metrics selected by users.

9.) Deployment options: Both systems utilize cloud deployment technologies like AWS Fargate and AppSync. But unlike Camuna, deploying Salesforce is relatively simple.

10.) Pricing plans: Unlike Camuna, Salesforce doesn't charge extra fees for adding extensions or modules.

11.) Third-party connectors: Camunda offers built-in connector libraries that help integrate it seamlessly with popular open source projects. Meanwhile, Salesforce lets you connect it with thousands of third-party products.

12.) Metadata modelling: Although both platforms follow the same syntax, Camunda applies strict validation rules while parsing code.

13.) Version control: Like Camuna, Salesforce allows users to track updates via Git. However, the tool doesn't require installing special plugins.

14.) Customizable Widget Storefront: Camunda offers widgets that facilitate interaction between customers and businesses. But if you prefer to skip this feature, you can disable it from the admin console.

15.) Community edition: Despite being free of cost, Camunda limits you to 5 active users unless you pay for premium packages. Similarly, Salesforce imposes limitations on free users as well.

16.) Automated testing: Although both platforms employ automated testing practices, Camuna doesn't run tests continuously. On the other hand, Salesforce constantly monitors test coverage.

17.) Cloud hosting: Camuna stores data locally on servers whereas Salesforce takes care of storage facilities.

18.) Multi factor authentication: Besides storing sensitive credentials in cookies, Camuna encrypts login sessions. By contrast, Salesforce authenticates users using multi factor authorization techniques like passwords, tokens, and biometrics.

Final thoughts

Although both Camuna and Salesforce are capable of handling critical enterprise functions, they differ significantly in terms of architecture, pricing, and performance. Depending on your project requirements, you may feel compelled to pick either one of them. After evaluating pros and cons of both solutions, I came across a few factors that helped me weigh them fairly:

1.) Support: Given that both companies have been around for years, customer service availability plays a major part in determining who wins. Based on my research, I found that Camuna has superior community support compared to Salesforce.

2.) Cost comparison: If you plan to deploy a solution beyond experimentation level, you need to calculate associated costs beforehand. According to my analysis, Salesforce charges higher upfront license fees than Camuna.


Author

Anyleads

San Francisco

We are the leading marketing automation platform serving more than 100,000 businesses daily. We operate in 3 countries, based in San Francisco, New York, Paris & London.

Join Anyleads to generate leads

Error! Impossible to register please verify the fields or the account already exists.. Error, domain not allowed. Error, use a business email. Welcome to the Anyleads experience!
More than +200 features to generate leads
Register to start generating leads

Create your account and start your 7 day free trial!

Error! Impossible to register please verify the fields or the account already exists.. Error, domain not allowed. Error, use a business email. Welcome to the Anyleads experience! By registering you agree to the Terms and conditions agreement.
More than +200 features to generate leads

We offer multiple products for your lead generation, discover them below!

>> Unlimited access to all products with one single licensecheck our pricing.