Status update back to Source using custom business logic
search cancel

Status update back to Source using custom business logic

book

Article ID: 273255

calendar_today

Updated On:

Products

ConnectALL

Issue/Introduction

For automation between 2 JIRA instances, In JIRA instance 1 we have the Status field which is mapped to a custom field named Custom Status in JIRA instance 2.
Jira1(Status) <> Jira2(Custom Status)
We are seeing this issue when a bug is created in instance 2, Since it is a custom field(Custom Status), it is not set with any value at the time of Bug creation. When the automation is triggered, it creates a bug in JIRA instance 1 and copies over the URL of the ticket back to JIRA instance 2.
But it is not getting the Status value back to JIRA instance 2 to Custom Status field and it stays null till a status change happens on the JIRA instance 1. 

Environment

Release : 2.11.2.x

Resolution

Below Business Script can take care of this use case.
The steps outlined in the Article can be followed to set up the Business logic for this use case. Below is the groovy script that can help you achieve this.

Execution Type = POST_MAPVALUE

 

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import com.go2group.connectall.config.model.bean.*;

println "Applying Custom Business Rules Name"

def status = message.payload.getSingleValueField("customfield_10182");
if(status = null)
{
        status = 'Open' ;
        message.payload.setSingleValueField("customfield_10182", status);
        return message.payload
    }
}
return message.payload