> For the complete documentation index, see [llms.txt](https://docs.mydbsync.com/cloud-workflow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mydbsync.com/cloud-workflow/create-your-workflow/flow-builder/standard-functions.md).

# Standard Functions

Learn how to use the standard functions to build your workflows

Standard functions are predefined functions available to all users in a project. When you import or clone a project, these functions remain intact, ensuring consistency across the original and copied projects.

<table><thead><tr><th width="157.45458984375">Function</th><th width="187.272705078125">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>ADDXML(String xml)</code></td><td>Adds an XML structure to the root node of the target element. Use this function when the source application does not expose fields through its API and you need to map a field by modifying the XML structure to post back.</td><td><p>The following trigger fetches <code>id</code> and <code>firstname</code> from the <code>Contact</code> table, but the table also contains a <code>contactaddress</code> field the query does not return:</p><pre class="language-sql"><code class="lang-sql">SELECT id, firstname FROM Contact
</code></pre><p>To map <code>contactaddress</code> to the target:</p><pre><code>Name = {
  ADDXML("&#x3C;address>" + VALUE("ContactAddress") + "&#x3C;/address>");
  return VALUE("Firstname");
}
</code></pre></td></tr><tr><td><code>ADDXML(String xPath, String xml)</code></td><td>Appends an XML structure to the node at the given XPath. Use this function when the source application does not expose fields through its API and you need to parse data from a custom field.</td><td><p>The following mapping writes a Salesforce custom field (<code>SalesRep__c</code>) to a QuickBooks Online custom field (<code>SalesRep</code>):</p><pre><code>&#x3C;TargetField> = {
  ADDXML(
    "&#x3C;CustomField>" +
      "&#x3C;DefinitionId>2&#x3C;/DefinitionId>" +
      "&#x3C;Name>SalesRep&#x3C;/Name>" +
      "&#x3C;Type>StringType&#x3C;/Type>" +
      "&#x3C;StringValue>" + VALUE("SalesRep__c") + "&#x3C;/StringValue>" +
    "&#x3C;/CustomField>"
  );
  return "";
}
</code></pre><p>Where:</p><ul><li><code>&#x3C;DefinitionId>2&#x3C;/DefinitionId></code> — position of the custom field in QuickBooks Online</li><li><code>&#x3C;Name>SalesRep&#x3C;/Name></code> — name of the custom field in QuickBooks Online</li><li><code>&#x3C;StringValue></code> — value of the matching Salesforce field</li></ul></td></tr><tr><td><code>AND(boolean exp1, boolean exp2)</code></td><td>Returns <code>true</code> when both conditions are met; otherwise returns <code>false</code>.</td><td><p>The following mapping returns <code>true</code> for records where <code>Stage</code> is <code>"Closed Won"</code> and <code>Type</code> is <code>"Key Account"</code>:</p><pre><code>&#x3C;TargetField> = AND(
  VALUE("Stage") == "Closed Won",
  VALUE("Type") == "Key Account"
)
</code></pre></td></tr><tr><td><code>ASNUMBER(String value)</code></td><td>Returns the numeric value of a string. When the supplied value is not a number, the function returns <code>0</code>.</td><td><pre><code>&#x3C;TargetField> = ASNUMBER("123")
</code></pre><p>Returns <code>123</code>. When the value is <code>null</code> or empty, the function returns <code>0</code>.</p></td></tr><tr><td><code>CLEAN(String s)</code></td><td>Removes all non-printable characters from a string. The function removes the first 32 non-printable characters defined in the 7-bit ASCII code.</td><td><pre><code>&#x3C;TargetField> = CLEAN("Aºlan")
</code></pre><p>Returns <code>"Alan"</code> after removing the non-printable character.</p></td></tr><tr><td><code>CODE(String s)</code></td><td>Returns the numeric ASCII code of the first character of a string.</td><td><pre><code>&#x3C;TargetField> = CODE("Alan Musk")
</code></pre><p>Returns <code>65</code>, which is the ASCII code for <code>"A"</code>.</p></td></tr><tr><td><code>CONCATENATE(String... strings)</code></td><td>Joins two or more strings and returns the combined result.</td><td><pre><code>&#x3C;TargetField> = CONCATENATE("It's ", "raining ", "heavily ", "outside.")
</code></pre><p>Returns <code>"It's raining heavily outside."</code>.</p></td></tr><tr><td><code>DATE(String dateString)</code></td><td>Parses a date string and returns it in the format <code>yyyyMMdd-HHmmssZ</code>.</td><td><pre><code>&#x3C;TargetField> = DATE("03-12-2010 12:33:21")
</code></pre><p>Returns <code>"20101203-123321"</code>.</p></td></tr><tr><td><code>DATE(String dateString, String inputFormat)</code></td><td>Parses a date string using the specified input format and returns the date in that format. When no output format is specified, the function returns the date in <code>yyyyMMdd-HHmmssZ</code> format.</td><td><pre><code>&#x3C;TargetField> = DATE(VALUE("lasttransferdate"), "MM-DD-YYYY HH:MM:SS")
</code></pre><p>When <code>lasttransferdate</code> holds <code>"Mar-12-2010 12:33:21"</code>, the function returns <code>"03-12-2010 12:33:21"</code>.</p></td></tr><tr><td><code>DATE(String dateString, String inputFormat, String outputFormat)</code></td><td>Converts a date string from one format to another.</td><td><pre><code>&#x3C;TargetField> = DATE(
  DATE(VALUE("createddate"), "yyyy-MM-dd hh:mm:ss"),
  "yyyy-MM-dd'T'HH:mm:ss'Z'"
)
</code></pre><p>When <code>createddate</code> holds <code>"03-12-2010 12:33:21"</code>, the function returns <code>"2010-12-03T12:33:21"</code>.</p></td></tr><tr><td><code>DOLLAR(Arg0)</code></td><td>Not supported.</td><td>—</td></tr><tr><td><code>EQUALS(String v1, String v2)</code></td><td>Compares two string values and returns <code>true</code> when both match. The comparison is case-insensitive.</td><td><pre><code>&#x3C;TargetField> = EQUALS("she is beautiful", "He is beautiful")
</code></pre><p>Returns <code>false</code> because the strings do not match.</p></td></tr><tr><td><code>ERROR()</code></td><td>Returns the error message generated when a write to the target fails. Use this function in status write-back mappings, after a write attempt has completed.</td><td><p>When a write to a QuickBooks sales order fails with the message <code>"Invalid argument. The specified record does not exist in the list."</code>, the following mapping writes that error back to the source application:</p><pre><code>&#x3C;TargetField> = ERROR()
</code></pre></td></tr><tr><td><code>EXACT(String str1, String str2)</code></td><td>Compares two string values and returns <code>true</code> when both match exactly. The comparison is case-sensitive.</td><td><pre><code>&#x3C;TargetField> = EXACT(VALUE("FirstName"), VALUE("FirstName"))
</code></pre><p>Returns <code>true</code> when both fields hold the value <code>"Chris"</code>.</p></td></tr><tr><td><code>FAST_TLOOKUP(String query)</code></td><td>Looks up a value from a query and returns the corresponding result. This function works identically to <code>TLOOKUP</code>, but executes based on writer batch size for faster performance.<br><br><strong>Note:</strong> The return value must not start or end with a hyphen, and must not be <code>null</code>.</td><td><p>The following mapping updates a Salesforce Opportunity by matching a QuickBooks customer List ID:</p><pre><code>AccountID = FAST_TLOOKUP(
  "SELECT Id FROM Account
   WHERE AVSFQuickBooks__Quickbooks_Id__c=
   {CustomerRef/FullName/CustomerRet/ListID}"
)
</code></pre><p>When a match is found between the List ID and the Salesforce Account ID, the related invoice data from QuickBooks updates the corresponding Opportunity record.</p></td></tr><tr><td><code>FIND(String findText, String withinText)</code></td><td>Returns the 1-based position of <code>findText</code> within <code>withinText</code>. When <code>findText</code> appears more than once, the function returns the position of the first instance.</td><td><pre><code>&#x3C;TargetField> = FIND("arch", "search")
</code></pre><p>Returns <code>3</code> because <code>"arch"</code> begins at position 3 in <code>"search"</code>.</p></td></tr><tr><td><code>FIND(String findText, String withinText, int startNum)</code></td><td>Returns the position of <code>findText</code> within <code>withinText</code>, starting the search at <code>startNum</code>. When <code>findText</code> appears more than once, the function returns the position of the first instance found from <code>startNum</code> onward.</td><td><pre><code>&#x3C;TargetField> = FIND("arch", "search", 2)
</code></pre><p>Returns <code>3</code>. The search begins at position 2, so the character <code>"s"</code> at position 1 is skipped.</p></td></tr><tr><td><code>FIXED(Double)</code></td><td>Rounds a decimal number to two decimal places.</td><td><pre><code>&#x3C;TargetField> = FIXED(12.6789)
</code></pre><p>Returns <code>12.68</code>.</p></td></tr><tr><td><code>FIXED(Double, Integer)</code></td><td>Rounds a decimal number to the specified number of decimal places.</td><td><pre><code>&#x3C;TargetField> = FIXED(14.789, 1)
</code></pre><p>Returns <code>14.8</code>.</p></td></tr><tr><td><code>FIXED(Double, Integer, Boolean)</code></td><td>Not supported.</td><td>—</td></tr><tr><td><code>FORMAT(String value, String format)</code></td><td>Transforms a numeric string using the specified format pattern and returns the result as a string.</td><td><pre><code>&#x3C;TargetField> = FORMAT("12", "0.00##")
</code></pre><p>Returns <code>"12.00"</code>.</p></td></tr><tr><td><code>GETROOTVALUE(String elementName)</code></td><td>Returns the value of the immediate parent node of the specified XML element.</td><td><p>Given the following XML:</p><pre class="language-xml"><code class="lang-xml">&#x3C;Contact>
  &#x3C;Name>John&#x3C;/Name>
&#x3C;/Contact>
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = GETROOTVALUE("Name")
</code></pre><p>Returns <code>"John"</code>.</p></td></tr><tr><td><code>GETSOURCEXML2STRING()</code></td><td>Returns the entire source row as a formatted XML string.</td><td><p>Given the following XML input:</p><pre class="language-xml"><code class="lang-xml">&#x3C;items>
  &#x3C;item id="0001" type="donut">
    &#x3C;name>Cake&#x3C;/name>
    &#x3C;ppu>0.55&#x3C;/ppu>
  &#x3C;/item>
&#x3C;/items>
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = GETSOURCEXML2STRING()
</code></pre><p>Returns the entire structure as a string.</p></td></tr><tr><td><code>GETSOURCEXML2STRING(String elementName)</code></td><td>Returns the specified XML element and its contents as a formatted string.</td><td><p>Given the following XML input:</p><pre class="language-xml"><code class="lang-xml">&#x3C;items>
  &#x3C;item id="0001" type="donut">
    &#x3C;name>Cake&#x3C;/name>
    &#x3C;batters>
      &#x3C;batter id="1001">Regular&#x3C;/batter>
      &#x3C;batter id="1002">Chocolate&#x3C;/batter>
    &#x3C;/batters>
  &#x3C;/item>
&#x3C;/items>
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = GETSOURCEXML2STRING("batters")
</code></pre><p>Returns:</p><pre class="language-xml"><code class="lang-xml">&#x3C;batters>
  &#x3C;batter id="1001">Regular&#x3C;/batter>
  &#x3C;batter id="1002">Chocolate&#x3C;/batter>
&#x3C;/batters>
</code></pre></td></tr><tr><td><code>IF(Boolean condition, String trueValue, String falseValue)</code></td><td>Evaluates a condition and returns <code>trueValue</code> when the condition is <code>true</code>, or <code>falseValue</code> when it is <code>false</code>.</td><td><pre><code>&#x3C;TargetField> = IF(ISEMPTY(VALUE("Rate")), "0.00", VALUE("Rate"))
</code></pre><p>When <code>Rate</code> is empty, the function returns <code>"0.00"</code>. Otherwise, it returns the original value of <code>Rate</code>.</p></td></tr><tr><td><code>ISEMPTY(String s)</code></td><td>Returns <code>true</code> when the variable is uninitialized or explicitly set to empty; otherwise returns <code>false</code>.</td><td><pre><code>&#x3C;TargetField> = ISEMPTY(VALUE("FirstName"))
</code></pre><p>When <code>FirstName</code> holds the value <code>"Alan"</code>, the function returns <code>false</code>.</p></td></tr><tr><td><code>ISNULL(String s)</code></td><td>Returns <code>true</code> when the passed value is <code>null</code>; otherwise returns <code>false</code>.</td><td><pre><code>&#x3C;TargetField> = ISNULL(VALUE("lastname"))
</code></pre><p>When <code>lastname</code> holds the value <code>"Alan"</code>, the function returns <code>false</code>.</p></td></tr><tr><td><code>LEFT(String var)</code></td><td>Returns the first (leftmost) character of a string.</td><td><pre><code>&#x3C;TargetField> = LEFT("search")
</code></pre><p>Returns <code>"s"</code>.</p></td></tr><tr><td><code>LEFT(String var, int count)</code></td><td>Returns the specified number of characters from the left of a string. When the string is shorter than <code>count</code>, the function returns the full string.</td><td><pre><code>&#x3C;TargetField> = LEFT("search", 3)
</code></pre><p>Returns <code>"sea"</code>.</p></td></tr><tr><td><code>LEN(String var)</code></td><td>Returns the number of characters in a string.</td><td><pre><code>&#x3C;TargetField> = LEN("search")
</code></pre><p>Returns <code>6</code>.</p></td></tr><tr><td><code>LINK(String colName, String value)</code><br><br><em>Deprecated — use <code>MEMLOOKUP</code> or <code>TLOOKUP</code> instead.</em></td><td>Reads the second parameter and sets it as an attribute on the column specified in the first parameter. Returns the result as an object.</td><td><pre><code>&#x3C;TargetField> = LINK(VALUE("Name"), VALUE("Id"))
</code></pre><p>Sets the <code>Id</code> value as an attribute on the <code>Name</code> node and returns an object.</p></td></tr><tr><td><code>LINK(String colName, String query, String fieldName, String refValue, String objectName)</code><br><br><em>Deprecated — use <code>MEMLOOKUP</code> or <code>TLOOKUP</code> instead.</em></td><td>Creates an internally cached table from a target query with two columns — the primary key and one other column — then looks for a string that matches across both source and target to update the target lookup field.</td><td><p>The following mapping updates a Salesforce lookup field based on a matching QuickBooks transaction ID:</p><pre><code>AVSFQuickBooks__Opportunity__c = LINK(
  "AVSFQuickBooks__Opportunity__c",
  "SELECT id, AVSFQuickBooks__Quickbooks_Id__c FROM Opportunity",
  "AVSFQuickBooks__Quickbooks_Id__c",
  LSPLIT(VALUE("TxnID"), "-"),
  "Opportunity"
)
</code></pre><p>The function builds a cache of Opportunity records and looks for a record where <code>AVSFQuickBooks__Quickbooks_Id__c</code> matches the QuickBooks <code>TxnID</code>. When a match is found, the Opportunity lookup field is updated.</p></td></tr><tr><td><code>LINK(String colName, String query, String fieldName, String refValue, String objectName, String valueField)</code><br><br><em>Deprecated — use <code>MEMLOOKUP</code> or <code>TLOOKUP</code> instead.</em></td><td>Creates an internally cached table from a target query and returns the value of the specified <code>valueField</code> when the key match is found.</td><td><pre><code>&#x3C;TargetField> = LINK(
  VALUE("Name"),
  VALUE("Id"),
  VALUE("Phone"),
  VALUE("Id"),
  VALUE("Website"),
  VALUE("PhotoUrl")
)
</code></pre><p>Sets attributes on the <code>Name</code> node in the order: <code>Id</code> (sql), <code>Phone</code> (keyField), <code>Website</code> (objectIs), <code>PhotoUrl</code> (valueField). Returns the <code>Id</code> value (refValue).</p></td></tr><tr><td><code>LOG()</code></td><td>Prints the value of a parameter to the DBSync console. Use this function to inspect field values when debugging.</td><td><p>The following mapping logs the value of <code>Udf_Pa_Pricing</code> and returns the leftmost 20 characters:</p><pre><code>&#x3C;TargetField> = {
  LOG("ChainId: " + LEFT(VALUE("Udf_Pa_Pricing"), 20));
  return LEFT(VALUE("Udf_Pa_Pricing"), 20);
}
</code></pre><p>The logged output appears in the DBSync Logs section.</p></td></tr><tr><td><code>LOOKUP(String adapterName, String queryString)</code></td><td>Searches the specified source connector using a query and returns the matching value.</td><td><pre><code>&#x3C;TargetField> = LOOKUP(
  "Salesforce",
  "SELECT Id FROM Account WHERE Name='Test'"
)
</code></pre><p>Returns the Salesforce Account <code>Id</code> where <code>Name</code> equals <code>"Test"</code>.</p></td></tr><tr><td><code>LOOP</code></td><td>Groups line items based on a target identifier. Use <code>LOOP</code> instead of the <code>=</code> operator when the target requires line item grouping, or when an identifier is unique and consistent across both source and target systems.</td><td><p><strong>Example 1: Salesforce Opportunity line items to QuickBooks Invoice line items</strong></p><pre><code>InvoiceAddRq/InvoiceAdd/InvoiceLineAdd [dbsync:loop]
  "OpportunityLineItems/records"
</code></pre><p>For each Opportunity Line Item, the loop creates a corresponding Invoice Line Item.</p><p><strong>Example 2: Database to QuickBooks</strong></p><pre class="language-sql"><code class="lang-sql">SELECT invoice_no, customerid, item, itemdesc FROM InvoiceTable
</code></pre><pre><code>InvoiceAddRq/InvoiceAdd/InvoiceLineAdd [dbsync:loop] "invoice_no/list"
</code></pre><p>When four database rows share the same <code>invoice_no</code>, the mapping creates one QuickBooks Invoice with four Line Items instead of four separate invoices.</p></td></tr><tr><td><code>LOWER(String var)</code></td><td>Converts all characters in a string to lowercase.</td><td><pre><code>&#x3C;TargetField> = LOWER("SEARCH")
</code></pre><p>Returns <code>"search"</code>.</p></td></tr><tr><td><code>LPAD(String text, String pattern, int pad)</code></td><td>Pads the left side of a string with a specified character until the total length equals <code>pad</code>. When the string length already equals or exceeds <code>pad</code>, the function returns the original string.</td><td><pre><code>&#x3C;TargetField> = LPAD("tech on the net", "0", 15)
</code></pre><p>Returns <code>"tech on the net"</code> (string length already equals 15).</p><pre><code>&#x3C;TargetField> = LPAD("tech on the net", "0", 18)
</code></pre><p>Returns <code>"000tech on the net"</code>.</p></td></tr><tr><td><code>LSPLIT(String text, String splitter)</code></td><td>Returns the substring from the beginning of the string up to (but not including) the first occurrence of the splitter.</td><td><pre><code>&#x3C;TargetField> = LSPLIT("tech-on-the-net", "-")
</code></pre><p>Returns <code>"tech"</code>.</p></td></tr><tr><td><code>MAP(String key, String... mapEntries)</code></td><td>Returns the value that corresponds to <code>key</code> from the provided key-value pairs. When the key is not found, the function returns an empty string.</td><td><pre><code>&#x3C;TargetField> = MAP("myKey", "a=b", "c=d", "myKey=myValue")
</code></pre><p>Returns <code>"myValue"</code>.</p></td></tr><tr><td><code>MEMTABLE(String cacheIdentifier, String query)</code></td><td>Creates an in-memory data cache identified by <code>cacheIdentifier</code>. The cache holds the results of a query executed against the target connector as key-value pairs. Use <code>MEMLOOKUP</code> to retrieve values from this cache.</td><td><pre><code>MEMTABLE("AccountID", "SELECT Id, Name FROM dbAccount")
</code></pre><p>Creates a cache named <code>"AccountID"</code> containing all <code>Id</code>–<code>Name</code> pairs from the <code>dbAccount</code> table, for example: <code>a_01 → Name1</code>, <code>b_01 → Name2</code>.</p></td></tr><tr><td><code>MEMLOOKUP(String cacheIdentifier, String key)</code></td><td>Returns the value corresponding to <code>key</code> from the cache identified by <code>cacheIdentifier</code>. You must create the cache with <code>MEMTABLE</code> before calling this function.</td><td><pre><code>&#x3C;TargetField> = MEMLOOKUP("AccountID", VALUE("account_id"))
</code></pre><p>Using the cache from the <code>MEMTABLE</code> example, passing <code>"a_01"</code> as the key returns <code>"Name1"</code>.</p></td></tr><tr><td><code>MEMLOOKUPREGEX(String cacheIdentifier, String key, String regex)</code></td><td>Returns the value corresponding to <code>key</code> from a cache, but only when <code>key</code> matches the specified regular expression. When the key does not match the expression, the function returns an empty string.</td><td><pre><code>&#x3C;TargetField> = MEMLOOKUPREGEX(
  "AccountID",
  VALUE("account_id"),
  "^a_"
)
</code></pre><p>Returns a value only for keys that start with <code>"a_"</code>. Keys that do not match the regular expression return an empty string.</p></td></tr><tr><td><code>MID(String text, int startNum, int numChars)</code></td><td>Extracts a substring of <code>numChars</code> characters from <code>text</code>, beginning at position <code>startNum</code>.</td><td><pre><code>&#x3C;TargetField> = MID(VALUE("Firstname"), 6, 5)
</code></pre><p>When <code>Firstname</code> holds <code>"christopher"</code>, the function returns <code>"tophe"</code> (5 characters starting at position 6).</p></td></tr><tr><td><code>NOTEQUALS(String v1, String v2)</code></td><td>Returns <code>true</code> when the two values differ; otherwise returns <code>false</code>.</td><td><pre><code>&#x3C;TargetField> = NOTEQUALS(VALUE("CurrencyISO"), "USD")
</code></pre><p>Returns <code>true</code> for all records where <code>CurrencyISO</code> does not equal <code>"USD"</code>.</p></td></tr><tr><td><code>OR(boolean exp1, boolean exp2)</code></td><td>Returns <code>true</code> when at least one of the conditions is met; otherwise returns <code>false</code>.</td><td><pre><code>&#x3C;TargetField> = OR(
  VALUE("FirstName") == VALUE("LastName"),
  VALUE("Id") == "123"
)
</code></pre><p>When <code>FirstName</code> is <code>"Alan"</code>, <code>LastName</code> is <code>"Chris"</code>, and <code>Id</code> is <code>456</code>, neither condition is met, so the function returns <code>false</code>.</p></td></tr><tr><td><code>PARAM(String name)</code></td><td>Extracts a variable value from the session. The session entry must follow the format <code>PARAM.SOURCE_Object.Variable=PARAM.TARGET_Object.Variable</code>. The function returns the third text literal from the matching entry.</td><td><pre><code>&#x3C;TargetField> = PARAM(VALUE("Description"))
</code></pre><p>When <code>Description</code> starts with <code>"PARAM"</code> and the value exists in the session, the function extracts and returns the third text literal.</p></td></tr><tr><td><code>PARAM_PARENT(String name)</code></td><td>Extracts the parent value from a session entry in the format <code>PARAM.SOURCE_Object.Variable=PARAM.TARGET_Object.Variable</code>. The function concatenates the second text literal with <code>"/"</code> and the third text literal, then returns the result.</td><td><pre><code>&#x3C;TargetField> = PARAM_PARENT(VALUE("Description"))
</code></pre><p>When <code>Description</code> starts with <code>"PARAM"</code> and the value exists in the session, the function returns the second and third text literals joined with <code>"/"</code>.</p></td></tr><tr><td><code>PARENTVALUE(String name)</code></td><td>Returns the value of the immediate parent XML node for the specified element.</td><td><p>The following trigger fetches <code>Id</code>, <code>Name</code>, and <code>Account.Name</code> from the Salesforce Opportunity object:</p><pre class="language-sql"><code class="lang-sql">SELECT Id, Name, Account.Name FROM Opportunity
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = PARENTVALUE("Account/Name")
</code></pre><p>Returns the Account Name associated with each Opportunity.</p></td></tr><tr><td><code>PARENTVALUEATTR(String path, String attr)</code></td><td>Returns the attribute value of the immediate parent node at the specified path.</td><td><p>Given the following XML:</p><pre class="language-xml"><code class="lang-xml">&#x3C;CustomerRef>
  &#x3C;Name>Alan&#x3C;/Name>
&#x3C;/CustomerRef>
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = PARENTVALUEATTR("CustomerRef", "Name")
</code></pre><p>Returns <code>"Alan"</code>.</p></td></tr><tr><td><code>PROPER(String text)</code></td><td>Converts the first letter of each word to uppercase and the remaining letters to lowercase (title case).</td><td><pre><code>&#x3C;TargetField> = PROPER("search")
</code></pre><p>Returns <code>"Search"</code>.</p></td></tr><tr><td><code>REPLACE(String oldText, int startNum, int numChars, String newText)</code></td><td>Replaces <code>numChars</code> characters in <code>oldText</code> starting at position <code>startNum</code> with <code>newText</code>.</td><td><pre><code>&#x3C;TargetField> = REPLACE("search", 3, 3, "a")
</code></pre><p>Replaces 3 characters starting at position 3 (<code>"arc"</code>) with <code>"a"</code>, returning <code>"seah"</code>.</p></td></tr><tr><td><code>REPT(String text, int numberOfTimes)</code></td><td>Returns a string consisting of the supplied text repeated the specified number of times.</td><td><pre><code>&#x3C;TargetField> = REPT("tech", 2)
</code></pre><p>Returns <code>"techtech"</code>.</p></td></tr><tr><td><code>RIGHT(String var)</code></td><td>Returns the last (rightmost) character of a string.</td><td><pre><code>&#x3C;TargetField> = RIGHT("search", 1)
</code></pre><p>Returns <code>"h"</code>.</p></td></tr><tr><td><code>RIGHT(String var, int count)</code></td><td>Returns the specified number of characters from the right of a string. When the string is shorter than <code>count</code>, the function returns the full string.</td><td><pre><code>&#x3C;TargetField> = RIGHT("search", 5)
</code></pre><p>Returns <code>"earch"</code>.</p></td></tr><tr><td><code>RPAD(String var, String value, int size)</code></td><td>Pads the right side of a string with a specified character until the total length equals <code>size</code>. When the string length already equals or exceeds <code>size</code>, the function returns the original string.</td><td><pre><code>&#x3C;TargetField> = RPAD("tech on the net", "0", 15)
</code></pre><p>Returns <code>"tech on the net"</code> (string length already equals 15).</p><pre><code>&#x3C;TargetField> = RPAD("tech on the net", "0", 18)
</code></pre><p>Returns <code>"tech on the net000"</code>.</p></td></tr><tr><td><code>RSPLIT(String var, String splitter)</code></td><td>Returns the substring to the right of the last occurrence of the splitter.</td><td><pre><code>&#x3C;TargetField> = RSPLIT("tech-on-the-net", "-")
</code></pre><p>Returns <code>"net"</code>.</p></td></tr><tr><td><code>SEARCH(String findText, String withinText)</code></td><td>Returns the position of <code>findText</code> within <code>withinText</code>. The comparison is case-insensitive. When <code>findText</code> appears more than once, the function returns the position of the first instance.</td><td><pre><code>&#x3C;TargetField> = SEARCH("arch", "search")
</code></pre><p>Returns <code>3</code>.</p></td></tr><tr><td><code>SEARCH(String findText, String withinText, int startNum)</code></td><td>Returns the position of <code>findText</code> within <code>withinText</code>, starting the search at <code>startNum</code>. The comparison is case-insensitive. When <code>findText</code> appears more than once, the function returns the position of the first instance found from <code>startNum</code> onward.</td><td><pre><code>&#x3C;TargetField> = SEARCH("arch", "search", 2)
</code></pre><p>Returns <code>3</code>. The character <code>"s"</code> at position 1 is skipped.</p></td></tr><tr><td><code>SESSION_GET(String name)</code></td><td>Returns the value of the specified key from the active process or workflow session.</td><td><p>The following mapping retrieves the <code>Account_Name</code> key stored in the session:</p><pre><code>CustomerAddRq/CustomerAdd/Name = SESSION_GET("Account_Name")
</code></pre><p>Returns the value stored under <code>"Account_Name"</code>, for example <code>"Avankia"</code>.</p></td></tr><tr><td><code>SESSION_PUT(String name, String value)</code></td><td>Stores a key-value pair in the active process or workflow session. This function works only within active DBSync workflows.</td><td><pre><code>out = SESSION_PUT("Account_Name", "Avankia")
</code></pre><p>Stores <code>"Avankia"</code> under the key <code>"Account_Name"</code>. Retrieve this value later using <code>SESSION_GET</code>.</p></td></tr><tr><td><code>SETATTR(String colName, String attName, String attValue, String colVal)</code></td><td>Sets a column with a named attribute and value, and returns the column value. This function applies only when writing to the Salesforce Pricebook object.</td><td><pre><code>SETATTR(
  "PricebookEntryId",
  "pricebook",
  "Standard Price Book",
  VALUE("ItemRef/FullName")
)
</code></pre><p>Queries the Pricebook object for a record where the name is <code>"Standard Price Book"</code> and <code>ItemRef/FullName</code> matches <code>PricebookEntryId</code>. When the condition is met, the function returns the <code>PricebookEntryId</code> value and assigns it to the mapped target field.</p></td></tr><tr><td><code>SUBSTITUTE(String str, String oldStr, String newStr)</code></td><td>Replaces all occurrences of <code>oldStr</code> within <code>str</code> with <code>newStr</code>.</td><td><pre><code>&#x3C;TargetField> = SUBSTITUTE(VALUE("FirstName"), "John", "Alan")
</code></pre><p>Replaces every occurrence of <code>"John"</code> in <code>FirstName</code> with <code>"Alan"</code>.</p></td></tr><tr><td><code>SUBSTITUTE(String str, String oldStr, String newStr, int occurrences)</code></td><td>Replaces the specified number of occurrences of <code>oldStr</code> within <code>str</code> with <code>newStr</code>.</td><td><pre><code>&#x3C;TargetField> = SUBSTITUTE(VALUE("FirstName"), "John", "Alan", 2)
</code></pre><p>Replaces only the first two occurrences of <code>"John"</code> with <code>"Alan"</code>.</p></td></tr><tr><td><code>TEXT(Arg0, Arg1)</code></td><td>Not supported.</td><td>—</td></tr><tr><td><code>TLOOKUP(String queryString)</code></td><td>Returns the value of the single column specified in the query, fetched from the target connector.</td><td><p>The following mapping updates a Salesforce Opportunity by matching a QuickBooks customer List ID:</p><pre><code>AccountID = TLOOKUP(
  "SELECT Id FROM Account
   WHERE AVSFQuickBooks__Quickbooks_Id__c='"
   + VALUE("CustomerRef/FullName/CustomerRet/ListID") + "'"
)
</code></pre><p>When the List ID matches a Salesforce Account ID, the function returns that Account ID so the related QuickBooks invoice data updates the corresponding Opportunity.</p></td></tr><tr><td><code>TODAY()</code></td><td>Returns today's date in the format <code>Day Mon DD HH:MM:SS TTT YYYY</code>.</td><td><pre><code>&#x3C;TargetField> = TODAY()
</code></pre><p>Example output: <code>Fri May 06 07:10:58 CDT 2011</code></p></td></tr><tr><td><code>TRIM(String value)</code></td><td>Removes leading and trailing spaces from a string.</td><td><pre><code>&#x3C;TargetField> = TRIM(VALUE("FirstName"))
</code></pre><p>When <code>FirstName</code> holds <code>" John"</code>, the function returns <code>"John"</code>.</p></td></tr><tr><td><code>UNIQUEFIELD(String colName, String value, String colValue)</code></td><td>Sets the column with a unique field attribute value and returns the result as an object.</td><td><pre><code>&#x3C;TargetField> = UNIQUEFIELD(
  VALUE("Name"),
  VALUE("Id"),
  VALUE("Phone")
)
</code></pre><p>Sets the <code>Name</code> node with <code>Id</code> as the <code>uniquefield</code> attribute value and returns the <code>Phone</code> value as an object.</p></td></tr><tr><td><code>UPPER(String text)</code></td><td>Converts all characters in a string to uppercase.</td><td><pre><code>&#x3C;TargetField> = UPPER("search")
</code></pre><p>Returns <code>"SEARCH"</code>.</p></td></tr><tr><td><code>VALIDATEROW()</code></td><td>Returns <code>true</code> or <code>false</code> based on a conditional expression. Use this function in rule sections to control whether a row is processed.</td><td><pre><code>&#x3C;VALIDATEROW> = IF(
  ISEMPTY(VALUE("OpportunityId")),
  "true",
  "false"
)
</code></pre><p>Processes a row only when <code>OpportunityId</code> has a value. When <code>OpportunityId</code> is <code>null</code>, the function returns <code>false</code> and the row is skipped.</p></td></tr><tr><td><code>VALUE(String xPath)</code></td><td>Returns the value of the specified source field as a string.</td><td><pre><code>&#x3C;TargetField> = VALUE("Name")
</code></pre><p>When <code>Name</code> holds <code>"John"</code>, the function returns <code>"John"</code>.</p></td></tr><tr><td><code>VALUE(String xPath, boolean treatAsEmpty)</code></td><td>Returns the value of the specified source field as a string. When <code>treatAsEmpty</code> is <code>true</code> and the field has no value, the function returns an empty string.</td><td><p>Given the following XML:</p><pre class="language-xml"><code class="lang-xml">&#x3C;person gender="female">
  &#x3C;firstname>Alan&#x3C;/firstname>
&#x3C;/person>
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = VALUE("person/firstname", true)
</code></pre><p>Returns <code>"Alan"</code>. When <code>firstname</code> has no value and <code>treatAsEmpty</code> is <code>true</code>, the function returns <code>""</code>.</p></td></tr><tr><td><code>VALUEATTR(String xPath, String attr)</code></td><td>Returns the value of the specified attribute at the given XPath.</td><td><p>Given the following XML:</p><pre class="language-xml"><code class="lang-xml">&#x3C;person gender="female">
  &#x3C;firstname>Alan&#x3C;/firstname>
&#x3C;/person>
</code></pre><p>The mapping:</p><pre><code>&#x3C;TargetField> = VALUEATTR("person", "gender")
</code></pre><p>Returns <code>"female"</code>.</p></td></tr></tbody></table>
