I am making a GET API call, but the ID for the call needs to be dynamic (based on what email is logged in).
Now, I have a great way to make the formula in the program where I make the GET call to.
The formula is basically “if emailadress = emailA, then return ID 1, if emailadress = emailB, then return ID 2”.
As I get multiple new emails everyday, the formula updates automatically.
So, my plan is to make the ID variable in the GET call an imported value as well (with a GET call). Like described below:
This ID formula is uploaded successfully as an app variable.
Then, the ID for the GET call is based on that app variable.
The formula renders fine. Though, the ID is obviously not calculated correctly (due to the fact that the iD is not rendered well for the GET record). The AuthenticationFormula is in text form.
When I type a light version of this formula in the ID field, it all works fine.
Can somebody help me out here?
Hmm I’m not sure I understand completely. So you are able to get the correct ID for each email in the Get Record Authentication and set it to the app variable
AuthenticationFormula. Then you try to make another GET with
AuthenticationFormula? Where does it go wrong, what do you mean by
the ID is obviously not calculated correctly (due to the fact that the iD is not rendered well for the GET record)
So the authenticationformula variable is set correctly.
Then, the authenticationformula is used as input to ‘calculate’ the ID that must be used for the GET call.
I use ‘calculate’, as the authenticationformula is set as a formula (IF email = A, then return ID A etc etc).
Though, the calculation does not seem to work…
Alright, what does the formula look like, can I get a screenshot of it? If there’s some personal/sensitive information like emails you can block or blur those out.
it’s a huge formula though, but this is what it looks like (shortened form):
Don’t worry, emails are not real
Hmm seems simple enough, there’s a couple of things to check:
- Are there any errors or warnings in the formula editor?
- Are there any issues with data types, e.g. should you use
2 instead of
"2" in your formula?
- Are you sure the
appVars.currentUser.email has a value, or is it coming up as
undefined for some reason?
I just checked: using “2” or 2 does not matter
I checked this out too related to the other thread we have going on, and now I understand better. So you have put the formula in the value of the app variable, which means that now the value of the app variable is just the formula in text form. The formula editor does not recognize this as a formula, it just thinks this is the value of the app variable and sees it as text. The way to get it working is to set that formula directly in the formula editor, not binding it through a variable.
However I would highly recommend storing the id alongside with the user object, that way you can access it as easily as the email