How to do Multiple Tags sync with ConnectALL Flat File Adapter?
search cancel

How to do Multiple Tags sync with ConnectALL Flat File Adapter?

book

Article ID: 436798

calendar_today

Updated On:

Products

ConnectAll SaaS ConnectALL ConnectAll On-Prem

Issue/Introduction

We are using Flat Flat connector to bring over records from FogBugz to Rally. 
The CSV file has a column for tags, but if there are multiple they are separated by a semicolon in the field. 
 
Is there a way for the automation to recognize this and create seperate tags in Rally or does there need to be a row for each tag?

Environment

4.x

Cause

This use case requires special handling in order to process the tags as per need. This can be achieved via business script.

Resolution

Please use below Business Script to separate the tags before syncing to Rally. Execution type = PRE_MAPVALUES

/* ****************************************************************************************************************
 * Pre-Requisites:
 * Field mapping with Flat File Adapter(Tags) and Rally(Tags) should be present
 * ****************************************************************************************************************
 * Usage:
 * 1. Add below script as it is with execution type PRE_MAPVALUES
 * 2. Associate the script with the automation you are intending to use.
* ****************************************************************************************************************/

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

Logger log = LogManager.getLogger('com.go2group.connectall.model.transformer.model.api.RallyTags')

log.info("Applying Custom Business Rule to ConnectAll FF Adapter to sync Tags separately")

Entity record = context.getRecord()
def _tags = record.getSingleValueField("Tags")

// 1. Add a Null Check to prevent NullPointerExceptions
if (_tags != null && !_tags.trim().isEmpty()) {
    log.info("Original FF Adapter Tags value is: " + _tags)
    
    def _delimiter = ';'
    def splitTags = _tags.split(_delimiter)
    
// 2. Convert to ConnectAll Value objects
    def valueList = Value.getValues(splitTags)
    
    log.info("This is from ValueList: " + valueList)
    record.setSingleValueField("Tags", valueList) 

} else {
    log.info("Tags field is empty or null. Skipping transformation.")
}

return record;