Cannot concatenate 'unicode' and 'int' objects : Error

When trying to give the body of an email I have the following code…

system.net.sendEmail(smtpProfile="SendInBlue", fromAddr="notification@ticketingsystemfyp.com", subject="Request Submission Confirmation", body="Hello," + self.session.props.auth.user.firstName + ", your Request ID is" + self.getSibling("lblHidden").props.text + ". Your request was submitted at " + now(0) + ".", html=1, to= self.session.props.auth.user.email)

and I am receiving the following error…
Error running action ‘component.onActionPerformed’ on UserPage@D/root/Button: Traceback (most recent call last): File " ", line 8, in runAction TypeError: cannot concatenate ‘unicode’ and ‘int’ objects

Blockquote

Is there something wrong with the syntax?

Try str(now(0)) instead.

Hi Kevin,

Still getting the same error

You sure you saved? Something in the body you are trying to concatenate is an int instead of string value. now(0) looked like the only obvious candidate to me.

I actually had lblhidden value as an integer and I changed that to string and saved but now I am getting this error…

Error running action ‘component.onActionPerformed’ on UserPage@D/root/Button: Traceback (most recent call last): File " ", line 8, in runAction NameError: global name ‘now’ is not defined

Oh, duh. now() is from the expression language; you are in scripting.

Use system.date.now().

1 Like

That worked, thanks Kevin.