Skip to main content

Salesforce flow validation to check if a record has file attached in files related list

Flow is part of salesforce flows which collects data via user screens from business users inside your salesforce organization or we call as ORG hereafter . 

Salesforce flows comes in two flavors 

a) Screen flows 

b) Auto launched flows 

Screen flows are used in business scenario where data is collected from users screens. Auto-launched flows runs in background which are triggered or launched automatically based on certain system conditions . That is a bit of basis check  on flows . 


The article is written with a specific scenario to be discussed which is how we can validate and check if a record has file attached in files related list . We will be using low code salesforce automation mechanism called Flows in this scenario . 

Business Use case :

SFAGile is cloud based company which helps its customers to publish its application into salesforce cloud . Business users have a requirement where they need to validate salesforce records against training documents are attached to the case when record is created . We need to make sure salesforce record is not progressed to next state in the workflow without training forms attached by employees.

The requirement could be built using salesforce trigger which is programmatically driven approach or using low code mechanism like Salesforce flows .  

The final flow diagram post implementation of the logic :

flows final path

The getRecords Element :




Decision Elements :

Decision element if false : 



Decision element if True :



Update Records Element if Decision is False


Update Records Element if Decision is true


Here we have created a validation rule on field : hasAttachedFile__c . 

If hasAttachedFile__c is set to True it means file is attached to the record and record can progress to next state .

If hasAttachedFile__c is set to false it means file is NOT attached to the record and record cannot progress to next state .

Flow explanation : 


We need to have a record triggered flow ( after save) flow on the record. The relationship between a record and a file is kept in a contentdocumentlink object in salesforce. We need to right a logic to get if there are any content document link that is related to object that the end user is trying to save. If there are not any files attached to the record we can save the intermediate results to a field and then trigger a validation rule to stop record being progressed . 
 
Your get element should look like this: 

Object: Content Document Link

LinkedEntityId equals Record.Id

Later check if there are any content document link are available or not. Your decision outcome should be configured as :: 

getcontentdocumentlink is null true

If the outcome results is null, you need to connect the output of decision outcome to an update element so we can trigger validation rule .

Comments

Popular posts from this blog

TrackWise Digital - DMS Application - How to Override and make changes to locked EFFECTIVE Document using Flows and Invocable method.

Document management systems (DMS)   is one of the known solutions pharma organization use to manage their internal quality processes and store/ track all documentation related to quality. By using cloud-based product we have advantages over documents getting lost, outdated version rendered to stakeholders, irregular audit tracking like who made the changes and when. These qualities are necessary for good quality software as part of internal adulting process. The document are uploaded into the DMS system by DMS administrators. The document must go through a pre-defined workflow review process before it is made EFFECTIVE and made available for end users for training reference. The workflow lifecycle for DMS workflow approval cycle includes a) Draft, b) In Review, c)Under Approval and d) EFFECTIVE. Once the document is EFFECTIVE, the document is locked for further editing. The document is later used for internal training and can be printed and shared with internal users for performing...

TrackWise : E-Signature doesn't work

If you are on Trackwise Digital [TWD] Platform Summer 23 or highier and come across an error ' E-Signature doesn't work ' for username / password with OAuth connected app . Check the Login History of the user and confirm you see the error ' Username-Password Flow Disabled ' . If this happens then you need to enbale the ' OAuth Username-Password Flows ' which will be disabled by default for Summer 23 platform or highier . Steps to enable : 1. Setup ==> search ==> OAuth and OpenID Connect Settings 2. Enable - Allow OAuth Username-Password Flows Reference https://lnkd.in/giVuzGbs

Salesforce Rebate Management Tool – Streamline Your Rebate Process

Salesforce Rebate Management tool is a powerful tool for businesses to streamline their rebate process. It helps businesses to manage their rebate program more efficiently by automating the entire process. The tool helps businesses to provide rebates to their customers based on their purchases, which ultimately helps businesses to increase their sales and revenue. In this article, we will discuss the benefits of using Salesforce Rebate Management tool and how to set up benefit mapping. Benefits of using Salesforce Rebate Management Tool 1. Automate your rebate process – The tool automates the entire rebate process, from creating rebate offers to calculating payouts, which saves time and eliminates manual errors. 2. Increase customer loyalty – By offering rebates to your customers, you can increase their loyalty and encourage repeat purchases. 3. Improve sales performance – The tool helps businesses to increase their sales performance by incentivizing their sales team to sell more pro...

TrackWise Digital : ' The post install script failed ' Salesforce Error

A Document Management System (DMS) is Sparta TWD managed package application which is used to manage all corporate document with activities such as create, edit, upload, and manage the corporate documents. The application comes with pre-defined workflow process like review and approval process which could be used to make document effective before the document is made available to all the business users. The TrackWise Digital Platform application must be installed for DMS to work, and TWD platform application must be installed prior to installing DMS application. With Salesforce has three major releases per year, Sparta also releases 3 releases in a year with major enhancements and features. With such releases more and more features are made available to their customers without impacting business. With DMS packaging being upgraded thrice a year there could be possibility the administrator could face one of the known errors during DMS package upgrade in salesforce orgs which is:...

Salesforce Introduces ‘Hire Me’ Button to facilitate Hiring in Salesforce ecosystem.

Salesforce’s new Hire Me button will help simplify how Trailblazers hire and get hired in the Salesforce Ecosystem. Individuals will be able to indicate interest in new work opportunities on their Trailblazer.me Profile, while hiring managers will be able to simply click on the Hire Me button to message and connect with potential job candidates. It’s the quick, easy, and straightforward way to discover and connect with Salesforce experts. The introduction of the Hire Me button will empower Trailblazers to identify as job seekers and to connect with organizations that need their expertise, and to make it easier for hiring managers to connect with potential job candidates.” The initiative by Salesforce is to prepare 20,000 new Trailblazers for jobs in the Salesforce ecosystem by 2028. To begin with displaying a badge to get Hired by prospective employers who can see I'm available for work and directly message you about work opportunities , follow below steps . 1. Login to your trail...