Error Message :
U0020408 U0020766 MODIFY_TASK with opcode ' ' not possible for task ' ' (Lnr ' '). The task has not been added with ADD_TASK or the changes have already been activated.
When using script functions to add the same Task multiple times using the MODIFY_TASK and ADD_TASK functions, it fails to add the task with a return code of 20766 as shown above. If you run the script again the Task is added.
If there is more than one task with the same name within a Workflow, a MODIFY_TASK command has to be used with an LNR, which is returned by ADD_TASK.
In this case, instead of just using the Task Names you must to use the Task Number as well to avoid the error.
Following is an exampe of a working MODIFY_TASK which adds with ADD_TASK multiple times using the same Task but with different Names (ALIAS):
:SET &RET# = MODIFY_TASK(&RUNID#, STOP_MODIFY)
:SET &LNR# = MODIFY_TASK(&RUNID#, "&V_BACKUP_RESTORE#",,ADD_TASK)
:SET &RET# = MODIFY_TASK(&RUNID#, "&V_BACKUP_RESTORE#",&LNR#, MOVE_TASK, "&COLUMN#", "&ROW#")
:SET &RET# = MODIFY_TASK(&RUNID#, "&V_BACKUP_RESTORE#",&LNR#,ALIAS,"&ALIAS#")
:SET &RETCOMMIT# = MODIFY_TASK(&RUNID#, COMMIT)