Using a variable inside a text

In my process I am sending an email. In that email I will have standard text, along with a reference number that is stored as an argument or variable.

For example, “Your request for has been processed”.

I think I should be using + or ’ or both around the variable, but I can’t get it to work.
Can anyone let me know?

Thank you!!

1 Like

Yes you can use a variable insid a string with a method called format

Say if you have string variable like
Intext = “my name is JCH”
Here if you want to replace JCH with a variable…
You have to first make the intext like this
Intext = “my name is {0}”
Where {0} is the place holder where you are to pass the name as a variable…


Say you have a variable named of string type
Inname = “JCH”

NOW to place this inname variable in that place holder of intext we can do like this

Simple …try this and let know
Cheers @JCH

1 Like

Thanks for your response @Palaniyappan !
That’s different that what I was thinking. I will give that a try.
I thought that you can just put “text … {variable}… more text” in quotations as usual, and then inside that text surround your variable between + or ’ or something. Saves you having to create variables for every response type.

Here’s an example of what I was thinking. Except I can’t get it to work :slight_smile:

I hope this wont work …may be there must syntax correction to be made…like using double quotes with plus symbol on either side…
Cheers @JCH

Try doing something like this
“This is the reference number: “+variableName+” .”
The quotes should only go around the text, not the variable name.

I hope this helps

Did that work buddy… @JCH

You can also use &, for example:
"We could not process your request for " & referenceNumber & " because it was in an incorrect format."

1 Like

Thanks @Sharan75. I think what’s causing my problem is the enter in my text. When I remove the enter it’s fine. If I leave the enter, I get an error "String constants must end with a double quote.
Getting a bit precise, but I’d like it to be a nice format for the people to read this email.

It’s interesting because enters are fine if you don’t use any variables. But as soon as you add a variable, it comes up with an error: String constants must end with a double quote.

If I remove the enter, error goes away. Press enter, error comes back. Is that normal?

Thanks @Palaniyappan, I’m going to have multiple different emails going back to the users depending on what the situation is. Ideally I’d like to just be able to type that into the body section of the mail activity and avoid having to create a bunch of variables to cover each email text.

I appreciate your suggestion though.

1 Like

You saved my life. I was getting crazy.Thank you it is an important information.

Hi! Hope you guys can help me. I have a similar case where I am calling a variable within a text body of an email. I’m using the syntax: “This is a " +variable+ " in this sentence.”

When I assign a static value in the variable (of type TEXT), it puts in the value. But when I assign the variable’s value via Get Text, it doesn’t put the value when the variable is called in the email body. I tried returning the value via Log Message and it puts in the value but when I call the variable in the email body, it returns nothing.

Appreciate if you can help me with a solution? Thanks!

@JCH, @Palaniyappan, @Sharan75