runScript works in window expression but not email expression?

Using 7.9.23.

I am tasked with making a report that gets emailed on a schedule per the report designer along with the feature that an admin can send one at any time manually.

To do this right I figured it was sensible to put the subject/body/filename calculations into functions so whether the scheduled report or admin is sending it manually, those things will be identical. My functions are simple -

def getSubject(endDateDT):
	return 'DPD Weeklies w/e %s'%(endDateDT)

def getBody():
	return "Colleagues,\n\nBelow are the project updates for the week.\n\nPlease feel free to reach out if you have any questions regarding the updates.\n\nThanks"

def getFileName(endDateDT):
	endDate =, 'yyyy-MM-dd')
	return 'DPD Weeklies Updates %s.pdf'%(str(endDate))

However, even my simplest one does not work inside the report schedule designer -

gives me

so then it sends me the actual text -

My hunch is since the reports/emails are gateway level it's not looking at my project script (because runScript('') does work as an expression binding of a text label) and so it cannot resolve my function name.

Anyone know what is going wrong here?

Probably needs to be in the shared script library to be accessed from a Gateway Scope. Probably also wouldn't work as an expression tag.



Unfortunately you're right still no luck even in a shared library.

I can hardcode it into these email parameters, it's just a pet peeve to have two sources of truth for me, one for if they send it manually via button press and another via the email scheduled.

It looks like I can probably leverage tags but I also don't like using them as intermediaries if I don't have to.

I don't see a zero polling value. runScript() might be waiting for a context that is never supplied.

1 Like

Doesn't seem to matter. Docs say that argument is optional. With or without it, I still get the WARN: Could not parse body text and it sends what is in the box raw ie I get runScript('shared.dpdresports.getBody()',0) in my email body.

Huh. Maybe that body entry field is just broken. Have you tried other functions or tag references?

Tag seems to work fine, as does a concatting tag values with a string in the expression.

Ohh, very interesting. I just tried runScript('') (with and without polling) in my body which works for a label text expression, but this too throws a WARN: Could not parse body text. Seems like this just does not work with or like runScript.

Try objectScript(), perhaps?