Parse text and look up ID based on result

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 = 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
    • Related Articles

    • 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) ...
    • Validate and parse JSON

      This is a link to a page that will validate/parse your JSON: http://jsonlint.com/
    • Parse XML

      First I add code and External Assemblies to the .NET GLobal section of the Mapping tab: using System; using System.Collections.Generic; using System.Xml; XmlDocument demographicsXML = new XmlDocument(); XmlNodeList nodes; External Assemblies: ...
    • Exp Detect URLs in text with JavaScript

      A tool that can detect URLs in text with JavaScript can be found here: https://www.regextester.com/96249%7CRegular
    • Scripting Class Object

      From within VBScript operations (ScriptedVariable, VBScriptProcedure, ScriptedField) in additional to normal VBScript functions, the developer has access to a custom “Connect Creatio” class. The tables below define its usage. This class may also be ...