Special - Button, Special - Browser Script, Special - MSWord Merge, and Special - Web Page View custom fields support advanced configuration beyond their basic settings in SmartSimple. A Special - Button custom field opens a target page in a modal window, a new tab, or the same window. A Special - Browser Script custom field totals the values of a dynamic custom field. A Special - MSWord Merge custom field creates a Word document from a Word template and SmartSimple data. A Special - Web Page View custom field can append stored PDF documents to its output, generate a PDF automatically, or enable editing for minor formatting corrections before the document is generated. For more information, see Custom Fields: Special Control Types Settings Reference.
Who: Global administrators
When to Use Special Control Type Custom Fields
Use special control type custom fields when:
- A special control field needs behavior beyond its basic settings.
- A Special - Button custom field fits a record that needs a button to open a profile, a grid, or a new record.
- A Special - Browser Script custom field fits a form that must total repeated values.
- A Special - MSWord Merge custom field fits a record that needs a Word document generated from a template.
- PDF attachment, automatic PDF generation, and one-time formatting edits fit a Special - Web Page View custom field used to produce documents.
Create a Special - Button Custom Field
A Special - Button custom field opens a target page in the same window, a new tab, or a modal window when it is activated.
To create a Special - Button custom field:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the Field Type field and select Special - Button from the drop-down menu.
- Click the Caption field and enter the applicable information.
- Locate the URL field and click the URL Lookup [binoculars] icon.
- A URL Lookup modal will open.
- Enter the relevant information in the URL Lookup modal, and click Apply.
- Locate the Open in field and click the applicable option.
- Click Main Window to open the object and replace the current content.
- Click Modal Window to open the object in an overlay above the current content.
- Click New Tab to open the object in the Tab Bar at the bottom of the page.
- Click the Confirmation Message field and add text to present a custom message before the target opens.
- For example, a message is appropriate when the button redirects the user away from a page that may have unsaved changes.
- This field is optional.
- Locate the Display Section and the Caption Location field and click the applicable option.
- Click No Caption to align the button to the left of the record without a caption.
- Click the Button Label field and add the text to appear on the button.
- Click the Icon Style field and select a style from the drop-down menu.
- This field is optional.
- Click the Icon field and select the applicable icon.
- Icons are positioned to the left of the button label text.
- This field is optional.
- Click the Tool Tip or Instructions field and enter the applicable information to provide additional context.
- These fields are optional.
- These fields are optional.
- Click the Permissions & Availability tab and set the applicable permissions, and then click Save.
Sum a Dynamic Custom Field with a Special - Browser Script
Summing a dynamic custom field requires three custom fields: a Text Box - Text Single Line custom field to store the total, a Special - Browser Script custom field to run the calculation, and the Dynamic Data - Dynamic Control Field being totaled. Place two of the fields before the dynamic custom field, using a smaller display order, and place the third field within the dynamic custom field. For example, if the dynamic custom field has a display order of 2050, the two preceding fields must use a smaller display order, such as 2045 and 2047.
Create a Text Box Custom Field
To create a Text Box - Text Single Line custom field:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the Field Type field and select Text Box - Text Single Line from the drop-down menu.
- This field stores the total. Note its Field ID, which appears in the List View on the Custom Fields page.
- This field stores the total. Note its Field ID, which appears in the List View on the Custom Fields page.
- Complete the applicable fields, and then click Save. See the Special - Browser Script section in Custom Fields: Special Control Types Settings Reference.
Create a Special - Browser Script Custom Field
To create a Special - Browser Script custom field:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the Field Type field and select Special - Browser Script from the drop-down menu.
- Click the Custom Script field and add the following script.
- Replace xxxxxx with the Field ID of the Text Box - Text Single Line custom field.
//Set the field that stores the total to read only
document.frmevent.cf_xxxxxx.readOnly=true;
//Take the value of the passed in field and add it to the total sum.
function addTotal(valuetxt,index)
{
// if the index is equal to 1 then reset the sum value to zero
if (index == 1 )
document.frmevent.cf_xxxxxx.value=0;
//update the value
document.frmevent.cf_xxxxxx.value = parseFloat(document.frmevent.cf_xxxxxx.value) + parseFloat(valuetxt);
}- Complete the applicable fields, and then click Save. See the Special - Browser Script section in Custom Fields: Special Control Types Settings Reference.
Edit the Dynamic Data - Dynamic Control Custom Field
To edit the Dynamic Data - Dynamic Control custom field:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the edit [pencil] icon next to the Dynamic Data - Dynamic Control Field.
- Create a new sub field, click the Field Type field, and then select Special - Browser Script.
- Click the Custom Script field and add the following script.
- Replace xxxxx1 with the Field ID of the dynamic custom field, and replace xxxxx2 and xxxxx3 with the Field IDs of the fields to total.
var expenseCF = new Array('cf_xxxxx1', 'cf_xxxxx2', 'cf_xxxxx3');
var i = 0;
var number = eval("document.frmevent."+ expenseCF[0] + ".value;");
number = parseInt(number);
for (i = 1; i <= number; i++)
{
var valuetxt = eval("document.frmevent."+ expenseCF[i] + ".value;");
if (valuetxt != undefined)
{ //Call the function addTotal so that it adds the sum together
addTotal(valuetxt,i);
}
}Configure a Word Merge
Configuring a Word merge involves three steps: create the Word document with the merge fields, upload the Word template to a SmartFolder, and create a Special - MSWord Merge custom field.
Add Merge Fields to a Word Template
A merge field is a placeholder in a Word template that SmartSimple replaces with SmartSimple data when a user generates the document.
To add a merge field to a Word template:
- Open the template in the desktop version of Microsoft Word, and place the cursor where the merge field should display.
- Click the Insert tab.
- Click Quick Parts and select Field from the drop-down menu.
- Locate the Field names list and click MergeField.
- Click the Field name field and enter a name for the merge field.
- Click OK. The merge field displays in the document.
- Repeat these steps for each merge field in the template.
Take note of each merge field name. Enter these names in the Values field when you create the custom field. See Create a Special - MSWord Merge Custom Field.
Upload a Word Template to a SmartFolder
To upload the Word template document to a SmartFolder, see the Upload Files to a Folder section of the Set Up and Manage SmartFolders article.
Create a Special - MSWord Merge Custom Field
A Special - MSWord Merge custom field creates a Word document from SmartSimple data when a user clicks the field's button on a record.
To create a Special - MSWord Merge custom field:
- Create a new custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the Field Type field and select Special - MSWord Merge from the drop-down menu.
- Click the Values field and add the merge field mappings in the following format:
Mergefield=@SmartSimple field name@;
- Replace Mergefield with the merge field name from the Word template, and replace the SmartSimple field name with the applicable SmartSimple field name or Field ID.
- Add each mapping on a separate line, and end each line with a semicolon.
- The order of the lines does not matter because each variable is matched using the merge field name. The exception is when variables are merged to a Word table. The table references must be at the bottom of the list of values.
- Click the Custom Field IDs field and select the associated field from the drop-down menu.
- Click the Folder Type field and select Folder from the drop-down menu.
- Locate the Folder/File field, click the Lookup [binoculars] icon, and click the SmartFolder that was uploaded in the Upload a Word Template to a SmartFolder section.
- Locate the Display section and click the Button Label field and add the text to appear on the button.
- If no text is entered, the system uses the default label. For Word Merge fields, the default label is Open.
- Complete the remaining applicable fields, and then click Save.
HTML code can be embedded within tags in a value, and the formatting is applied before the value is merged into the Word document. HTML works only when merging a single record, not in batch mode.
Generate a Document with Merge Fields
A Special - MSWord Merge custom field generates a Word document from SmartSimple data when a user clicks the field's button while viewing or editing a record.
To generate a document with a Special - MSWord Merge custom field:
- On the record, click the relevant button for the Special - MSWord Merge custom field.
- The button displays the text entered in the Button Label field, or Open if no text was entered.
- If a Folder ID was specified in the custom field settings, a prompt asks which document to use. Select the applicable document.
- SmartSimple dynamically creates the document and adds the SmartSimple data.
Attach PDFs to a Web Page View Custom Field Output
A Special - Web Page View custom field can append one or more PDF documents, stored in a file field or SmartFolder, to its output using ssattach. Attached PDFs appear only when the output is generated as a PDF, and they do not appear in HTML preview mode.
To attach a PDF to the output:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the Field Type field and select Special - Web Page View from the drop-down menu.
- Locate the HTML Template field and click SmartFields Sample Template.
- Add an ssattach tag where the PDF should appear, setting the position to before or after and the location to a SmartFolder path, a single file custom field, a multiple files custom field, or a parent field reference.
- Complete the remaining applicable fields, and then click Save. See the Special - Web Page View section in Custom Fields: Special Control Types Settings Reference.
Example
The following tag appends a SmartFolder PDF before the Web Page View custom field content:
<!--@ssattach(before;/files/1234/123/myfile.pdf)-->
Example
The following tag appends a PDF from a single file custom field named AttachPDFFile:
<!--@ssattach(before;@AttachPDFFile.value@)-->
Edit a Web Page View Custom Field Output
A Special - Web Page View custom field can include an editing option that provides an editable, simplified version of the output for one-time formatting or text corrections before the document is generated.
Enable Edits on a Web Page View Custom Field from a UTA/Module
To enable editing on a Special - Web Page View custom field for a UTA/module:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the edit [pencil] icon next to the applicable Special - Web Page View custom field.
- Locate the Document section, toggle Enable Editing on, toggle Open Directly as PDF off, and click Save.
Enable Edits on a Web Page View Custom Field from Global Settings
To enable editing on a Special - Web Page View custom field from Global Settings:
- Navigate to the relevant custom field. See the Access the Configuration Page for Custom Fields section of the Configure Custom Fields article.
- Click the edit [pencil] icon next to the applicable Special - Web Page View custom field.
- Locate the Document section, toggle Enable Editing on, toggle Open Directly as PDF off, and click Save.
Make Edits on a Web Page View Custom Field Output
Editing must be enabled for a Special - Web Page View custom field before its output can be edited directly from the record, prior to generating the document.
To edit a Special - Web Page View custom field output:
- On the record, click the relevant button for the Special - Web Page View custom field.
- Special Web Page View custom fields typically appear as buttons. The caption entered in the field settings becomes the button name.
- Click the Edit button in the top-left corner.
- A rich text editor opens.
- Modify font styles, text size, spacing, and other formatting options as needed.
- Click Preview to review the changes before generating the document.
- Click the relevant button to save the edited Web Page View custom field as a PDF or DOCX.
- The generated PDF or DOCX can be exported.
- The generated PDF or DOCX can be exported.