IF Command with Category
Hello,
I want to use a calculation to male a sales opportunity status=Closed if @sales Stage = Won and status = open for other sales stage values
The code I'm using seems to expect my calculation output to be a number: This code works
if(@Sales stage == "Won"){0}
else if(@Sales stage !== "Won"){1}
but I don't want my calculation output to be a number, I want a text field and code like this
if(@Sales stage == "Won"){'Closed'}
else if(@Sales stage !== "Won"){"Open"}
But this code gives an error message "Invalid "closed" string must be a number" How to get the calculation output as a string?
Thanks in advance
-
Hi Mike,
cause your first try had a number as result Podio saved this calculation field as number type (click on the field settings and you see it's number type). You can't change this type later. So you have to create a new calculation field. A tip: If you want to be sure that a calculation field is saved as text type put in only a text token like @title and save it. Then go back, delete the variable and create your javascript. Same if you want to be sure that it is saved as number type. Put in a token for a number field or if you don't have a number field in your app write: //@title; 1 and save it.
Rainer
-
Calculation fields output can be either number, date or string (text). The field type is determined when you FIRST save the field. You need to make sure your field is saved as text (not number). We usually enter whatever variable, then "TEMP", just to save as text. Then we enter the formula.
Please sign in to leave a comment.
Comments
3 comments