Look in many xref lists for an origin ID

Look in many xref lists for an origin ID

Function ScriptedField
	Dim newid
	Dim oldid
	oldid = "@@ORG:OLDID@@"
        newid = XrefRead("Accounts",oldid)
	If Len(newid) = 0 Then
                newid = XrefRead("Contacts",oldid)
	End If
	If Len(newid) = 0 Then
                newid = XrefRead("Opportunities",oldid)
	End If
	If Len(newid) = 0 Then
                'If there is no newid, then skip this row.  Uncomment this if you want to skip on a blank ID.
                'GoToNextRow
	End If
	ScriptedField=newid
End Function
    • Related Articles

    • Working with Cross References (Xref files)

      Working with Cross References (Xref files) Xref files servermany purposes. The most common case is as foreign key lookups. Another common case is to use Xrefs as pick list lookups. Tables can be created manually. They can be created by importing the ...
    • Cross-reference (Xref)

      StarfishETL has built-in methods for maintaining relationships between different systems. Put simply, you will be storing an ID from your Origin, and the new corresponding ID from your destination for the record. For example, if you are migrating ...
    • Parse text and look up ID based on result

      This script parses out the first Lead Source from a comma or semi-colon separated list and then gets the Lead Source ID from an xRef list. Function ScriptedField Dim ls Dim res ls = "@@ORG:CUSTOM07@@" If Len(ls) <> 2 Then If InStr(ls,",") > 0 Then ls ...
    • Use Before Save and After Save operations to loop through a single origin record multiple times

      There are many reasons why you might want to loop through a single origin row multiple times. In Act for example, the contact record may contain an Account and one or more Contacts. Another example would be a Note that needs to be related to multiple ...
    • Check for duplicates using xref

      I needed to check for duplicate attachments in a system and remove the duplicates. I created a Job that used the same origin and destination and pulled all records from the Attachments table. I had a before operation that would read and write to the ...