123
Views
4
Comments
Solved
Set log content property of send email widget dynamically
Question

The "Log Content" property of the "Send Email" widget can only be set to either "Yes" or "No" in design time. It would be desirable to set this property dynamically via a Site Property so that it can be set via Service Center without the need to modify the source code every time just to set the logging on or off. 


This way one could set the property to either true or false per environment (Development, Test, or Production). It is desirable to have the email logging switched on for the Development- and Test-environments but not for the Production-Environment.


Can this be done dynamically?

2020-05-07 18-53-00
Rui Barradas
 
MVP
Solution

Hello Chris,

Why don't you use an If widget (based on a Site Property) and 2 Send Email widgets?

Something like this:


Basically, you have a Site Property called LogContent (boolean) or something similar. If it is true, you call the SendEmail widget with the Log Content set to Yes. If not, you call the SendEmail widget with the same variables, but with the Log Content property set to No.


Kind regards,

Rui Barradas

UserImage.jpg
Christiaan Hendrik Hamersma

Rui Barradas wrote:

Hello Chris,

Why don't you use an If widget (based on a Site Property) and 2 Send Email widgets?

Something like this:


Basically, you have a Site Property called LogContent (boolean) or something similar. If it is true, you call the SendEmail widget with the Log Content set to Yes. If not, you call the SendEmail widget with the same variables, but with the Log Content property set to No.


Kind regards,

Rui Barradas

 Thanks Rui,


This was my intent as well however, as far as I know, the "Log Content" property can only be set to either "Yes" or "No" values in design time. At least this is the case in OutSystems 10.

Another approach would have been to include an 

if(SiteProperty = True, Log Content = "Yes", Log Content = "No") 

but the property only allows values "Yes" or "No".


Best wishes,

Chris

 

 

UserImage.jpg
Christiaan Hendrik Hamersma

Chris Hamersma wrote:

Rui Barradas wrote:

Hello Chris,

Why don't you use an If widget (based on a Site Property) and 2 Send Email widgets?

Something like this:


Basically, you have a Site Property called LogContent (boolean) or something similar. If it is true, you call the SendEmail widget with the Log Content set to Yes. If not, you call the SendEmail widget with the same variables, but with the Log Content property set to No.


Kind regards,

Rui Barradas

 Thanks Rui,


This was my intent as well however, as far as I know, the "Log Content" property can only be set to either "Yes" or "No" values in design time. At least this is the case in OutSystems 10.

Another approach would have been to include an 

if(SiteProperty = True, Log Content = "Yes", Log Content = "No") 

but the property only allows values "Yes" or "No".


Best wishes,

Chris

 

 

 Sorry Rui,


I misunderstood your prior comment and solution. You are absolutely right. Add an additional Email Widget and set it to "Yes" or "No" depending on the value of the site property.


Great idea, thanks Rui. This will work.


Best wishes,

Chris

 

2020-05-07 18-53-00
Rui Barradas
 
MVP

Exactly Chris :)

In this case, you will have 2 Send Email widgets (one with Log Content set to Yes and another with Log Content set to No) and the Site Property will control which one is going to execute :)


Glad that I could help you!


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.