Salesforce to ADO parent Link

Hello,

I was trying to add the parent link in ADO, but I’m not able to do so.

In the outgoing sync, I added:
###Replica.ParentId = '204031'###

Here, 204031 is the feature ID.

In the incoming sync, I’m adding it like this:

def parentRelation = [
    "rel": "System.LinkTypes.Hierarchy-Reverse",
    "url": "https://dev.azure.com/project/feature/_apis/wit/feature/204031"
]

workItem.relations = nodeHelper.mergeRelations(workItem, [parentRelation])

However, I’m still not able to map the parent ID after the item is created in ADO.

Any help would be appreciated.

Hi @Anil_Sanap,

You can try setting the parent directly in the incoming sync like this:

def parentId = "204031"
workItem.parentId = parentId

I’m not completely sure whether ADO will accept it as a string as is in your case, or whether it may need to be converted to a numeric value, but this is the simplest approach to test first.

If you do not want to use a static value (like 204031), you can also send the parent ID dynamically in the outgoing sync and resolve it in the incoming sync. For example, in the outgoing sync from Salesforce, send the parent entity ID:

replica.parentId = /* parent entity id that you want to sync */

Then in the incoming sync of ADO:

if (replica.parentId) {
   def localParent = syncHelper.getLocalIssueKeyFromRemoteId(replica.parentId.toLong())
   if (localParent) {
      workItem.parentId = localParent.id
   }
}

Documentation: Sync Work Items with Parent Links in Azure DevOps | Ex

1 Like

Hello @Javier
Thanks for this. I tried the approach you suggested, but I’m still not able to add the Parent Link to the created item. I followed the same steps you mentioned, but no luck so far—the Parent Link is not getting added. I also tried alternative methods, but I’m still unable to add the Parent Link to the item at all.

also Tried this way as well -
def localParent = syncHelper.getLocalIssueKeyFromRemoteId(replica.ParentId.toLong())

if (localParent) {

    def parentWI = nodeHelper.getWorkItem(localParent.id)

    workItem.areaPath = parentWI.areaPath

    workItem.parentId = parentWI.id

}

but still no luck but when i am trying to do it manually able to add the “Add an existing work item as a parent” in this under Related work.