How to Sync Parent-Child Tasks in Asana

    How to Sync Parent-Child Tasks in Asana

    This article describes how to synchronize parent-child task relationships (subtasks) between Asana and other systems.

    Parent-Child Tasks: Asana supports subtasks linked to parent tasks. The parent task GID is stored in the parent_task_gid custom field.

    Outgoing sync (Asana → Remote system)

    To send parent-child relationship information from Asana:

    replica.customFields.parent_task_gid = entity.customFields.parent_task_gid

    Incoming sync (Remote system → Asana)

    To receive parent-child relationship and establish hierarchy in Asana:

    if(replica.parentId){
        def localParent = syncHelper.getLocalIssueKeyFromRemoteId(replica.parentId.toLong(), "issue")
        if(localParent){
            issue.parentId = localParent.id
        } else {
            throw new com.exalate.api.exception.IssueTrackerException(
                "Subtask cannot be created: parent issue with remote id " + 
                replica.parentId + " was not found"
            )
        }
    }
    Important: Parent tasks must be synchronized before child tasks. If a child task syncs before its parent exists, the synchronization will fail with an error.

    More information

    Have more questions? Ask the community