scenario
Once the Approver rejects the transaction (Purchase Order) the record is opened in an edit mode and enters the reason.
Solution
Go to customization> Workflows> Workflow> New
Record Type: Transaction
Sub Type: Purchase Order
Event Defenition: On Create and On View or Update
Trigger Type: All
Click on New Field and create a new custom field To store the document number of the Purchase order (For the purpose of the record opening in edit mode while using Go to Record Action)
On the workflow field add the label ‘Document Number’
Type: List/Record
List/Record: Transaction
Store Value: Check on the box
Sourcing and filtering:
Filter Using: PO/check#
Compare Type: Equal
Is not empty: Yes
State 1
New Action> Add Button: Approve
Trigger on: Before Record Load
New Action> Add Button: Reject
Trigger on: Before Record Load
Transaction State 1 to State 2
Execute On Button: Approve
State 2-Approved
New Action> Set Field Value
Approval Status: Approved
Transaction State 1 to State 3
Execute on Button: Reject
State 3 Rejection Reason
New Action> Go to Record
Trigger on: Entry
Record Type: Purchase Order
Check the box Open in edit mode
Select the field: Document Number (Workflow custom field)
Save
New Action> Set Field Mandatory
Trigger on: Before Record Load
Field: Rejection Reason
Check on the field Mandatory
Transition State 3 to State 1
Transition on Before Record Submit
Condition: Reject Reason is not Empty
Event: Edit
Transition State 3 to State 1
Transition on Before Record Load
Event: View
Transition State 3 to State 4
Transition on After Record Submit
Condition Rejection Reason is Not empty
State 4 Rejected
New Action > Set Field Value
Approval Status: Rejected
Now once the approver clicks on the reject button the record opens in edit mode and the approver needs to enter the rejection reason in the field “Rejection Reason”