Add Character / Word Counter to Snippet Writer

when sending out intro throguh linkedin for example it limits you to 300 characters, and if you want to have a usual snippet you send out you should have the char count tool already in the snippet maker

Thank for the feedback!

This probably isn't exactly what you are looking for, but you can use formulas to count characters in Text Blaze form fields. For example:

{formparagraph: name=message; cols=70; rows=5; default=The quick brown fox jumped over the lazy dogs.}
{note}
Characters: {=len(message)}
Characters excluding spaces: {=len(replace(message, " ", ""))}
{endnote}

1 Like

Here's a nifty little snippet I wrote today, inspired but this thread. The need was to give users guidance and help with writing Subject field content when creating new cases in Salesforce. The visible number of characters before Salesforce truncates the Subject contents is right about 70 characters or so. This number can vary depending on customer customization. The idea here is to allow the user to type their Subject contents, see the number of characters contained thus far, and the characters remaining. Once the characters remaining drops below 15, the counter format changes to bold & red. Once 0 us surpassed, an alert is triggered. Now, I chose to not block the snippet from completing of over 70 characters, because there is not a hard & fast rule in place governing the Subject field length. This is meant to gently nudge users into being more concise and to the point. Hope this helps!

Note...For some reason, the error function is not working in this post. In reality, it works perfectly.

{note: insert=no; preview=no; trim=right}
Variables:
{subject={=concat("General Inquiry - ",({=optional_info}))}}
{sublen={=len({=subject})}}
{endnote}
{note: preview=yes; trim=left}
Let's Create a New General Inquiry Case.

Is this a Campus or Online student? {formmenu: default=Make a selection; Campus; Online; name=campusoronline} {if: campusoronline="Make a selection"}{error: Must select Campus or Online!; block=yes; show=default}{endif}

Optional: Brief info to be appended to the Case Subject (example = "Housing Guide Link"):
{formtext: name=optional_info; default=; cols=47}
{if: optional_info<>""}Character Counter: {=sublen} {if: {=70-{=sublen}<15}}Characters Remaining: {=70-{=sublen}}{else}Characters Remaining: {=70-{=sublen}}{endif}{if: (70-{=sublen})<0} Try shortening the amount of optional info you are providing{endif}
{endif}
This will be your Case Subject: "General Inquiry{if: optional_info<>""} - {endif}{=optional_info}"

Detailed notes for Case Description:
{formparagraph: name=case_description; cols=47; rows=4; default=}
{endnote: trim=yes}

{note: insert=yes; preview=no; trim=right}
General Inquiry{if: optional_info<>""} - {endif}{=optional_info}{key: tab}
{=case_description; trim=yes}

{wait: delay=.1s}{repeat: 4}{key: tab}{endrepeat}{wait: delay=.3s}{if: {=campusoronline}=="Campus"}{key: a}{key: d}{key: m}{key: i}{key: s}{key: s}{key: i}{key: o}{key: n}{key: s}{key: space}{key: p}{key: e}{endif}{if: {=campusoronline}=="Online"; trim=left}{key: s}{key: t}{key: u}{key: d}{key: e}{key: n}{key: t}{key: space}{key: l}{key: i}{key: a}{key: i}{key: s}{key: o}{key: n}{key: s}{wait: delay=.3s}{endif}{wait: delay=.3s}{key: enter}{wait: delay=.3s}{repeat: 3}{key: tab}{endrepeat}{key: g}{key: e}{key: n}{key: e}{key: r}{key: a}{key: l}{key: enter}{wait: delay=.3s}{key: ctrl-s; mac=cmd-s}
{endnote: trim=left}

2 Likes

Cool, thanks for sharing! The {error} command is not showing in the preview because its show property is set to validate, which means that the error will only show after you submit the snippet (it will not show in the preview).

1 Like

Thank you @Gaurang_Tandon! I changed the error function to "default". Wish though that the preview could show how when the characters remaining drops below , the formatting changes to bold & red.