CoreBOSBB
Date formatting in emails - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17)
+--- Forum: User Support (https://discussions.corebos.org/forumdisplay.php?fid=6)
+--- Thread: Date formatting in emails (/showthread.php?tid=723)

Pages: 1 2 3


Date formatting in emails - partnerwerk - 09-14-2017

The new global variable format for $EMail_CustomCurrentDate_Formatseems to work in email templates but not in Workflow email !?


These should be transformed in emails but are not:

Code:
$(general : (__VtigerMeta__) date)
$date_start

Actually any occurence of a date should be put out in the same format which $EMail_CustomCurrentDate_Format should define.

Best regards
Henning


RE: Date formatting in emails - joebordes - 09-14-2017

I didn't add it in workflows because there is already a way to get each part of the date there, no?


RE: Date formatting in emails - joebordes - 09-14-2017

Yes, here: format_date

Workflows are totally different, MUCH more powerful and the (near) future of templating email in coreBOS


RE: Date formatting in emails - partnerwerk - 08-16-2018

Could you please point out how I can use format_date in workflow emails?

I want to send an email with the appointment date in the subject line when the appointment is scheduled.

These do not work:
- format_date('d.m.Y', $date_start)
- $(format_date('d.m.Y', $date_start))
- $date_start(format_date('d.m.Y'))


RE: Date formatting in emails - joebordes - 08-16-2018

open the workflow editor (for example clicking on the vaue input in a condition), select expression and then format_date. You will see this syntax:

format_date(date,format)

if you select "date" and insert a field you will see

format_date(date_start ,format)

so this should be what you are looking for:

format_date(date_start ,'d.m.Y')

now, to put that in the body of a text you have to put it inside a WorkflowFunction meta-structure, like this:

$(general : (__WorkflowFunction__) '."format_date(date_start ,'d.m.Y') )

https://github.com/tsolucio/coreBOSTests/blob/master/modules/com_vtiger_workflow/VTSimpleTemplate.php#L252


RE: Date formatting in emails - partnerwerk - 08-16-2018

I am using this
$(general : (__WorkflowFunction__) format_date($date_start, "d.m.Y") )

but still get an error: Fatal error: Uncaught Exception: Was expecting a closing bracket in /.../modules/com_vtiger_workflow/expression_engine/VTParser.inc:132 Stack ...

I don't see a missing bracket.

This custom function works and seems to have the same structure:

$(general : (__WorkflowFunction__) __email_begruessung( $(cto_id : (Contacts) salutationtype), $(cto_id : (Contacts) lastname), $(cto_id : (Contacts) cf_833), $(cto_id : (Contacts) cf_836) ) )


RE: Date formatting in emails - joebordes - 08-16-2018

Have you tried with single quotes? all the examples I linked above seem to use those instead of double quotes


RE: Date formatting in emails - partnerwerk - 08-16-2018

You are right, but it is not enough.

This one works:
$(general : (__WorkflowFunction__) format_date($date_start,'d.m.Y') )

But only if I add a space after the final bracket. Maybe that is not intended? Took me a while to find out.

PS: Actually I even need to put a dot on the same line in order to preserve the empty space after the function. Otherwise soemthing gets stripped and the function is not executed with error message ”missing bracket”.


RE: Date formatting in emails - joebordes - 08-16-2018

It is rather hard to create a unique string inside a string that we can capture and process accordingly. If you look at the examples I sent in the link above you will see those spaces you are talking about.

Glad you got it working


RE: Date formatting in emails - partnerwerk - 08-17-2018

The Wysywig editor is cutting out these spaces in many cases. So adding a free space and a dot after a workflow function seems to be a safe way to get them processed. But there are some cases where a dot is annoying or misleading.

It also looks like it is impossible to have two functions on one line. When I break them up into two lines (with <p></p> tags for each) it works. When I have them on one line the second is just disappearing.