Custom Value Formatting: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 22: Line 22:
When you have navigated to the object list view, you can click on the “New” button which will display the new record form. What is important here is that you give the Value Formatter a unique name that has no spaces or special characters. Don’t worry about enforcing this rule yourself, we have built a salesforce validation rule to make sure that the name of the Value Formatter is compliant with 3B Docs.
When you have navigated to the object list view, you can click on the “New” button which will display the new record form. What is important here is that you give the Value Formatter a unique name that has no spaces or special characters. Don’t worry about enforcing this rule yourself, we have built a salesforce validation rule to make sure that the name of the Value Formatter is compliant with 3B Docs.


To use the newly created Value Formatter with your template, you need to navigate to a Template record, load the editor, add a merge tag (TODO: Reference to Merge Tags) and click on the merge tag. From the options list, select the value formatter that you want to apply to the merge tag. The merge tag will be transformed from say <code>{Contact.Id:CreatedDate}</code>to <code>#{Contact.Id:CreatedDate>EU_Date_Format}</code> . This arrow right chevron indicates that the merge tag is to be formatted by the Value Formatter with the same name immediately after the chevron.
To use the newly created Value Formatter with your template, you need to navigate to a Template record, load the editor, add a merge tag (TODO: Reference to Merge Tags) and click on the merge tag.  
[[File:Adding Value Formatter.png|thumb|Adding Value Formatter]]


(TODO: Add image of selecting a value formatter)
 
From the options list, select the value formatter that you want to apply to the merge tag. The merge tag will be transformed from say <code>{Contact.Id:CreatedDate}</code>to <code>#{Contact.Id:CreatedDate>EU_Date_Format}</code> . This arrow right chevron indicates that the merge tag is to be formatted by the Value Formatter with the same name immediately after the chevron.


== Syntax ==
== Syntax ==
Line 61: Line 63:


=== API Callouts ===
=== API Callouts ===
You can use Function Expressions to do callouts, fetch data externally, load additional resources, use JavaScript Libraries such as FullCalendar (TODO: Reference), ChartsJs (TODO: Reference, JS Tables (TODO: Add reference)<syntaxhighlight line="1">
You can use Function Expressions to do callouts, fetch data externally, load additional resources, use JavaScript Libraries such as [https://fullcalendar.io/ FullCalendar], [https://www.chartjs.org/ Chart.js], [https://datatables.net/ Datatables] and many more..<syntaxhighlight line="1">
var getJSON = function(url, callback) {
var getJSON = function(url, callback) {
     var xhr = new XMLHttpRequest();
     var xhr = new XMLHttpRequest();
Line 87: Line 89:
});
});
</syntaxhighlight>
</syntaxhighlight>
[[File:FullCalendarJs.png|thumb|Full Calendar JS library]]
[[Category:3B Docs Features]]
[[Category:3B Docs Features]]