Settings in scripts causing "TypeError: Cannot read property 'mysetting' of undefined"
I configured a Setting for an Integration. In the Transformation script of the initial Flow Export, I make a conditional using that setting.
For example, say that the Setting is `{ "mysetting": true }`. My conditional might call `if (options.settings.integration.mysetting) { /* do something...*/ }`.
When I click on the Transformation script of the Flow Lookup step after the Export, or the Flow Lookup itself, an error message appears
"TypeError: Cannot read property 'mysetting' of undefined"
This error happens even if any further scripts never refer to "mysetting". This error happens in subsequent steps even if I included handling for an undefined property in the original Export Transformation step script (e.g. `if (typeof options.settings.integration.mysetting === "undefined" && (options.settings.integration.mysetting) { /* do something...*/}` ). This error happens when I can see that the settings property "mysetting" is still loaded in the Function Input of the subsequent Flow Lookup Transformation script.
The ability to reuse an Export by using settings seems like it would be very helpful, and almost proves to work based on the first step script preview, but this error makes settings unusable. Is there a way to use settings without getting this error?
Comments
Hey Todd,
Yes there's currently an issue where those settings aren't always loaded properly when doing previews. We will address this in a future release. To avoid this in the interim, you can add a couple lines to define default settings at the top of your script's main function, e.g.
Thank you Lucian for the quick response! I will keep that in mind
Lucian Hymer what about if you are getting this error on the v2 application. I don't have an option to add script changes. (TypeError: Cannot read property "2" from null). Thanks!
Hi Megan Callaghan,
I apologize for the delayed response - I'm checking with the SFNS v2 PM on this.
Hey Hi, Megan Callaghan,
If still not resolved reg: type error, Can you please explain in detail where exactly you were facing the issue for type error? If possible can you share the screenshot of it?
Is there any update on when this might be resolved? My custom settings are not working either. I submitted a ticket (97390) to report this.
Josh Saterdalen and Muneswara Thotakura and Courtney Jordan. We ended up upgrading to IO so not having this anymore. BUT... It was super painful migration from v2 to IO; we even lost some functionality (what?!). Happy to chat about that but not longer experiencing this problem. Wish you the best of luck!
Hi Megan Callaghan,
Thanks for letting us know how difficult is was to migrate. I'll ask the SFNSIO PM to follow up with you. Do you still feel that you are missing functionality that was important to you? If so, could you let us know what it was and how you used it? Thank you so much for your insights and for taking the time to help us understand how we can improve your experience!
Courtney Jordan Thanks. I've got the intentions to compile and send a summary to the product manager feedback email address once we've worked through our issues.
Hi Josh Saterdalen,
Thanks for bringing this to our attention. We're looking into this and will respond with more information as soon as possible.
Hi Megan Callaghan,
That would be wonderful. Thank you so much!
Hi All,
This is to confirm that the issue has been escalated to the Product Team for further troubleshooting. Will provide additional details to this thread when received.
Please sign in to leave a comment.