Failed to save record because Invalid leadsource reference key

I sometimes get the error Failed to save record because Invalid leadsource reference key x for campaign category y.

Aside from this, it also overwrites the Leadsource in Netsuite. So my questions are:

1. How do I prevent the overwriting of the Leadsource?

I have looked at the mapping and right now under Advanced I set it to “Only perform mapping when:” with the value “Creating a record”. Not sure if that's sufficient though. I assume it is, but.. just want to make sure! :)

2. As for the error.. how do I get around this? I thought I would've prevented that from happening by doing what I did under my previous question ("creating a record"). But apparently this isn't working. What do I do?

As a sidenote, right now the mapping is set as “Hard-Coded” with a value. But it should only do this when creating a record… but why isn't this doing what it's supposed to do? I'm a bit lost here..

Hi Johan! Thanks for posting, I am working on getting you an answer. :grinning:

Hi Mattie! Thanks for responding. I'm actually already working with Support on this. :slight_smile:

Glad to hear you're already working with support on this! Once you have a solution, it would be great if you could share it here in the community—this could really help others with similar questions. Thanks!

Under Flows > Order > "Shopify customer to NetSuite customer (add or update) [companyname] you will find a Settings cog wheel on the right side. Click on that first. You should find 2 criteria there. First is "Primary customer lookup criteria". Click on the icon to the right of it.
Here you can change some things. I don't remember what my original was, so.. let's just say that we don't want to overwrite records that are already in NetSuite, EVEN when those records have nothing to do with Shopify. Like when you have another system besides Shopify.
So you can add "Email (Field ID: email)" (left field) "is" (middle field) and "email" right field. This means that the criteria will check if there already is a record with an email address in it.

Secondly, the mapping for NetSuite fields.. go there and check for a field that you don't want to have overwritten. Like "Lead Source" (as an example). Under "Advanced", you can "Only perform mapping when" and pick "Creating a record".

If the record satisfies the lookup criteria (first paragraph above) and find an existing record in NetSuite, then it will update the record based on your customer mapping (second paragraph above). So, if a mapping is set to "use when creating a record" in the advanced settings, it will skip that mapping since we are only updating an existing record and move on to the next one.

Hope that made sense! :grinning:

1 Like