@@ -333,13 +333,15 @@ const TechniqueProposalTable = ({ confirm }: { confirm: WithConfirmType }) => {
333333
334334 const updateProposalStatus = async (
335335 proposalPk : number ,
336- workflowStatusId : number
336+ workflowStatusId : number ,
337+ statusActionsWorkflowConnectionId ?: number
337338 ) : Promise < void > => {
338339 await api ( {
339340 toastSuccessMessage : 'Proposal status updated successfully!' ,
340341 } ) . changeTechniqueProposalsStatus ( {
341342 workflowStatusId : workflowStatusId ,
342343 proposalPks : [ proposalPk ] ,
344+ statusActionsWorkflowConnectionId,
343345 } ) ;
344346
345347 refreshTableData ( ) ;
@@ -619,10 +621,33 @@ const TechniqueProposalTable = ({ confirm }: { confirm: WithConfirmType }) => {
619621 'Selected workflow status not found'
620622 ) ;
621623 }
622- updateProposalStatus (
623- rowData . primaryKey ,
624- selectedWorkflowStatus . workflowStatusId
625- ) ;
624+
625+ return api ( )
626+ . getWorkflow ( {
627+ workflowId : rowData . workflowId ,
628+ entityType : WorkflowType . PROPOSAL ,
629+ } )
630+ . then ( ( { workflow } ) => {
631+ const connectionsWithActions =
632+ workflow ?. connections . filter (
633+ ( conn ) =>
634+ conn . nextWorkflowStatusId ===
635+ selectedWorkflowStatus . workflowStatusId &&
636+ conn . statusActions &&
637+ conn . statusActions . length > 0
638+ ) || [ ] ;
639+
640+ const statusActionsWorkflowConnectionId =
641+ connectionsWithActions . length === 1
642+ ? connectionsWithActions [ 0 ] . id
643+ : undefined ;
644+
645+ updateProposalStatus (
646+ rowData . primaryKey ,
647+ selectedWorkflowStatus . workflowStatusId ,
648+ statusActionsWorkflowConnectionId
649+ ) ;
650+ } ) ;
626651 } ) ;
627652 } ,
628653 {
0 commit comments