1
0
-1

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.

  1. Ariel Aguilar

    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

  2. Chris Lund

    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": "<p>test test test</p>",
        "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"
        }
      },
    }
  3. Chris Lund

    Ariel Aguilar not sure if you got a notification from my last comment, just making sure you see it

CommentAdd your comment...

2 answers

  1.  
    1
    0
    -1

    We had a short call to review the problem and we fixed by receiving the value on Azure's end with:

    workItem.assignee = nodeHelper.getUserByFullName(replica.assigned_to.display_value)

    Great job everyone!


      CommentAdd your comment...
    1.  
      1
      0
      -1

      > while the nodeHelper keeps coming back as null.  

      Is the user you are looking for a team member of the project the workitem belongs in.

      1. Francis Martens (Exalate)

        Can you try with a fixed - correct - value which must work?

      2. Chris Lund

        Yes, all the users we've tried to set as the assigned to are members of the project.  What's a fixed value that I can use, can you provide an example?

      CommentAdd your comment...