Calling api from premap hook

Comments

3 comments

  • Scott Henderson CTO
    Celigo University Level 1: Skilled
    Answer Pro
    Top Contributor

    The specific error message you posted indicates that you are trying to create an export that references a sandbox connection, but for some reason the export itself is being created in production.  You might be able to work around this by explicitly setting the "sandbox" boolean field to true on the export resource before posting it to the API.

    Taking a step back I don't recommend creating new resources in your hooks in your flows (i.e. dont create new exports and imports).  You should create the exports and imports that you need in advance, and then simply invoke them in your hooks; or you should use virtual exports and imports.  Invoking exports and imports in your hooks is a very powerful capability, and you can do really cool stuff, but please also be careful with this power.  I always recommend trying to use flow builder to do as much as possible, because then it is easier to visualize and maintain the stuff you build, and you get better err management, and concurrency controls are built in, etc...

    0
  • Nuri Ensing NetSuite Integration Whiz
    Engaged
    Awesome Follow-up
    Celigo University Level 4: Legendary

    Hi Scott,

    Thanks again for taking the time to answer. 

    You might be able to work around this by explicitly setting the "sandbox" boolean field to true on the export resource before posting it to the API.

    Where can I find this option?

    I agree about the visualization part. Only sometimes if there are many steps it feels cleaner to do it in code hehe :)

    0
  • Scott Henderson CTO
    Celigo University Level 1: Skilled
    Answer Pro
    Top Contributor

    Regarding the "sandbox" boolean property, and the error you are seeing when you try to create an export in your hook, this is actually likely a bug.  i.e. The bug is that we are not auto setting the "sandbox" boolean field when your script runs in sandbox, and uses the API in the sandbox, etc...

    I am not sure if/when something like this will get fixed though, since again, it is really not a good practice to be creating new resources in hooks.

    0

Please sign in to leave a comment.