How to insert more fields in email templates
With the following command, you can add more fields than offered by default when editing an email template (I have found those for a deal) (I was originally trying to add products of a deal as a field in an email but failed) :
const fieldsToTest = [
{ key: "org_name", label: "Organization Name" },
{ key: "title", label: "Deal Title" },
{ key: "value", label: "Deal Value" },
{ key: "status", label: "Deal Status" },
{ key: "owner_name", label: "Owner Name" },
{ key: "formatted_value", label: "Formatted Deal Value" },
{ key: "currency", label: "Currency" },
{ key: "expected_close_date", label: "Expected Close Date" },
{ key: "close_time", label: "Close Date" },
{ key: "add_time", label: "Add Time" },
{ key: "update_time", label: "Update Time" },
{ key: "pipeline_id", label: "Pipeline ID" },
{ key: "products_count", label: "Products Count" },
{ key: "label", label: "Label" },
{ key: "followers_count", label: "Followers Count" },
{ key: "visible_to", label: "Visible To" },
{ key: "notes_count", label: "Notes Count" },
{ key: "done_activities_count", label: "Done Activities Count" },
{ key: "weighted_value", label: "Weighted Value" },
{ key: "stage_id", label: "Stage ID" },
{ key: "probability", label: "Probability" },
{ key: "files_count", label: "Files Count" },
{ key: "email_messages_count", label: "Email Messages Count" },
{ key: "activities_count", label: "Activities Count" },
{ key: "undone_activities_count", label: "Undone Activities Count" },
{ key: "participants_count", label: "Participants Count" },
{ key: "channel", label: "Channel" },
{ key: "origin", label: "Origin" },
{ key: "rotten_time", label: "Rotten Time" },
{ key: "stage_change_time", label: "Stage Change Time" },
{ key: "lost_reason", label: "Lost Reason" },
{ key: "local_close_date", label: "Local Close Date" },
{ key: "stay_in_pipeline_stages", label: "Stay in Pipeline Stages" },
{ key: "age", label: "Age" },
{ key: "average_stage_progress", label: "Average Stage Progress" }
];
// Insert plain text label + field with line breaks
fieldsToTest.forEach(field => {
// Insert the plain text label
document.execCommand("insertHTML", false, <div style="font-weight:bold;">${field.label}:</div><br>);
// Insert the field input
document.execCommand("insertHTML", false,
<input type="text"
data-pipefield="deal"
data-pipefieldname="${field.label}"
data-pipefieldkey="${field.key}"
dir="auto"
disabled="true"
value="${field.label}"><br><br>);
});
To run this command, open the template you want to edit, right click, inspect, console, copy the command in the console and press enter, it should add the fileds in your template .