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 = Left(ls,InStr(ls,",")-1)
End If
If InStr(ls,";") > 0 Then
ls = Left(ls,InStr(ls,";")-1)
End If
res = ls
Else
res = XrefRead("sf-LeadSource",ls)
End If
ScriptedField=res
End Function