How can we handle the following approach using the ERPNext workflow file?

How can we handle the following approach using the ERPNext workflow file?

We have a form filled by the user where they select whether an advance is required (Yes/No). After submission, the request goes to the Administrator and COO for approval. At this stage, two fields — amount_to_be_paid and remarks — should be editable by the Administrator and COO.

  • If the request is rejected, the remarks field should be mandatory.
  • If the request is approved, the amount_to_be_paid field should be mandatory, and remarks should be optional.

These two fields should only be editable by the Administrator and COO during the approval process. After they are filled in, the values must be saved to the database and also be visible to the original requester in their view.