Skip to main content

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 internal duties as SOP reference.

Below is the preview of EFFECTIVE document in DMS application which is in LOCKED state . 




From the above document screenshot , we can see the document is EFFECTIVE and we do not have edit icon made available to make further edit to the EFFECTIVE document. To perform edit operation on the record we need to click the CHECKOUT icon which will bring the document back to draft or working version.


Performing CHECKOUT action to re edit the document would have following disadvantages:

a)    Checkout the document and bring the document to working state

b)    The DMS admin should make the necessary changes and reupload the correct version of the document

c)     Ask the reviewers to review the changes and complete review cycle . Admin has to submit the record to approval cycle . 

d)    Ask approvers to approver the document and complete approval cycle . 

e)    Wait for X number of days before document become EFFECTIVE based on X value set in Document Auto Effective (days) field


f)     Alternatively, DMS admin can make the document EFFECTIVE manually by clicking Make Effective.


Developer console : 

We have developer console tool given by salesforce where we can view the record using SOQL ( Salesforce Object Query Language ) and make changes directly via this tool . With this handy tool one can make changes to the record with safety.  If we try to make changes to locked EFFECTIVE document via developer console we will be presented with DOCUMENT LOCKED error .

Lets try to make changes to the document name via developer console and see the error . I will fetch the document with following SOQL :

SELECT Id, Name FROM SPARTADMS__Corporate_Document__c where ID='xx'; 

Where XX is the document ID in the URL .


Lets make direct changes inside developer console and see the error:



As you can see when I tried to make changes to the locked EFFECTIVE document name inside developer console from ‘Override EFFECTIVE document’ TO ‘Override EFFECTIVE document - manual edit via developer console’ . I have been presented with error . 

[object Object] Document is locked .

The system presented the error ‘ Document is locked ‘ which is known behavior of the system . There is a backend trigger on the EFFECTIVE document which will stop you from making changes directly via developer console . The same holds true if you try to do it via Postman tool via API or workbench console . The system will not allow you to make changes in backend .

THE SOLUTION 

I have designed a workable solution where DMS admin can make changes to EFFECTIVE document without CHECKING out the document which really saves a lot amount of time from amending the document and later making the document EFFECTIVE and make it available for use to stakeholders in short time.

The only solution I did see is via Apex class Invocable method which is called via flows . The apex class will stop the trigger execution responsible for holding lock on EFFECTIVE document via apex class and make changes to the document with inputs received from screen flow element.

The solution to the problem involves:

a)    Design a screen flow which will accept input parameters like Document Name , Document Type , Document Status etc which needs to be amended in the EFFECTIVE document

b)    Call Apex INVOCABLE action class to do changes via Apex code .  

c)    Create a new lightning app record page and place the flow component on to the page

d)    Run the flow component either via record page or via Quick Action.


The FLow :





Designing the Screens flow:


Variables

Create a resource variable named: recordid ( it should be as mentioned , no other variation)  .






Screen Flow input Element

Place the corporate document field : Document Name on the screens flow as shown in below snip. Drag the field from ‘ Fields (beta) section  . For demonstration purpose we will only use one field 'Document Name'. We can add as many fields in the screen flow element which needs to be updated on the locked EFFECTIVE document .  


Apex Action Element .

Below is the snip of apex element from where we will be calling apex class which is of type Invocable Method.

More about Apex invocable. Please read salesforce developer blog .


Apex Class with Invocable Action :

Below is the Apex Class with logic :

public class CorporateDocumentFlow

{

@InvocableMethod(label='Update DMS Record' description='Adhoc update DMS record fields ' )

    public static void updateDMSRecords(List<SPARTADMS__Corporate_Document__c> cdId)

    {      

      // logic hidden due to security purpose .

    }   

}

VIDEO DEMONSTRATION

Quick video in action , which shows by using screen flow we are able to make changes to the LOCKED EFFECTIVE document from ‘ Override EFFECTIVE document ‘ to ‘ Manual Edit Success ‘ .

Again from  Manual Edit Success to  Manual Edit Success+1

Again from  Manual Edit Success+1 to  Manual Edit Success+2 .



How about the Audit Trail .? 

As per compliance and auditing requirement, the sparta utility class will track all document changes in the audit trail history . Attached is the screenshot of the document Audit trail history after the flow has made changes to the document which was in EFFECTIVE locked state . 

 


Comments

Popular posts from this blog

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...