If there is no functionality that already does this, my suggestion is a bit more complex. It would be to create a query in the database returning all the fields of the form other than empty and use this information in the body of the email or even copy this return to the event description field.
A while ago I created an automation to update the event's rich_remarks.
1 - create an additional variable for remarks in the action config
["AV_EVENT_DESC"] = "event.remarks", -- new event Desc
2- Create the automation to update the remarks field
C:\Axios\Automations\assystLua_Atualiza_Desc_Cust_Field\Atualiza_Desc_Cust_Field_Config.lua
3 - Call the automation in the action rule
{
[[ Updates the description field with the information from the custom fields of the informed offers]],
[[ ACT_TYPE_SC == "ASSIGN" and ACT_TYPE_COUNT == 1 and AV_SERVICE_OFF_SC == "SERVICE NAME"]],
[["C:\Axios\Software\SmartMail\send_email.exe" -v -config "C:\Axios\Automations\assystLua_Atualiza_Desc_Cust_Field\Atualiza_Desc_Cust_Field_Config.lua" ACT_REG_ID=$ACT_REG_ID EVENT_ID=$EVENT_ID AV_SERVICE_OFF_SC=$AV_SERVICE_OFF_SC ]], "continue" }, in smartmail
exemplo sql:
STRSQL1 = (([
SELECT
jwcpc.entity_id AS INC_ID
,jwcp.jptsys_web_cust_prop_sc
,fd.field_definition_sc
,CASE
when jwcp.jptsys_web_cust_prop_sc=' ' then jwcp.jptsys_web_cust_prop_n else fd.field_definition_n end TITULO_FIELD
,CASE
WHEN jwcpc.web_cust_prop_type='s' THEN jwcpc.string_value
WHEN jwcpc.web_cust_prop_type='n' THEN jwcpc.string_value
WHEN jwcpc.web_cust_prop_type='i' THEN TO_NCLOB(jwcpc.integer_val)
WHEN jwcpc.web_cust_prop_type='r' THEN TO_NCLOB(jwcpc.decimal_val)
WHEN jwcpc.web_cust_prop_type='b' THEN jwcpc.string_value
WHEN jwcpc.web_cust_prop_type='d' THEN TO_NCLOB(TO_CHAR(jwcpc.date_val, 'DD/MM/YYYY'))
WHEN jwcpc.web_cust_prop_type='o' THEN TO_NCLOB(jwld.jptsys_web_lkup_data_n)
WHEN jwcpc.web_cust_prop_type='m' THEN jwcpc.string_value
WHEN jwcpc.web_cust_prop_type='c' THEN jwcp.formatted_desc
WHEN jwcpc.web_cust_prop_type='l' THEN TO_NCLOB(jwcpc.LOOKUP_VAL_ID)
WHEN jwcpc.web_cust_prop_type='l' AND jwcp.lookup_table_id = 143 THEN TO_NCLOB(i2.item_n)
WHEN jwcpc.web_cust_prop_type='l' AND jwcp.lookup_table_id = 49 THEN TO_NCLOB(u2.usr_n)
ELSE jwcpc.string_value
END AS VALOR
,jwcpc.*
FROM
jptsys_web_cust_prop_cont jwcpc --ON jwcpc.entity_id = i.incident_id
LEFT JOIN jptsys_web_cust_prop jwcp ON jwcp.jptsys_web_cust_prop_id = jwcpc.jptsys_web_cust_prop_id -- algums campos forma migrados para field_definition
LEFT JOIN field_definition FD ON FD.field_definition_id=jwcp.jptsys_web_cust_prop_id
LEFT JOIN item i2 ON i2.item_id = jwcpc.LOOKUP_VAL_ID
LEFT JOIN usr u2 ON u2.USR_ID = jwcpc.LOOKUP_VAL_ID
LEFT JOIN jptsys_web_lkup_data jwld ON jwcpc.single_sel_val_id = jwld.jptsys_web_lkup_data_id
WHERE
jwcpc.entity_id <> 0 AND ancestor_ent_type = 'c'
and ( CASE WHEN jwcpc.web_cust_prop_type='s' THEN jwcpc.string_value WHEN jwcpc.web_cust_prop_type='n' THEN jwcpc.string_value WHEN jwcpc.web_cust_prop_type='i' THEN TO_NCLOB(jwcpc.integer_val) WHEN jwcpc.web_cust_prop_type='r' THEN TO_NCLOB(jwcpc.decimal_val) WHEN jwcpc.web_cust_prop_type='b' THEN jwcpc.string_value WHEN jwcpc.web_cust_prop_type='d' THEN TO_NCLOB(TO_CHAR(jwcpc.date_val, 'DD/MM/YYYY')) WHEN jwcpc.web_cust_prop_type='o' THEN TO_NCLOB(jwld.jptsys_web_lkup_data_n) WHEN jwcpc.web_cust_prop_type='m' THEN jwcpc.string_value WHEN jwcpc.web_cust_prop_type='c' THEN jwcp.formatted_desc WHEN jwcpc.web_cust_prop_type='l' THEN TO_NCLOB(jwcpc.LOOKUP_VAL_ID)WHEN jwcpc.web_cust_prop_type='l' AND jwcp.lookup_table_id = 143 THEN TO_NCLOB(i2.item_n) WHEN jwcpc.web_cust_prop_type='l' AND jwcp.lookup_table_id = 49 THEN TO_NCLOB(u2.usr_n) ELSE jwcpc.string_value END) is not null
and jwcpc.entity_id =]] .. EVENT_ID .. (j --ID do evento
]])
then just concatenate everything into a single variable and run it in rich_remacks
I will try this and come back with any issues. Thank you
Hi
If you're using Email Actions, or planning to use them to create emails, I believe you might have an easier time creating, adapting, and maintaining them by using a combination of Action Templates and Substitution Keywords, rather than the SQL route.
By using action templates to generate the body, and pass that to SmartMail, or migrate to use Rule-based Notifications you could leverage Extended Keyword Notations to populate the event emails.
While I haven’t had much time to test 25R1 yet the wiki does have examples of using Extended Keyword Notations and Velocity Templating Language (VTL) for this purpose. I’ve also taken note of the 25R1 addition of the formModel keyword in VTL, which seems to make it easier to iterate over all the content in an event form. I haven’t tested this myself, but based on the wiki examples, it should be possible to use these form examples to get a grasp of the structure, and then make a substitution keyword that has an conditional logic to an for each
part so that only fields with a value are included in a final email.
By wrapping all of this in a single, or a selective set of Substitution Keywords, you could create a reusable template without needing to maintain complex SQL.
That said, this is based on my reading of the wiki, so apologies if I’ve oversimplified anything. If anyone has more information to share on this topic, I’d really appreciate it!
Best regards,
Richard
Thanks for the reply Richard. We are using 11.5 at the moment, upgrading to 11.9.
We’ve only ever used Smartmail so Email Actions might be a route. Maybe I’ll have to learn how to do it that way.