How to sync the 'requested_for' field from catalog task into 'reporter' field in Jira

Hi,

We have a bi-directional synchronization and one portion of it is the mapping of requested_for in ServiceNow, to Reporter in Jira.

The outgoing script is

    if (entity.tableName == "sc_task") {
        replica.caller_id = nodeHelper.getTableByLink(sc_task.requested_for?.link)?.email
    }

and the incoming script:

issue.reporter = nodeHelper.getUserByEmail(replica.caller_id)

Note that I’ve also tried the following outgoing scripts:

    if (entity.tableName == "sc_task") {
            replica.caller_id = nodeHelper.getTableByLink(entity.requested_for?.link)?.email
        }

    if (entity.tableName == "sc_task") {
            replica.caller_id = nodeHelper.getTableByLink(catalogTask.requested_for?.link)?.email
        }

    if (entity.tableName == "sc_task") {
    replica.customKeys.reporter_email = nodeHelper.getTableByLink(catalogTask.requested_for?.link)?.email
    }

But the Reporter field in Jira still fails to be updated, and defaults to the ‘Exalate’ user. Any suggestions?

Hi,

The requested_for field is a bit complicated as it ties into the REQ-REQ_ITEM-SC_TASK hierarchy. I tried to traverse the hierarchy and get to the field here:

def req_for_link = nodeHelper.getTableByLink(sc_task.request_item.link)?.requested_for?.link
def req_for = nodeHelper.getTableByLink(req_for_link)?.name
replica.requested_for = req_for

This does work for me, but only when a main field is updated on the sc-task itself.

Please give it a shot and let me know in case of any issues.

Thanks
Majid