We are attempting to align a custom timestamp field from Jira to ServiceNow. Previously, we successfully synchronized this for the problem module. Now, we wish to replicate this with Request Items in ServiceNow. The Jira field in question is the custom ‘event timestamp’ field. Below is the code we are currently using:
if(item.customFields.eventTimestamp && item.customFields.eventTimestamp.value) {
// Capture the timestamps
def timeData = item.customFields.'eventTimestamp'.value;
// Convert timestamp to date
def convertDate = new Date(timeData.time);
// Specify the date format
SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
requestItem.custom_event_timestamp = formatter.format(convertDate);
}
Despite executing the sync without any errors, the field remains unchanged.
You might wanna check timezone settings too. sometimes mismatched timezones can cause the fields to not update as expected. Try adding some logs to see what value you’re getting for eventTimestamp and debug from there. also double-check field mapping between jira and ServiceNow.
It may be useful to verify the permissions associated with the Request Items in ServiceNow. Sometimes, restricted field permissions can prevent updates even if the script and the mapping are correct. Check if the user running the sync has the necessary permissions to modify the custom ‘event timestamp’ field. Additionally, ensure that there aren’t any background scheduling or sync issues in ServiceNow that might be overriding the values soon after they’re updated.
When working with integrations between systems like Jira and ServiceNow, sometimes the issue isn’t in the script itself but in the data being pulled from Jira. Double-check to ensure the event timestamp field from Jira is actually populated with the expected data and doesn’t return null or unexpected values at times. It’s also worth verifying whether any caching or data update policies in ServiceNow could delay visibility of changes. Do a manual check to see if the data you’re trying to sync is accurately defined in Jira.
Maybe consider logging the converted date before updating ServiceNow to verify its the correct value. Also, sometimes, scripts coud be blocked by ServiceNow’s business rules or scripts. disabling any conflicting ones just to test migt reveal if they’re interferring.