Determine environment in a timer
Question

I have a timer set to run on a particular day and time. Since the code and time are published in Dev, Test and Prod, the timer actually runs once in each environment. In order to ensure recipients are not receiving emails generated 3 times, I only want to send if in PROD. 

For my applications, when I need to determine environment, I use GetRequestDomain(). As this is not available when a timer is ran, I tried using GetServerName() but it is empty. 

I also used GetMachineName() but that is the actual server name and I would prefer not to base my logic on a machine name that could change. 

Is there something equivalent to GetRequestDomain() that provides a static domain value? If not, is there some way to have an environment variable (not a site variable in an application as this would not solve the issue due to the same value in all environments after publish/deploy).


Thank you,

David

Tivity,

It does work across all environments. The Site Property can be changed per environment in Service Center. See the attached ScreenShot.

To get the Site Property in another eSpace, all that is needed is a function created in the eSpace where the site Property is that returns the value stored (that changes per Environment).

Thanks

teste.png

Hello @Tivity Health,

A really easy solution is to create a Site Property [Environment] and set the variable in service center to DEV, QAS and PRD (respectively in each service center)

This way, you can easily check the environment the timer is running by checking the Site Property.

Regards,

FRamires

Thank you for the response Filipe but site property will not work across the environment. A site property is per Espace and I am looking for a way to determine in a timer that is in another espace what the environment currently is. I don't want to have to put this site config in every Espace.


David

Tivity,

It does work across all environments. The Site Property can be changed per environment in Service Center. See the attached ScreenShot.

To get the Site Property in another eSpace, all that is needed is a function created in the eSpace where the site Property is that returns the value stored (that changes per Environment).

Thanks

teste.png

Thank you for the additional information. I see what you were saying and I was wrong in my original assumption. This should solve the issue. 


Thank you!

mvp_badge
MVP

Hi Tivity Health,

As I understand it you just want to run the timer in production, in this case, have you considered keeping the timer active only in PROD?

You can do in Service Center by Environment:

Regards.

Hi Tivity,

I believe your problem should be solve at the environment configuration level, recipients should not receive emails from DEV or TEST environments. 

For that you can configure a mailing list in service center:

Regards,

Rúben

I am using our internal Email service which is access via API and not a configuration in Outsystems, so this would not have any bearing on the issue.

I am trying to determine environment as I will use the solution for other areas where I only want to perform actions in a particular environment, not just sending of emails.

David

That is interesting and I was not aware of the ability to deactivate, but my intention is keep the timers running in all environments but not send emails in lower environments. This is why I am trying to determine which environment the timer is executing in.


David

Please see my response above, it should do what you need :) 

mvp_badge
MVP

Hi Tivity,

See this component.

Hope it's help.

Regards.

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