Skip to main content

Version: 22.04

Tracking Number

The Tracking Number service is used to generate tracking numbers, also known as tracking codes, for form transactions. A generated tracking code is included in the form XML data, and is also displayed on associated transaction pages and emails. Tracking numbers are expected to contain alphanumeric values only and use uppercase letters.

note

Generated tracking numbers must be globally unique in the Temenos Journey platform database. If your service returns a non-unique tracking number, an error will occur when the system tries to create a transaction record. The Fluent SDK provides a TrackingCodeBuilder to generate and test tracking numbers.

This service is configured from the Form Details tab under the Tracking Code section.

Service Invoke Parameters

Parameters are not nullable except where otherwise indicated.

ParameterDescription
svcDefSvcDef
A service definition value object.
formForm
A form value object.
requestHttpServletRequest
A HTTP servlet request.
userUser
Nullable. An authenticated user.

Script Result

The service returns a non-blank globally unique tracking number value.

Error Handling

If an error occurs invoking your Tracking Number Groovy script, the error is logged in the Journey Manager database error log, and the user is redirected to the error page on the form space. The transaction is rolled back, and no transaction record is created.

note

Ensure any generated tracking numbers are unique.

Templates

Service

import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
import javax.servlet.http.*

class FluentTrackingNumberService {

/*
* Perform a transaction tracking number (tracking code) generation
*
* return: a globally unique tracking number value, values longer than 100 characters will be trimmed
*/
String invoke(SvcDef svcDef, Form form, HttpServletRequest request, User user) {

return new TrackingCodeBuilder()
.setPrefix(form.formCode + "-")
.setPostfix("-TEST")
.build()
}
}

Unit Test

import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.test.*
import com.avoka.tm.util.*
import com.avoka.tm.vo.*
import org.junit.Test

class UnitTest extends AbstractJUnitTest {

/*
* Perform service unit test
*
* throws exception if unit test fails
*/
@Test
void testTrackingCodeBuilder() throws Exception {

Form form = new MockVoBuilder().createForm()
MockRequest request = new MockRequest()

Map params = [
"svcDef": svcDef,
"form": form,
"request": request,
"user": null
]

String trackingCode = (String) new ServiceInvoker(svcDef).invoke(params)

logger.info "Tracking Code: " + trackingCode

// Test any business logic performed
assert trackingCode != null
assert trackingCode.startsWith(form.formCode + "-")
assert trackingCode.endsWith("-TEST")
}
}