I need a simple way to show the user if they are on DEV or TEST.

I see the old "Environment Sticker" module in the Forge - but it is old and not compatible with v11.


Is there a built-in feature in OS v11 that does this that I am missing? I looked but maybe I missed it?

Sure seems a pretty common thing - ideally a floating UI sticker that shows DEV and TEST and nothing on PROD.

Hi Bruce, 

Well, one really easy way to do that is to put a label filled by a site property next to the application logo, on the theme webblock Header, saying 'DEV' or 'TEST'.   

Best Regards

Hi Bruce Buttles,



I have that solution.


Best regards,

PVN

Paulo Zacarias wrote:

Hi Bruce, 

Well, one really easy way to do that is to put a label filled by a site property next to the application logo, on the theme webblock Header, saying 'DEV' or 'TEST'.   

Best Regards


Right, but how is the best way to dynamically determine with environment that the code is running in?

Pedro Vila Nova wrote:

Hi Bruce Buttles,



I have that solution.


Best regards,

PVN

Pedro, that looks good - but - how did you do it? Did you mean to attached a snip of code?


Hi Bruce, 

The solution that Pedro showed is the one that I described. Correct me if I'm wrong Pedro.

Can I ask you why do you need to know dynamically the environment the code is running on?

Best Regards

Paulo Zacarias wrote:

Hi Bruce, 

The solution that Pedro showed is the one that I described. Correct me if I'm wrong Pedro.

Can I ask you why do you need to know dynamically the environment the code is running on?

Best Regards

Maybe I am missing something ... if I have a page that displays the "badge" ... how do I know to display DEV, TEST or nothing at all?

What Site Property do I look at to determine if it is DEV or TEST or PROD?

If I create a Site variable and simply put "DEV" in it ... it will always show DEV. What am I missing?


Hi Paulo and Bruce,


I use a Site.Property, to place a container at the Header, like Paulo said.



I show that "card" in DEV,QUAS, PRE-PROD.


You can use this CSS :


div.EnvironmentRibbon {
    font-weight: 500;
    font-size: 20px;
    line-height: 20px;
    width: 65px;
    left: -1px;
    top: 21px;
    padding: 5px;
    text-align: center;
    transform: rotateZ(-45deg);
    transform-origin: 50% 50%;
    position: absolute;
    color: #fff;
    background-color: #91ce5c;
}

div.EnvironmentRibbon\:before {
    content: "";
    border-right: 30px solid #91ce5c;
    border-top: 30px solid transparent;
    border-bottom: none;
    border-left: none;
    position: absolute;
    left: -29px;
    top: 0px;
    height: 0px;
    width: 0px;
}
div.EnvironmentRibbon:after {
    content: "";
    border-left: 30px solid #91ce5c;
    border-top: 30px solid transparent;
    border-bottom: none;
    border-right: none;
    position: absolute;
    right: -29px;
    top: 0px;
    height: 0px;
    width: 0px;
}


div.EnvironmentRibbon[env=DEV],
div.EnvironmentRibbon[env=DEV]:before,
div.EnvironmentRibbon[env=DEV]:after {
    background-color: #00A8C4;
    border-color: #00A8C4;
}


div.EnvironmentRibbon[env=QAS],
div.EnvironmentRibbon[env=QAS]\:before,
div.EnvironmentRibbon[env=QAS]\:after {
    background-color: #91ce5c;
    border-color: #91ce5c;
}


div.EnvironmentRibbon[env=PRE],
div.EnvironmentRibbon[env=PRE]\:before,
div.EnvironmentRibbon[env=PRE]\:after {
    background-color: #E84E26;
    border-color: #E84E26;
}


Best regards,
Pedro Vila Nova

Hi,


Can you check this forum,

https://www.outsystems.com/forums/discussion/37956/how-i-can-find-environment-name-devolopment-test-production/

you can also use the GetServerName()


Thanks,

Balu

Pedro Vila Nova wrote:

Hi Paulo and Bruce,


I use a Site.Property, to place a container at the Header, like Paulo said.



I show that "card" in DEV,QUAS, PRE-PROD.


You can use this CSS :


div.EnvironmentRibbon {
    font-weight: 500;
    font-size: 20px;
    line-height: 20px;
    width: 65px;
    left: -1px;
    top: 21px;
    padding: 5px;
    text-align: center;
    transform: rotateZ(-45deg);
    transform-origin: 50% 50%;
    position: absolute;
    color: #fff;
    background-color: #91ce5c;
}

div.EnvironmentRibbon\:before {
    content: "";
    border-right: 30px solid #91ce5c;
    border-top: 30px solid transparent;
    border-bottom: none;
    border-left: none;
    position: absolute;
    left: -29px;
    top: 0px;
    height: 0px;
    width: 0px;
}
div.EnvironmentRibbon:after {
    content: "";
    border-left: 30px solid #91ce5c;
    border-top: 30px solid transparent;
    border-bottom: none;
    border-right: none;
    position: absolute;
    right: -29px;
    top: 0px;
    height: 0px;
    width: 0px;
}


div.EnvironmentRibbon[env=DEV],
div.EnvironmentRibbon[env=DEV]:before,
div.EnvironmentRibbon[env=DEV]:after {
    background-color: #00A8C4;
    border-color: #00A8C4;
}


div.EnvironmentRibbon[env=QAS],
div.EnvironmentRibbon[env=QAS]\:before,
div.EnvironmentRibbon[env=QAS]\:after {
    background-color: #91ce5c;
    border-color: #91ce5c;
}


div.EnvironmentRibbon[env=PRE],
div.EnvironmentRibbon[env=PRE]\:before,
div.EnvironmentRibbon[env=PRE]\:after {
    background-color: #E84E26;
    border-color: #E84E26;
}


Best regards,
Pedro Vila Nova


Yes Pedro, that's exactly what I was suggesting. A simple label based on a site property does the job.

Best Regards


Hello 

Check the below documentation link

https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/outsystems.api.requestInfo_API#Example

The outsystems.api.requestInfo global object is defined for all OutSystems applications. 

This has a method GetEnvironmentName() that returns the name of the current environment. 

Perhaps you can use it to achieve what you need. 

Regards

Amal