Email variable passing

I’m reading mail parts from excel, in the body section I need to pass the variables in some scenarios I need to pass 4 variable values or 5 or may be 1

Hi @kavitimoulika135

You cannot dynamically pass the variables to the Body of the mail. Instead of using concatenation pass all the variables. If the variable don’t have any value initialize it as empty. Then the value for that variable will be empty and it prints the value which variables have values.

Hope it helps!!


Here is the my body as attached image I’m reading sheet

Hi @kavitimoulika135 ,

You can try to use replace function.
After reading the mail body from Excel, store it in a string variable. Then, use the replace function to pass the variables, such as mailbody.Replace(“{0}”, firstValue).Replace(“{1}”, secondValue).

Regards,
Rashmi

@kavitimoulika135

Already {0},{1} these place holders are there

so just use string.format(yourstring,variable1,variable2)

it would be replaced like below

{0} - variable1
{1} - variable2

cheers

I’ve created resuable xaml for different scenarios but the above have 5 variable passing some time it may have 3 varible in the body or 1

@kavitimoulika135

you mean the value of the variables can be empty? if so just pass empty value to variable…the variabel can still be there

cheers

So here I need to pass 1 , if the body have {0}{1}{2}{3} so I need to pass 4 values …

@kavitimoulika135

you can pass an array…depending on how many and what value syou need the array can contain those avalues and those number of values

String.Format(String,Arrayvariable)

in first case create array with one value…and in another case create array with 4 values…that should sort your issue

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.