- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 27, 2022 06:29 AM
Hey Guys, Im sure there is a very simple answer here but i am very knew to javascript in general, i appreciate any insight anyone can give me. I am using the airtable script function to post new users to an external application via it's rest api. I am successfully able to create the new user but i wish to record the ID number that is returned in the call back, i would like to use this in later steps in the air table automation but cannot get output.set to work. My script looks like so
How do i properly add output.set for the ID returned in response?
Appreciate any insight HUGE! Thankyou
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 27, 2022 10:01 AM
Your issue is that in your chain of "then" statements, your last "then" doesn't actually return a value. It just logs the response to the console instead of saving the response to the variable. Remove the line .then(response => console.log(response))
Then your response variable will have the data object. Put console.log(response) on a new line after the end of your code and you will see it.
Then you can use output.set('id', response.data.id)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 27, 2022 10:01 AM
Your issue is that in your chain of "then" statements, your last "then" doesn't actually return a value. It just logs the response to the console instead of saving the response to the variable. Remove the line .then(response => console.log(response))
Then your response variable will have the data object. Put console.log(response) on a new line after the end of your code and you will see it.
Then you can use output.set('id', response.data.id)
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Dec 27, 2022 10:42 AM
@kuovonne Outstanding!!! I was struggling for a quite a while, your solution works perfectly, thankyou so much!!!!