Originally asked by Chris Lund on 06 October 2021 (original question)
When we try to sync the assigned to user the work item in DevOps is not correctly setting the user. In the incoming script for DevOps we have a line setting the work item assigned user by using the nodehelper getuserbyfullname function but it did not set the user and there were no errors showing or preventing the sync so we are not sure why it didn’t get set or what issue may have caused it not to get set.
Comments:
Ariel Aguilar commented on 22 October 2021
Hi Chris,
Please provide the Outgoing and Incoming script used for the lines to sync users. Also, it would be helpful to see the payload by using “Entity sync Status” > Show remote replica from Azure side.
Kind regards,
Ariel
Chris Lund commented on 22 October 2021
Azure side Outgoing Script:
replica.assigned_to = workItem.assignee
Azure side Incoming Script all the different variations we’ve tried:
workItem.assignee = nodeHelper.getUserByFullName(replica.assigned_to.display_value)
workItem.assignee = nodeHelper.getUserByEmail(replica.assigned_to_email)
workItem.assignee = nodeHelper.getUserByUsername(replica.assigned_to_email)
workItem.assignee = userHelper.getByEmail(replica.assigned_to_email)
workItem.assignee = replica.assigned_to_email
debug.error("User is: " + nodeHelper.getUserByUsername(replica.assigned_to_email))
ServiceNow side Outgoing Script:
replica.assigned_to = entity.assigned_to
replica.assigned_to_email = nodeHelper.getTableByLink(entity.assigned_to?.link)?.email
ServiceNow side Incoming Script:
entity.assigned_to = replica.assigned_to.email
The ServiceNow incoming is working correctly now for us, but the Azure side still isn’t. I listed every line we’ve tried above. We got an error on the userHelper call which said it didn’t exist, while the nodeHelper keeps coming back as null. I know that because we did try using the debug function for each line and each time is said user is null. We already added the users to the project in DevOps that we are trying to assign to, so that shouldn’t be the issue either. Below is the remote payload from the Azure side, let me know if you need anything else from me.
{
"version": {
"major": 1,
"minor": 14,
"patch": 0
},
"hubIssue": {
"number": "INC0045799",
"urgency": "3 - Low",
"impact": "3 - Low",
"assigned_to_email": "ChrisLu@mckinstry.com",
"resolution_notes": "",
"work_notes": "",
"requestor": {
"display_value": "Terry Ashley",
},
"assigned_to": {
"display_value": "Chris Lund",
},
"components": [],
"attachments": [],
"voters": [],
"customFields": {},
"description": "test test test
",
"watchers": [],
"fixVersions": [],
"key": "0c6bbaee1b97709081a5fee8cd4bcb21",
"summary": "test 10.22.21",
"comments": [],
"internalMap": {
"number": "INC0045799",
"urgency": "3 - Low",
"impact": "3 - Low",
"assigned_to_email": "ChrisLu@mckinstry.com",
"resolution_notes": "",
"work_notes": "",
"requestor": {
"display_value": "Terry Ashley",
},
"assigned_to": {
"display_value": "Chris Lund",
}
},
"priority": {
"name": "4 - Low",
"description": ""
},
"labels": [],
"customKeys": {},
"workLogs": [],
"affectedVersions": [],
"entityProperties": {},
"status": {
"name": "Active"
}
},
}
Chris Lund commented on 23 October 2021
Ariel Aguilar not sure if you got a notification from my last comment, just making sure you see it