English
flow.approval.detail.approval.opinions.render.before
About 346 wordsAbout 1 min
2025-11-24
flow.approval.detail.approval.opinions.render.before
Note: This hook is triggered before the approval opinion content is rendered.
Feature Description
This method can be used to customize the display content of the approval opinion area.
Parameters
| Parameter | Description | Type |
|---|---|---|
| options | controlArg contains the approval opinion area data; tasks stores the approval opinions of all current approval nodes | Object |

Return Value
| Parameter | Description | Type | Allowed Values | Default |
|---|---|---|---|---|
| instance | Modified controlArg | Object | — | — |
Effect of modifying approval opinions 
Effect of deleting approval opinions 
Parameter Code Example
See the full code example below.
Code Example
event: "flow.approval.detail.approval.opinions.render.before",
functional: async function (context, options) {
// Approval instance information
let instance = options && options.controlArg;
// All approval nodes
let tasks = instance && instance.tasks;
if(tasks){
tasks.forEach(task=>{
// Set node status label text
task.stateLabel = 'Passed?';
// Set node status label color
task.stateLabelColor = '#e23451';
// Get opinions from the task node. Not all nodes have approval opinions (type==start means start node, which has no opinion)
let opinions = task&&task.opinions;
if(opinions){
opinions.forEach(op=>{
// Set approval opinion status label text
op.stateLabel = 'Assisted';
// Set approval opinion status label color
op.stateLabelColor = '#e23451';
// Whether to use custom approval opinion. When true, approval opinions will no longer be fetched
op.useCustomOpinion = true;
// Change the opinion to: 'Modified by plugin'
op.opinion='Modified by plugin';
// Set the opinion to non-repliable
// op.canReply=false;
})
}
// Set the node to non-repliable
task.canReply=false;
});
}
return Promise.resolve({
instance,
});
}Notes
Notes:
1. `task.stateLabel` modifies the node status label text
2. `task.stateLabelColor` modifies the node status label color
3. `opinion.stateLabel` modifies the approval opinion status label text
4. `opinion.stateLabelColor` modifies the approval opinion status label color
5. `opinion.useCustomOpinion` controls whether to use a custom approval opinion. After using a custom approval opinion, attachments, images, etc. will no longer be rendered
6. Start nodes and end nodes do not support customization
