Field Scripting Examples
Check for bad email address
Function ScriptedField Dim regEx, retVal dim res Set regEx = New RegExp res = "[{""email_address"":""@@ORG:email@@""}]" ' Create regular expression: regEx.Pattern ="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$" ' Set pattern: ...
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) ...
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 ...
Write Null instead of Blank
By default, Connect Creatio will write a blank, "", value to the destination. If you instead want to write Null, you must use a script for this. Function ScriptedField ScriptedField = "@@ORG:law_firm_c@@" if len(ScriptedField) = 0 then ScriptedField ...