Triggers

Root > 3. Customisation
Field Triggers
 
 
Field Triggers are setup in Admin | Site Settings | Advanced Field Functions | 
 
There are various types of function that are available, if your scenario is not described below then send an email to support @ wiredcontact.co.uk describing your requirements and we can take a look at it.
 
 
Parse Names [parameter list] To separate firstname, lastname and salutation from the names in a table, use:

parse names table="[table name]" namefield="[field name]" FirstNameField=[field name] LastNameField=[field name] SalutationNameField=[field name] limits="[sql clause]" debug

Parameter list information:
Table=[tablename]: The table to parse names in, the default would be the wce_contact table.
NameField=[field name]: The complete name field, default would be Contact for the wce_contact table.
FirstNameField=[field name]: The first name field, default would be firstname for the wce_contact table.
LastNameField=[field name]: The last name field, default would be lastname for the wce_contact table.
SalutationNameField=[field name]: The salutation field, default would be salutation for the wce_contact table.
Limits=[sql clause]: Limits the records that the parse names function is applied to.
Debug: To turn on logging in the WiredContact Errors.log file. Shows the SQL statement that is used.
Test: Use with Debug - if this parameter is included, the WiredContact Errors.log will show the debug information, but no records will be updated.

If a table other than the wce_contact table is specified, then the default values for the name/salutation fields will be those specified in the Table Defaults (Admin...Site Settings...Table Defaults)

 


Reset Timestamps This function will reset the timestamp fields specified in Admin...Site Settings...Misc Settings...Type Settings...History Type/Contact edit time stamps. Based on the most recent history entry that matches the appropriate history type, the specified time stamp fields are updated. If you want to change the History Field used, use a field=[field name] parameter. If you want to change the target table to something other than wce_contact, use a table=[table name] parameter.

Groom [tablename] [fieldname] This function will update the formatting for fields in the the database with an inappropriate format - for example, if you have a phone field that is a text(usage) field, and you want to change it back to a phone(usage) format - you would use:

groom wce_contact phone

and it will return the formatting of the field to match the field usage . This will work for Phone, Integer, Numeric, and Currency field usage types. If the target field is a text field, then it will strip leading and trailing spaces.


adjust [parameter list] This function will adjust specified date/time fields a specific number of minutes (adding or subtracting). For example, you may want to roll foreward certain activities by 1 day (1 day is 1440 minutes). The syntax would be:

adjust table=wce_activity field=starttime value=1440 operator="+" limits="(subject = 'Demo')"


random [parameter list] This function will put a formatted random number in the field specified. You may use a mask parameter to include text data. The mask parameter may contain <#field tags that will be resolved appropriately before the random number is generated.

For example, to randomly generate a password in the ClientPW field in the wce_contact table for contacts that have "Lead" in the ID/Status field, using a format of last name plus 4 random numbers - you would use the following:

random table=wce_contact field=clientpw mask="<#field field=lastname>####" digits=4 limits="idstatus = 'lead'"

which would produce results like:
Huffman0138 
Moore6125 
Nix8401


alpharandom [parameter list] This function will put a formatted random character string (a..z, 0..9) in the field specified. You may use a mask parameter to include text data. The mask parameter may contain <#field tags that will be resolved appropriately before the random number is generated.

For example, to randomly generate a password in the ClientPW field in the wce_contact table for contacts that have "Lead" in the ID/Status field, using a format of last name plus 4 random numbers - you would use the following:

alpharandom table=wce_contact field=clientpw mask="<#field field=lastname>####" digits=4 limits="idstatus = 'lead'"

which would produce results like:
Huffmanazav 
Mooreppvd
Nixusi7


sequence [parameter list] This function will put a formatted sequential number in the field specified. You may use a mask parameter to include text data. The mask parameter may contain <#field tags that will be resolved appropriately before the sequential number is generated.

For example, to generate account numbers in the AccountNumber field in the wce_contact table for Customers in order of the date the contacts were created, use:

sequence table=wce_contact field=accountnumber mask="NA######" digits=6 start=1000 limits="(IDStatus = 'Customer') and ((accountnumber is null) or (accountnumber = '')) order by createtime"

which would produce results like:
NA001000 
NA001001 
NA001002


date breakout [parameter list] This function will take the value in a date field, and break out the year, month, day and day of week values and put those in separate fields. Year, Month, Day and Day Of Week can go into Integer fields, and Day Of Week and Month can go into String fields. You need to specify one (or more) of six destination fields for year, month, day, day of week(integer), day of week(string) and month (string). The syntax would be:

date breakout field="[field name]" table="[table name]" limits="(month is null) or (month = 0)" dayfield="[day field]" monthfield="[month field]" yearfield="[year field]" dayofweekfield="[day of week field]" dayofweeklongfield="[day of week long/string field]" monthlongfield="[month long/string field]"

The long/string field values are taken from the long day/long month in the locale settings.

 


 

Add Feedback