Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to implement if else in formula indicator?

Cyril Bagayan
Kilo Contributor

Hi Folks,

I was trying to do an if else in formula indicator but its not really working as intended.
The idea was that if a reference indicator = 0 then return 100 else proceed with the formula indicator1/indicator2.

Here's the formula:
var sla = [[indicator2]];
if(sla=0)
{sla = 100;}
{sla = ([[indicator1]]/[[indicator2]])*100;};
sla;

How can I implement this? Thanks

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Cyril Bagayan ,

you can use the condition to create formula indicator.

for ex:-

if ([[Count Of Incidents Indicator]] > 0) { [[1400]]/[[Count Of Incidents Indicator]]} else { 1440 }

 

find below article for more understanding about condition:-

https://community.servicenow.com/community?id=community_blog&sys_id=d84ea2addbd0dbc01dcaf3231f961963

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

View solution in original post

2 REPLIES 2

Community Alums
Not applicable

Hi @Cyril Bagayan ,

you can use the condition to create formula indicator.

for ex:-

if ([[Count Of Incidents Indicator]] > 0) { [[1400]]/[[Count Of Incidents Indicator]]} else { 1440 }

 

find below article for more understanding about condition:-

https://community.servicenow.com/community?id=community_blog&sys_id=d84ea2addbd0dbc01dcaf3231f961963

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Thank you so much Sandeep 🙂