Relate Teamleader V1 with V2 rows (Teamleader Focus)

This article explains how to relate the numeric IDs of V1 with hexadecimal IDs of V2 tables of Teamleader.

Instructions

Teamleader Focus has introduced with the V2 API a new concept of referential keys, moving from integers to GUIDs. However, the individual rows in V1 nor in V2 contain the key values of the other version.

For instance, the following query will return numeric IDs:

select id
from   teamleader.v1.deals

The following query will present you the GUID of the same deals in the V2 tables:

select del.id
,      mge.id
from   teamleader.v1.deals del
join   Teamleader.V2.MigrateId('deal', del.id) mge

The migrate ID table function is highly inefficient since it needs one extra native API call per row. However, since the mapping is persistent, the outcome is cached in the HTTP disk cache forever to speed up future mapping retrievals.

The sample can be extended to include both V1 and V2 deal data using:

select delv1.id id_v1
,      mge.id
,      delv2.id id_v2
from   teamleader.v1.deals delv1
join   Teamleader.V2.MigrateId('deal', delv1.id) mge
join   Teamleader.V2.Deals delv2
on     delv2.id = mge.id

The results mapping Teamleader V1 deal IDs to V2 deal IDs resemble:

image

Available Types for Conversion

The following Teamleader Focus object types are available: account, user, product, contact, company, deal, dealPhase, project, milestone, task, meeting, call, ticket, invoice, creditNote, subscription, and quotation.