![]() ![]() bug('Successfully locked opportunity with ID: ' + lr.getId()) įor(Database.Error err : lr. Operation was successful, so get the ID of the record that was processed Controllers also provide access to the data that should be displayed in a page, and can modify component behavior. Opportunity opty = Īpproval.LockResult lrList = Approval.lock(opty, false) A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in associated Visualforce markup, such as when a user clicks a button or link. Then, select Enable record locking and unlocking in Apex. After enabling development mode, all Visualforce pages display with the development mode footer at the bottom of the browser: Click the tab with the name of the page to open the page editor to view and edit the associated Visualforce markup without having to return to the Setup area. Admin need to enable this feature, from Setup | Create | Workflow & Approvals | Process Automation Settings. .Net Apex Apex Class Apex Trigger API Approval Process Attachment Batch Apex Batch Class C DataTable Date Formula Field Javascript Json Lightning Lightning Component Lightning Data Service Lightning Framework Lightning Out Lightning Web Component List LWC MS SQL Server Object Pagination Picklist Process Builder Profile Quick Action. Since Winter '16, Salesforce introduce lock() and unlock() methods in the System.Approval namespace. User will get error when save opportunity has been marked as Closed Won previously. But, often this solution will not work well, because the original record owner changed and it is important for reporting, although you can create custom user field to store it.īy using function PRIORVALUE() and ISCHANGED() to detect any changes happened in Closed Won record. This will work well when the OWD sharing setting is Public Read-Only. This will work by change the record owner to a system user in highest role hierarchy. In short, when the opportunity reach Closed Won, with Workflow, change the record type to new record type and assign the new record type with page layout with read-only fields. This would be one of the most famous solution without code, but this will make the system more difficult to maintain as the object will have additional record type set and additional page layouts. Options: there are multiple solutions for this, from simple to advance with code: Below is a short video illustrating how to create a simple grid. ![]() Use case: make opportunity become read-only when opportunity reach stage Closed Won. Visualforce pages are needed to deploy grids for end users, either as top-level pages. For example, to edit the Account from the Contact page, add the custom button or link in Contact: URLFOR() determines your base URL, and the $Action determines what view of a record to go to (the view page, edit page, etc.). Some objects support other additional actions, see all valid actions here. The $Action global variable provides methods such as View, Clone, Edit, and Delete. jar file) in a static resource, URLFOR() is a must as a second parameter.Īdmin can make use of URLFOR() function with $Action global variable in custom Button or Link. But when you use the resource in an archive file (such as a. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |