2022

Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 77 Next »



Function

Description

Examples

ADDXML(String xml)

This function adds XML structure to the present element. This function is used when the source application doesn't expose their fields in their API then a user can do the mapping for the field and parse the data via DBSync.

Mapping: <TargetField> = { ADDXML("<xml element>" + VALUE("sourcefield") +  "</xml element>");return "";}

Example: Database fields 
Trigger: select id,firstname from contact.

The above query fetches id, firstname from contact table of the database. The table also has a field of "contactaddress" and so query will not populate the "contactaddress" field in the target schema.

Name = {ADDXML("<address>" +VALUE("ContactAddress") + "</address>");return VALUE("Firstname");}

However i can map the source field and the populate the source field data in to contactaddress column of database and this contactaddress field is written to the target application

ADDXML(String xPath, String xml)

This function appends XML structure to the XPath passed. This function is used when the source application doesn't expose their fields through their API then a user can do the mapping for the field and parse the data via DBSync.

Let us take an example of custom field SalesRep__c  on Opportunity in SalesForce.

We have to map this field to SalesRep custom field on QuickBooks online.To map this field, type custom field name(SalesRep) in the target area(QuickBook online) and add below given query in the source field.

Mapping: <TargetField> = { ADDXML("<CustomField><DefinitionId>2</DefinitionId><Name>SalesRep</Name><Type>StringType</Type><StringValue>"+VALUE("SalesRep__c")+"</StringValue></CustomField>");

return "";

}

Where→ <DefinitionId>2</DefinitionId> :Position of custom field in QuickBooks online.

              <Name>SalesRep</Name> : The custom field name in QuickBooks online.

              <StringValue>"+VALUE("SalesRep__c")+"</StringValue>: The custom field in Salesforce.

AND (boolean booleanExp1, boolean booleanExp2)

This function used to check more than one condition/expression at the same time and returns true only if both conditions are satisfied; else returns false.Mapping: <TargetField> = AND(booleanExp1,booleanExp2) 

Example: Salesforce object fields 
Trigger: select Id, firstname, lastname from contact

The above query fetches Id, firstname, and lastname from the contact object of Salesforce. You can use AND() function to check whether firstname, lastname have same text value and Id of 123. If both the conditions are satisfied then AND() function returns true, else returns false. 

<TargetField> = AND(VALUE("firstNname")==VALUE("lastname"), VALUE("Id")=="123") 

ASNUMBER(String value)

This function checks if a supplied value is a number and returns the actual number passed; else returns zero.

MAPPING: <TargetField> = NUMBER("String")

Example: Salesforce object fields
Trigger: select name, numberofemployees from lead

The above query will select name and number of employees from the lead object of Salesforce. You can use ASNUMBER() function to convert the number of employees into integer format of a target field.

<TargetField> = ASNUMBER(VALUE("numberofemployees"))

If the value for the number of employees is null or empty it will return zero.

CLEAN(String s1, String s2)

This function removes all non-printable characters from a supplied string value.

Mapping: <TargetField> = CLEAN("String VALUE")

Example: Salesforce object fields
Trigger: select Id, name from account

The above query will select Id and name from the account object of Salesforce. You can use the CLEAN() function to get the first character of the name field and set it to the target field.

<TargetField> = CLEAN (VALUE("Name"))

CONCATENATE(String... strings )

This function allows you to join two or more text strings together.

Mapping: <TargetField> = CONCATENATE("String1", "string2", "string3")

Example: passing text values

<TargetField> = CONCATENATE("It's", "raining ", "heavily ", "outside.")
The value returned by the function from the above example is "It's raining heavily outside."

CODE(String s)

This function returns the numeric code of the first character of a supplied text value.

Mapping: <TargetField> = CODE("text value")

Example: Salesforce object fields
Trigger: select Id, name from account

The above query will select Id and name from the account object of Salesforce. You can use CODE () function to get the first character of the name field and set it to the target field.

<TargetField> = CODE(VALUE("Name"))

Example 2: <TargetField> = CODE("Salesforce")
The above mapping will put 'S' in the target field.

DATE(String dateString)This function reads a date string and returns it in the format of "yyyyMMdd-HHmmssZ".

Mapping: <TargetField> = DATE("date string")

Example : <TargetField> = DATE("03-12-2010 12:33:21")
The value returned would be transformed as "20101203-123321"

DATE (String dateString, String inputFormat)

This function reads a date string and returns the date string as per user specified date format.

If user specified date format is not passed then it passes date string as "yyyyMMdd-HHmmssZ".

Mapping: <TargetField> = DATE(VALUE("source field"), "format string")

Example: Salesforce object fields
Trigger: select company, createdby, lasttransferdate from lead

The above query will select company, created by and last transfer date field from the lead object of Salesforce. You can use DATE() function to format the passed date string to a specified date format.

<TargetField> = DATE(VALUE("lasttransferdate"),"MM-DD-YYYY HH:MM:SS")
The value of lasttransferdate is Mar-12-2010 12:33:21, then the DATE() function will return value as 03-12-2010 12:33:21

DATE(String dateString, String inputFormat, String outputFormat)

This function reads a date string and returns the date string as per user specified date output format.

If the user specified date input format is not passed then it returns date string as "yyyyMMdd-HHmmssZ".

Example: database query
Trigger: select contactname, createddate from dbcontact

The above query will select contactname, createddate field from dbcontact table of the specified database.

<TargetField>= DATE(DATE(VALUE("CreatedDate"),"yyyy-MM-dd hh:mm:ss"),"yyyy-MM-dd'T'HH:mm:ss'Z'")

The value of createddate is 03-12-2010 12:33:21, then the DATE() function will return value as 2010-12-03'T'12:33:21.

DOLLAR(Arg 0)

Not implemented yet


EQUALS(String v1, String v2)

This function compares two given string values and returns true if both the values are exact match otherwise false(case-insensitive).

Mapping: <TargetField> = EQUALS(VALUE("CurrencyISO"),"USD")

This function compares USD in CurrencyISO field for USD value and if found then it returns true; else false.

ERROR()

This function can be used to print error messages to the DBSync console. The function when applied to a target field, returns error messages from the stack trace due to integration failure in user readable format.

Mapping: <TargetField> = ERROR()

Example : Error while processing the state

EXACT(String str1, String str2)

This function compares two given string values and returns true if both the values are exact match otherwise false(case-sensitive).


Mapping: <TargetField> = EXACT(VALUE("SourceField1"), VALUE("SourceField2"))

Example: Salesforce object fields
Trigger: select Id, firstname, lastname from contact

The above query retrieve Id, firstname and lastname from contacts object of Salesforce. You can use the EXACT() function to compare the values of firstname and lastname fields. If both the fields are having same values then the function returns true, else returns false.

<TargetField> = EXACT(VALUE("FirstName"),VALUE("LastName"))

FAST_TLOOKUP(String query)


This function looks up a given Id from a passed query and returns the corresponding value.

Mapping: <TargetField> = FAST_TLOOKUP("select id from account where writer_name = { reader_name } and writer_code = { reader_code }")

@return value of the return_col based on the where_clause, else it would return empty value

FIND(String findText, String withinText)

This function returns the position of the first string parameter within the supplied second string parameter.


Mapping: <TargetField> = Find(VALUE("SourceField1"), VALUE("SourceField2"))

Example 1: <TargetField> = FIND("arch","search")

In this example, pass the first string as "arch" and second string as "search". The FIND() function will return the position of "arch" in "search". The FIND() function will return 3 as the value.

Example 2: Salesforce object fields

Trigger: Select Id,firstname,lastname from contact

The above query will retrieve Id, firstnameandlastnamefieldsfromcontactsobjectofSalesforce. You can use FIND() function to check whether lastNamefieldshasvaluesinfirstname. Ifthefunctionfindsthelastnamevalueinfirstname field then the function returns zero; else itreturnsthepositionofthelastnameinfirstname.

TargetField = FIND(VALUE("lastname"), VALUE("firstname"))


Note: If the findText parameter finds value in withinText parameter more than once, then the function returns the position of very first existence.

FIND(String findText, String withinText, int startNum)

This function returns the position of the first string parameter within the supplied second string parameter from the passed start index.

Mapping: TargetField = FIND(VALUE("SourceField1"), VALUE("SourceField2"), "Start Position")

Example1: TargetField = FIND("arch","search",2)

In this example, pass the first string as "arch" and second string as "search". The FIND() function will search the string "arch" in "search" starting from the second position of the "search" string and return the position of "arch" in "search". The function return 3 and first two characters of the string "Search" i.e. 's' and 'e' are ignored.

Example 2: Salesforce object fields

Trigger: select Id, firstname, lastname from contact

The above query retrieves Id, firstname and lastname fields from contacts object of Salesforce. You can use FIND() function to check for lastname field values in firstname field. If the function finds the lastname value in firstname field then the function returns zero; else it returns the position of the lastname in firstname.

<TargetField> = FIND (VALUE("FirstName"), VALUE("LastName"),1)

Note: If the findText parameter finds value within Text parameter more than once, then the function returns the position of very first existence.

FIXED (Double)This function rounds the decimal values up to two digits and returns the round off value.

Mapping: <TargetField> = FIXED("sourcefield1")

Example: Database query
Trigger: select orderno,vendorname, price from order

The above query retrieves orderno, vendorname and price from order table of the specified database.

<TargetField> = FIXED(VALUE("price"))

In the price field the value passed is 12.6789 so the FIXED() function will return the price value as 12.68

FIXED (Double, Integer)

This function rounds a supplied number to a specified number of decimal places.

Mapping: <TargetField> = FIXED("sourcefield1")

Example: Database query
Trigger: select orderno,vendorname, price from order

The above query retrieves orderno, vendorname and price from order table of the specified database.

<TargetField> = FIXED(VALUE("price"),1)

In the pricefieldthe value passed is 14.789 so the FIXED() function will return the price value as 14.8

FIXED (Double, Integer, Boolean)

Not supported


FORMAT(String value, String format)

This function transforms the numeric string passed in the first parameter based upon the format passed in the second parameter and returns the transformed number as a string.

Mapping: <TargetField> = FORMAT("SourceField1", "Format String")

Example: Database query
Trigger: select orderno,vendorname, price from order

The above query retrieves orderno, vendorname and price from order table of the specified database.

<TargetField> = FORMAT(VALUE("price"),"#,##0.00")

In the price field the value passed is 210.6 so the FORMAT() function will return the price value as 210.60


GETROOTVALUE(String elementName)

This function returns the immediate parent node of XML element.

Mapping: <TargetField> = GETROOTVALUE("SourceField1")

<TargetField> = GETROOTVALUE(VALUE("Name"))

The "Name" value will be compared in the XML and if found returns the parent node contents as a String.

GETSOURCEXML2STRING()

This function returns the string formatted XML structure of the row.

Mapping: <TargetField> = GETSOURCEXML2STRING()

The XML elements are returned as a string.

GETSOURCEXML2STRING(String elementName)


This function returns the string formatted XML structure of the row, for the element name passed.

Mapping: <TargetField> = GETSOURCEXML2STRING("InvoiceRet")

<TargetField> = GETSOURCEXML2STRING(VALUE("Id"))

The "Id" node element is found in the xml and returned as a string.

IF(Boolean condition, String trueValue, String falseValue)

This function tests the user-defined condition and returns one result if the condition is true, and another result if the condition is false.

Mapping : <TargetField> = IF(String,Integer,String)

Example: Salesforce object fields

Trigger: select unitprice, quantity from Product2

The above query retrieves fields unitprice and quantity from Product2 object of Salesforce. You can use IF function to check if either unitprice or quantity is returning '0' and add a validation accordingly.

<TargetField> = IF(LEN(VALUE("Quantity"))==0,"1",VALUE("Quantity"))

In this case the IF function checks the value of quantiy to be zero then it returns 1 or else it returns the original quantity value from the Salesforce.


<TargetField> = IF(ISEMPTY(VALUE("Rate")),"0.00",VALUE("Rate"))

In this case the IF function checks the value of rate to be empty then it returns 0.00 or else it returns original rate value from the Salesforce.

ISEMPTY(String s)

This function returns true if the variable is unintialized or explicity set to empty; otherwise it returns false.

Mapping: <TargetField> = ISEMPTY(String)

Example: Salesforce object field

Trigger: select Id, firstname, lastname from contact

The above query retrieves Id, firstname and lastname from contact object of Salesforce. You can use ISEMPTY() function to check whether the first name is empty or not. If the value of first name field is empty then the function return true, else return false.

<TargetField> = ISEMPTY(VALUE("FirstName"))

In the above example, the first name field has a value of "Alan" so the function ISEMPTY() returns true.

ISNULL(String s)

This function checks if the passed value is null then returns true; else, returns false.

Mapping: <TargetField> = ISEMPTY(String)

Example: Salesforce object field

Trigger: select Id, firstname, lastname from contact

The above query retrieves Id, firstname and lastname from contact object of Salesforce. You can use ISNULL() function to check whether the lastname is null or not. If the value of lastname field is null then the function return true, else return false.

<TargetField> = ISNULL(VALUE("lastname"))

In the above example, the first name field has a value of "Alan" so the function ISNULL() returns false.

LEFT (String var)

This function returns the first character of the supplied string which is on left hand side.

Mapping: <TargetField> = LEFT(VALUE("SourceField1"))

Example1: passing a string

<TargetField> = LEFT("search")

In this example, pass a string as "search". The LEFT() function returns the value as "s".


Example2: Salesforce object fields

Trigger: select Id, firstname, lastname from contact

The above query retrieves Id, firstname and lastname from contacts object of Salesforce. You can use LEFT() function to getthefirstcharacterofthefirstname field.

<TargetField> = LEFT(VALUE("FirstName"))

so the firstnamefieldhasavalueof"Salesforce" and the function will return 'S' which is the first character of string from the left.

LEFT(String var, int count)

This function returns the specified number of characters from the left of the given string.

Mapping: <TargetField> = LEFT(VALUE("SourceField1"), noofcharacter)

Example1: passing a string

<TargetField> = LEFT("search",3)

In this example, pass the first parameter as "search" and second parameter as 3. The LEFT() function will return three characters from the left of the parameter "search" and the function returns "sea".

Example2: Salesforce object fields

Trigger: select Id, firstname, lastname from contact

The above query retrieves Id, firstname and lastname from contact object in Salesforce. You can use LEFT() function to get five characters of firstname field from the left side.

<TargetField> = LEFT(VALUE("FirstName"), 5)

so the firstname field has a value of "Salesforce" and the function will return 'Sales' which are the five character of string from the left.

Note: If the length of the passed string is less than the second parameter then the function will return a full string as a result.

LEN(String var)

This function returns the length of the given string.

Mapping: <TargetField> = LEN(String)

Example1: passing a string

<TargetField> = LEN("search")

In this example, pass the string as "search". The LEN() function will return value as '6' which is the length of string "search".

Example2: Salesforce object fields

Trigger: select Id, firstname, lastname from contact

The above query will retrieve Id, firstname and lastname from contacts object of Salesforce. You can use LEN() function to get the lengthofeitherfieldfirstnameorlastname.

<TargetField> = LEN(VALUE("FirstName"))

The value in the firstname field has a value "mydbsync" and hence the LEN() function returns '7'.

LINK(String colName, String value)

This function reads the second parameter passed through this function and sets it as an attribute to the column name which is passed through the first parameter.

Mapping: <TargetField> = LINK(VALUE("SourceField1"), VALUE("SourceField2"))

<TargetField> = LINK(VALUE("Name"), VALUE("Id"))
In "Name" node, the "Id" value will be added as "sql" attribute's value and the returned value is an object.

LINK(String colName, String query, String fieldName, String refValue, String objectName)


Note: This function is deprecated and an alternative function could be MEMLOOKUP orTLOOKUP functions.

The Link function is used to update Salesforce (Target) field with a source value based on the source identifier that remains unique across Salesforce (Target) as well as Source (Ex: Quickbooks) application

The function creates an internally cached table querying the target (Salesforce) database with two columns, first column being the primary key for the table, second for the other column name.
 
It then looks for a string that is same across both Source and Target system before updating the Target LOOK-UP(Salesforce) field with the Source field value.

Example: 
Mapping:

AVSFQB__Opportunity__c = LINK("AVSFQB__Opportunity__c",
"Select id,AVSFQB__Quickbooks_Id__c from Opportunity",
"AVSFQB__Quickbooks_Id__c",LSPLIT(VALUE("TxnID"),"-"),
"Opportunity")
In the above example we are trying to update Salesforce
look-up field AVSFQB__Opportunity__cbased on the condition
where AVSFQB__Quickbooks_Id__c is equal to Quickbooks
transaction Id "TxnID" as they both are same across both
Salesforce as well as Quickbooks.
In order to update Salesforce look-up field Opportunity
we are creating a cached table with the above query.
Then it does a lookup for all Opportunity records whose
Salesforce field AVSFQB__Quickbooks_Id__c value matches
with that of Quickbooks field "TxnID".
LINK(String colName, String query, String fieldName, String refValue, String objectName, String valueField)

Mapping: <TargetField> = LINK(VALUE("SourceField1"), VALUE("SourceField2"), VALUE("SourceField3"), VALUE("SourceField4"),VALUE("SourceField5"),VALUE("SourceField6"))

<TargetField> = LINK(VALUE("Name"), VALUE("Id"), VALUE("Phone"), VALUE("Id"), VALUE("Website"), VALUE("PhotoUrl"))
In "Name" node, default attribute values are set in order as "Id" value for "sql", "Phone" for "KeyField", "Website" for "ObjectIs", "PhotoUrl" for "ValueField". The last but second attribute refValue, here it is "Id", will be returned back.

LOG()

This is not in function2base

This function is used to print the value of a parameter passed to DBSync console. It can be used for debugging purpose.

Mapping: <TargetField> = LOG(VALUE("SourceField"))

Example : <TargetField> = {LOG("********ChainId"+LEFT(VALUE("Udf_Pa_Pricing"),20));return LEFT(VALUE("Udf_Pa_Pricing"),20);}

The log function prints the value of the target field "udf_pa_pricing" to DBSync console whenever the process is run.

LOOP

This function is different from the conventional '=' operator to map source and target.

<SourceField "loop" TargetField> is used in
scenarios where a grouping the Line Items are required based on the target identifier. It can also be used when the identifier is unique and same across both source and target systems.

Example1:  Salesforce OppotunityLineItems to InvoiceLineItems

Mapping : InvoiceAddRq/InvoiceAdd/InvoiceLineAdd [dbsync:loop] "OpportunityLineItems/records"

In the above example for every opportunity Line Item, the loop will create a corresponding Invoice Line Item.

Example2:  Source - Database ; Target - Quickbooks
Database Query : select invoice_no,customerid,item,itemdesc from InvoiceTable
Mapping : InvoiceAddRq/InvoiceAdd/InvoiceLineAdd [dbsync:loop]  "invoice_no/list"

In the above example, we are using "invoice_no" column from the database as an identifier. Based on this identifier we are grouping each row as a line item and then mapping it with Quickbooks Invoice Line Item.
For instance, if the database Invoice table has four rows with "invoice_no" being the same for all the four rows, then the mapping will create one Invoice in Quickbooks with four Line Items rather than creating one Invoice for each row.

LOOKUP(String adapterName, String queryString)


This function searches for a specific value in the source connector where the condition is passed in the form of a query to be searched on the first parameter.

Mapping: <TargetField> = LOOKUP("sourceconnector" , "querystring")

Example:<TargetField> = LOOKUP("Salesforce","select Id from Account where Name='Test'")

The above example with fetch the Id from account object of Salesforce from the source application and assigns it to the target field whenever the name field has a value of "Test"


LOWER (String var)

This function converts all character in a given string to lowercase.

Mapping: <TargetField> = LOWER(String)

Example1: passing a string

In this example, pass a string as "SEARCH". The LOWER() function will return the string converted to lowercase.

<TargetField> = LOWER("SEARCH")

The function will return "SEARCH" as "search".

Example2: Salesforce object fields

Trigger: Select Id, firstname, lastname from contacts

The above query retrieves Id, firstname and lastname from contacts object of Salesforce. You can use LOWER() function to convert the FirstName and LastName to lower case.
<TargetField> = LOWER(VALUE("FirstName"))

The function will return the value of field firstname for "Avankia" as "avankia".

LPAD(String text, String pattern, int pad)

This function is used to pad left side of a string with the specific set of characters. The integer is the total length of the string returned after padding.

Mapping: <TargetField> = LPAD(VALUE("SourceField1"), "string", Int)

Example1: <TargetField> = LPAD("tech on the net", "0", 15)
The function would return reuslt as tech on the net"

Example2: <TargetField> = LPAD("tech on the net", "0", 18)
The function would return result as "000tech on the net"

LSPLIT(String text, String splitter)

This function returns the split value of the string starting from left side of a string till the splitter value.

Mapping: <TargetField> = LSPLIT(VALUE("SourceField"), "string")

Example: <TargetField> = LSPLIT ("tech-on-the-net", "-")
The LSPLIT() would return result as "tech"

MAP(String key, String...mapEntries)

This function returns the value against the key passed from the key-value pair(s) passed via second parameter of the function.

Mapping: <TargetField> = MAP(VALUE("string1", "string2", string3, string4)

Example: <TargetField> = MAP("myKey", "a=b", "c=d", "myKey=myValue")

The MAP function will return "myValue". If key is not present in any of the key-value pairs then function will return empty string.

MEMLOOKUP(String cacheIdentifier, String query)

This function uses unique identifier of a query i.e cacheIdentifier which would load up the dataset for a lookup.This function creates a table in memory for returning the value of a lookup.

Mapping: <TargetField> = MEMLOOKUP(StringCacheIdentifier, StringKey)

Example1: SALESFORCE OBJECT 
In this example, AccountID is the memory table created on Account object of Salesforce using MEMTABLE() function. 

<TargetField> = MEMLOOKUP("AccountID",VALUE("SourceField") ) 

Example2: DATABASE TABLE
In this example, AccountID is the memory table created on dbAccount table of database using MEMTABLE() function.
 
<TargetField> = MEMLOOKUP("AccountID", VALUE("SourceField") )

MEMLOOKUPREGEX(String cacheIdentifier, String key, String regex)

A variant of the MEMLOOKUP function which takes an additional parameter i.e. regex, returns the value of only those key which matches with regex.

The value whose key starts with prefix, or null if not available

MEMTABLE(String cacheIdentifier, String query)

This function creates a memory table in DBSync with key -value pair of the query passed through this function.


You can append the MEMTABLE() at the end of any other mapping.

MAPPING: <TargetField> = VALUE("SourceField") + MEMTABLE(StringCacheIdentifier, StringQuery)

Example1: SALESFORCE OBJECT 
Trigger: select Id, name from account
The above query retrieves Id, name from accounts object of Salesforce
<TargetField> = VALUE("SourceField") +MEMTABLE("AccountID","Select Id, name from Account") 

Example2: DATABASE TABLE
In this example, select ID and name value from dbAccount table for all records in dbAccount Table.
 
<TargetField> = VALUE("SourceField") +MEMTABLE("AccountID","Select ID, Name from dbAccount")

MID(String text, Int startNum, Int numChars)

This function extracts a substring from the string and returns the substring.

Mapping: <TargetField> = MID(VALUE("sourcefield"), startnum, numchars)

Example: SALESFORCE OBJECT 
Trigger: Select Id, firstname, lastname from contacts
The above query retrieves Id, firstname and lastname from contacts object of Salesforce.
<TargetField> = MID(VALUE("Firstname"), 6, 5)
The functions return the five characters of the name field beginning with the sixth character from the left.
NOTEQUALS(String v1, String v2)This function compares the value with another value and returns true if it is not equals else returns false

Mapping: <TargetField> = NOTEQUALS("string1","string2")

<TargetField> = NOTEQUALS(VALUE("CurrencyISO"),"USD")

This function compares USD in CuurencyISO field and if USD is not found then it returns as true else false.

NUMBER(String text)

This is not in UI

This function returns an integer value of the string passed to it.

MAPPING: <TargetField> = NUMBER("String")

Example: Salesforce object fields
Trigger: Select name, numberofemployees from lead

The above query will retrieve name and number of employees from leads object of Salesforce. You can use NUMBER() function to convert the values of the number of employees field to integer format.
<TargetField> = NUMBER(*VALUE("NumberOfEmployees"))*

If the value for Number of Employees is null or empty then the function will return Zero.

OR(boolean exp1, boolean exp2)

This function evaluates the conditions passed through the function and returns true if any one of condition evaluates to true; otherwise, returns false.

Mapping: <TargetField> = OR(Boolean, Boolean)

Example: Salesforce object fields
Trigger: select Id, firstname, lastname from contact

The above query will retrieve Id, firstname and lastname from contacts object of Salesforce. You can use OR() function to check whether the fields of first name and last name are having same values or Id equals to 123.

TargetField = OR(VALUE("FirstName")==VALUE("LastName"), VALUE("Id")=="123")

  • If both the conditions are true then the function will return true.
  • If the first condition is true and second condition is false then the function will return true.
  • If the first condition is false and second condition is true then the function will return true.
  • If both the conditions are false then the function will return false.



PARAM(String name)

This function PARAM extract the values from session which is in the format PARAM.SOURCE_Object.Variable=PARAM.TARGET_Object.Variable and returns the variable value.

Mapping: <TargetField> = PARAM(''string'')


Example :<TargetField> = PARAM(VALUE("Description"))

If the value of "Description" starts with "PARAM" and the value is present in the session, then the third text literal is extracted and returned.
PARAM_PARENT(String name)This function PARAM extract the values from the session which is in the format PARAM.SOURCE_Object.Variable=PARAM.TARGET_Object/Variable and return the parent value.

Mapping: <TargetField> = PARAM_PARENT(''string'')

Example: <TargetField> = PARAM_PARENT(VALUE("Description"))

If the value of "Description" starts with "PARAM" and the value is present in the session, then the second text literal is concatenated with "/" and third text literal and returned.

PARENTVALUE(String name)This function reads any node element and returns immediate parent value of the node element passed.Mapping: <TargetField> = PARENTVALUE("SourceField1")
PARENTVALUEATTR(String path, String attr)This function reads the passed node element and returns attributes of the immediate parent node.Mapping: <TargetField> = PARENTVALUEATTR("stringpath","attr")
PROPER(String text)This function reads a string and converts the first letter of a word to upper case and rest of alphabets in a word to lower case.This is used to represent camel notation

Mapping: <TargetField> = PROPER("SourceField1")


Example: <TargetField> = PROPER("search")

In this example, I will pass string "search" as the parameter then the function returns the result as "Search".


REPLACE (String oldText, Int startNum, Int numChars, String newText)

This function replaces a full string or a part of string text with another text string from the position sent through parameter i.e. startNum.


Mapping: <TargetField> = REPLACE(VALUE("SourceField1), 1, 5, "replace string")

Example1: Pass a string

In this example, I will pass string "search" as the first parameter, 3 as start number for the second parameter, 3 as a number of characters to be replaced for third parameter and "a" as the replace string. The REPLACE() function will replace three characters from 3rd character to 5th character in the string. The resulting string returned by function will be "search".

TargetField = REPLACE("seaaarch",3,3,"a")

Example2: salesforce object field

READER: Select Id, FirstName, LastName from Contacts

The above query will select Id, FirstName and Last Name from contacts object in Salesforce. You can use REPLACE() function to replace specified number of characters of FirstName with specified string. If the VALUE for FirstName is "salesforce" as first parameter, VALUE of start number is 2 as second parameter, VALUE for number of characters is 4 for third parameter, and VALUE of Replace String is "f-", then function REPLACE() will return string "sf-force".

TargetField = REPLACE(VALUE("FirstName"),2,4,"f")

Note: VALUE() function is used inside REPLACE() to convert the FirstName VALUE to string.

REPT(String text, Int numberOfTimes)This function returns a string consisting of a supplied text string, repeated specified number of times.Mapping: <TargetField> = REPT(VALUE("SourceField1"), 2)

Example: 
REPT("tech", 2) 
would return "techtech"

RIGHT(String var)

This function returns a right most character of the string value passed.

Mapping: TargetField = RIGHT(String)

Example1: String Parameter

In this example, I will pass string as "search". The RIGHT() function will return first character from the right of string "search". So string returned by function will be "h".

TargetField = RIGHT("search",1)

Example2: Salesforce objectfields

Trigger: select Id, FirstName, LastName from Contacts

The above query retrieves Id, firstname and lastname from contacts object of Salesforce. You can use RIGHT() function to get last last characters of FirstName. If the value of the field "firstname" is "salesforce" the resulting string will be "e".

<TargetField> = RIGHT(VALUE("FirstName"))

Example 3: Database table

Trigger: select Id, firstname, lastname from dbContacts

The above query retrieves Id, firstname and lastname from contacts in database. You can use RIGHT() function to get last last characters of firstname. If the value for firstname is "salesforce" the resulting string will be "e".

<TargetField> = RIGHT(VALUE("firstname"))

RIGHT(String var, Int count)

This function returns a specified number of characters from the end of a supplied text string.

Mapping: <TargetField> = RIGHT(VALUE("SourceField1"), NoOfCharacters)

Example1: String parameter

In this example, I will pass first string as "search" and second parameter as 5. The RIGHT() function will return 5 characters from the right of string "search". So string returned by function will be "earch".

<TargetField> = RIGHT("search",5)

Example2: Salesforce object fields

READER: Select Id, FirstName, LastName from Contacts

The above query will select Id, FirstName and Last Name from contacts object in Salesforce. You can use RIGHT() function to get last 5 characters of FirstName. If the value for FirstName is "salesforce" the resulting string will be "force".

<TargetField> = RIGHT(VALUE("FirstName"), 5)

Example 3: Database fields

Trigger: select Id, firstname, lastname from dbContacts

The above query retrieves Id, firstname and lastname from contacts in database. You can use RIGHT() function to get last last characters of firstname. If the value for firstname is "avankia" the resulting string will be "a".

<TargetField> = RIGHT(VALUE("FirstName"),1)


Note: If number of characters in the string is less than number of characters requested from the function, it will return the full string.

VALUE() function is used to convert the firstname to string.

RPAD(String var, String value, Int size)This function returns a string after padding the input string with extra characters from the right side. The user can pass the size of the input string till which the padding should be done.Mapping: <TargetField> = RPAD(VALUE("SourceField1"), "string", Int)

Example1:
RPAD("tech on the net", "0", 15)
would return "tech on the net"

Example2:
RPAD("tech on the net", "0", 18)
would return "tech on the net000"
RSPLIT(String var, String splitter)This function takes splitter text and compares it with the variable text and splits the variable text basing on the splitter text and returns character after the splitter text to the right.Mapping: TargetField = RSPLIT(VALUE("SourceField"), "string")

Example:
RSPLIT ("tech-on-the-net", "-")
would return "net"

SEARCH(String findText, String withinText)

This function returns the position of a supplied text string from within a supplied text string.

Mapping: <TargetField> = SEARCH(VALUE("SourceField1"), VALUE("SourceField2"))

Example1: String parameters

In this example, I will pass the first string as "arch" and second string as "search". The SEARCH() function will return the place value of "arch" in "search". So it will return 3 as the place value.

<TargetField> = SEARCH("arch","search")

Example2: Salesforce object fields

READER: Select Id, firstname, lastname from Contacts

The above query will retrieve Id, firstname and lastname from contacts object of Salesforce. You can use SEARCH() function to check whether LastName is already existing in FirstName and If it is not existing in the FirstName it will return 0 else it will return the place VALUE of the LastName in FirstName.

<TargetField> = SEARCH(VALUE("LastName"), VALUE("FirstName"))

Note: If the search string exists more than once in the Second string, the function returns the place VALUE of first existence.

SEARCH(String findText, String withinText, int startNum)

This function returns the position of a supplied text string from within a supplied text string for which starting position can be specified.

Mapping: <TargetField> = SEARCH(VALUE("SourceField1"), VALUE("SourceField2"), "Start Position")

Example: String parameters

In this example, I will pass the first string as "arch" and second string as "search". The SEARCH() function will search the string "arch" in "search" from the second position in the string and will return the place value of "arch" in "search". So it will return 3 as the place value. So character 's' will be ignored.

<TargetField> = SEARCH("arch","search",2)

Example2: Salesforce object field

Trigger: select Id, firstname, lastname from contact

The above query retrieves Id, firstname and lastname from contacts object of Salesforce. You can use SEARCH() function to check whether lastname is already existing in firstName and If it is not existing in the firstname it will return 0 else it will return the position of the lastname in firstname.

<TargetField> = SEARCH(VALUE("FirstName"), VALUE("LastName"),1)

Note: If the search string exists more than once in the second string, the function returns the position of first existence

SESSION_GET(String name)This function returns the value of the key stored in the session of that particular process or workflow.

Mapping: <TargetField> = SESSION_GET("KEY")

Example: Retrieving the "key" stored in the session

Mapping : CustomerAddRq/CustomerAdd/Name = SESSION_GET("Account_Name")

In the above example, we are retrieving the KEY ie. "Account_Name" of Salesforce opportunity object stored in the session and value that is being parsed internally in that of what was stored in the session, "Avankia".

SESSION_PUT(String name, String value)

This function stores the key/value pair in the session of that particular process or workflow which is active. This function can only work activeworkflowswithinDBSync.

Mapping: out = SESSION_PUT("KEY","VALUE")

Example: Storing a static value (Account Name) in the session

Mapping : out (target field) = SESSION_PUT("Account_Name","Avankia")

In the above example we are storing a static key/value pair for an "AccountName". This assigns the value "Avankia" to the key "Account_Name" which can be retrieved using SESSION_GET variable and printed to DBSync console.

SETATTR(String colName, String attName, String attValue, String colVal)

This function sets the column with an attribute of name and value as specified. The column value would be set as specified in the colVal.

Eg: SETATTR("Name","priceBook","Standard PriceBook",VALUE("Name"))

Example :

SETATTR("PricebookEntryId","pricebook","Standard Price Book",VALUE("ItemRef/FullName"))


SUBSTITUTE(String str, String oldStr, String newStr)This function replaces all occurrences of a string, within an old string, with the passed new string.Example: Database fields

Trigger: Select Id, firstname, lastname from dbcontacts

The above query will retrieve Id, firstname and lastname from contact table of database. You can use SUBSTITUTE() function to replace the firstname field which has value of John with Alan

TargetField = SUBSTITUTE(VALUE("FirstName"), "John" "Alan")
SUBSTITUTE(String str, String oldStr, String newStr, int occurrences)This function replaces the specified number of occurrences of a string, within an old string, with the passed new string.Example: Database fields

Trigger: Select Id, firstname, lastname from dbcontacts

The above query will retrieve Id, firstname and lastname from contact table of database. You can use SUBSTITUTE() function to replace the firstname field which has value of John with Alan for the first two occurrences.

TargetField = SUBSTITUTE(VALUE("FirstName"), "John" "Alan",2)
TEXT(Arg 0, Arg1)Not Currently Implemented

TLOOKUP(String queryString)

Returns the value for the column in the query. In the query, only one column can be specified.Mapping: <TargetField> = TLOOKUP(stringQuery)

Example1: Salesforce object fields
In this example, I will select ID value for Account with name as ABC.
TargetField = TLOOKUP("Select Id from Account where Name ='"+ "ABC" + "'")

Example2: Database table
In this example, I will select ID value for Account from dbAccount table with name as ABC.
<TargetField> = TLOOKUP("Select Id from dbAccount where Name ='" + VALUE("NAME") +"'")
Here assumption is that name field contains value ABC.

TODAY()

This function returns Today's date

Mapping: <TargetField> = TODAY()

Format returned from TODAY() is "Day Mon DD HH:MM:SS TTT YYYY"

Example: Fri May 06 07:10:58 CDT 2011

TRIM(String value)This function returns a text value with the leading and trailing spaces removed.Example: TRIM(VALUE("sourcefield1"))

UNIQUEFIELD(String colName, String value, String colValue)

This function sets the column with the column value and attribute with the unique field value and returns as an object.

Mapping: <TargetField> = UNIQUEFIELD(VALUE("Name"), VALUE("Id"), VALUE("Phone"))
In "Name" node, the "Id" value will be added as "uniquefield" attribute's value and the last attribute is returned as an object.

UPPER(String text)

This function converts all the character in a passed string to upper case.

Mapping: <TargetField> = UPPER(String)

Example1: String parameter

In this example, I will pass string as "search". The UPPER() function will return the string converted to lowercase. So "search" will be returned as "SEARCH" and that value will be placed in target field.

<TargetField> = UPPER("search")

Example2: Salesforce object fields

Trigger: Select Id, firstname, lastname from contact

The above query will retrieve Id, firstname and lastname from contacts object of Salesforce. You can use UPPER() function to get length of firstname or lastname. If the value of field firstname is "Avankia" then the resulting string returned by function will be "AVANKIA".

<TargetField> = UPPER(VALUE("FirstName"))

VALIDATEROW()This function returns true and is used only for validation of a rule section to check whether any conditon is satisfied

Example:

IF(ISEMPTY(VALUE("OpportunityId")),"true","false")

VALUE(String xPath)

This function converts the input parameter to be read as string.

MAPPING: TargetField = VALUE("SourceField")

Example: Salesforce object field
Trigger: Select Id, name from account

The above query will select ID and Name from Account object in Salesforce. You can use VALUE () function to map the VALUE of name field to target field.
TargetField = VALUE("Name")

VALUE(String xPath, boolean treatAsEmpty)This function converts the input parameter to be read as string.Example : Salesforce object fields
Trigger : select Id, name, account.name from opportunity

The above query will select ID, name and account name from opportunity object of Salesforce. You can use VALUE () function to map the lookup field account name to the target field.
<TargetField> = VALUE("Account/Name")
VALUEATTR(String xPath, String attr)This function takes a path and attribute name on it and returns the actual value of the attribute.Mapping: TargetField = VALUEATTR("CustomerRef","name")
  • No labels