2 followers Follow

Validating category field with text to show or not in calculation

I am trying to control how a customer is addressed in a Globiflow PDF based on whether their salutation is known or not.  I have a category field with the options of ("Mr.", "Mrs.", or "Mr. and Mrs.".  If none of the three are selected it means the customer's gender is unknown and the salutation needs to be left out, and only the "Full Name" used to address the client.

Basically, I am looking to concatenate the salutation (if it is known) with the "Full Name" field from a referenced item in another app (the Contacts app).

I have been able to get the functionality to work using the code listed below, but in Globiflow two carriage returns are added when the salutation is present , and I cannot figure out why.  Here is the code that I got to work but added unwanted carriage returns:

var sal = @Owner Salutation || ""
sal + @All of Full Name

I have also tried removing the line breaks by adding another calculation field and using this code: 
SalutationForGlobiflow= SalutationForGlobiflow.replace(/(\r\n|\n|\r)/gm,"");

I have been all over the internet searching for the solution - please help!

Rafe Redmond

Please sign in to leave a comment.

1 comment


Hi Rafe,

you get the line breaks cause there are HTML paragraph tags <p>Mr. John Doe</p>.
You can remove them in Globiflow in a custom variable: strip_tags([SalutationForGlobiflow]). Then put that variable into the PDF. 


Rainer Grabowski 0 votes
Comment actions Permalink