Undesired Runtime Behavior


[EDIT]

Please note: none of the solutions so far have worked. Is it possible that it’s a bug?


Hey guys, I’m experiencing something weird. I’m placing password variable into the body of Send Outlook Mail Message activity. Everything works fine but the strange thing is that the value of password variable gets repeated two times, for absolutely no reason, at least not from my part.

Here’s the code for the body part:
"نام کاربری شما " & row("آدرس ایمیل").ToString().Split("@"c)(0) & " و رمز عبور موقت شما" & password & "می باشد. لطفا به سرعت وارد سیستم شده و رمز عبور خود را تغییر دهید. همچنین یک نسخه از فایل رزومه شما به پیوست ارسال می شود."

As you see, the occurrence of password itself is only one. I’ve even checked the value of password during the debugging session with the Immediate panel and it showed the correct value.

What needs to be done here? Thanks.

Replace & with + in the body of the email.

Regards,
Karthik Byggari

1 Like

Thanks @KarthikByggari. Can you explain why?

‘+’ is used to combine string in C# and VB.Net
& is used in VBA to combine strings.

Regards,
Karthik Byggari

in such case use STRING.FORMAT method like this
String.Format(“your string {0} your string {1}…string…”,row(“yourcolumnname”).ToString, password.ToString)

where {0} and {1} is the place holders that will take these two valus

Cheers @atoi

1 Like

It worked. But even Microsoft’s docs implied no major difference and even the difference you indicated!

Is it a weak language design or even a bug? Because that behavior doesn’t explain a clear logic behind this.

1 Like

The issue happened again although worked at first. Now even repeated more!

Did String.Format method helped us here
Cheers @atoi

No @Palaniyappan it did not. The output was the same.

String.Format("نام کاربری و رمز عبور شما به شرح زیر است. لطفا به سرعت وارد سیستم شده و رمز عبور خود را تغییر دهید. همچنین یک نسخه از فایل رزومه شما به پیوست ارسال می شود Username: {0} Password: {1}", row("آدرس ایمیل").ToString().Split("@"c)(0), password)

May I know what was the output from this expression
Cheers @atoi

The value of password is “abcabc”. When the activity run, it repeated the value multiple times, like “abcabcabcabc” or more, randomly.