Modifying inbound DevOps work notes in Agile integration

Brad Warman
Giga Sage

Hi everyone. Hoping someone can point me in the right direction. I've configured a ServiceNow Agile <-> Azure DevOps integration using the ServiceNow plugin. Everything is working well but the customer has asked if they can change the 'user' who's name appears in ServiceNow when a work note is added from DevOps (this is always system). The only way I know how to do this is have the script that performs the action impersonate a service account at the time of adding the work notes so it appears as that service account rather than system. I don't like the idea of attempting that as it opens up possibilities for errors (account locked out, password changes etc) so I am thinking of just prefixing the inbound work notes with some text like 'Synced from Azure DevOps'.

 

My question is, does anyone know how the work notes are updated by the inbound payload from DevOps? I've checked script include records, business rules, transform maps, flows etc but cannot find how the payload is coming in or where it is being processed.

1 ACCEPTED SOLUTION

Brad Warman
Giga Sage

For anyone that finds themselves with the same requirement, I was able to identify where the inbound work notes are being processed with the assistance of ServiceNow Support. The script include called ADOWebhookEventProcessorUtil has a function called processWorkItemPayload.

 
Adding the following code to line 162 (after the last else if and before the else for the if statement that starts on line 119) enabled me to prepend some text to the work note. 
else if (snowColumn == "work_notes") {
     var prependedText = 'Synced from Azure DevOps: \n\n';
     workItemObj[snowColumn] = prependedText + fieldValue;
}

 

View solution in original post

1 REPLY 1

Brad Warman
Giga Sage

For anyone that finds themselves with the same requirement, I was able to identify where the inbound work notes are being processed with the assistance of ServiceNow Support. The script include called ADOWebhookEventProcessorUtil has a function called processWorkItemPayload.

 
Adding the following code to line 162 (after the last else if and before the else for the if statement that starts on line 119) enabled me to prepend some text to the work note. 
else if (snowColumn == "work_notes") {
     var prependedText = 'Synced from Azure DevOps: \n\n';
     workItemObj[snowColumn] = prependedText + fieldValue;
}