Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working logic in feed processing #6

Open
uprise10 opened this issue May 24, 2024 · 1 comment · May be fixed by #7
Open

Not working logic in feed processing #6

uprise10 opened this issue May 24, 2024 · 1 comment · May be fixed by #7

Comments

@uprise10
Copy link

uprise10 commented May 24, 2024

Not sure how active this plugin is being maintained, but as far as we can see, there is a bug in the feed-processing.

See these lines: https://github.com/rtCamp/gravityforms-sfmc-data-extension/blob/master/includes/class-gravityforms-sfmc-data-extension-addon.php#L206-L210

if ( 'ContactKey' === $sfmc_field || 'SubscriberKey' === $sfmc_field || 'EmailAddress' === $sfmc_field ) {
        $sfmc_data['ContactKey']            = $entry_field_value;
        $sfmc_data['Data']['SubscriberKey'] = $entry_field_value;
        $sfmc_data['Data']['ContactKey']    = $entry_field_value;
        $sfmc_data['Data']['EmailAddress']  = $entry_field_value;
}

In every $sfmc_field you check on multiple OR statements, and then assign a complete array to it. Doing as such, will overwrite the same array over and over again, causing a wrong data array.

As far as we can see the code should be something like this:

if ( 'ContactKey' === $sfmc_field ) {
        $sfmc_data['ContactKey']            = $entry_field_value;
	$sfmc_data['Data']['ContactKey']    = $entry_field_value;
} else if ( 'SubscriberKey' === $sfmc_field ) {
	$sfmc_data['Data']['SubscriberKey'] = $entry_field_value;
} else if(  'EmailAddress' === $sfmc_field ) {
	$sfmc_data['Data']['EmailAddress']  = $entry_field_value;
} elseif ( 'EventDefinitionKey' === $sfmc_field ) {
	$sfmc_data['EventDefinitionKey'] = $entry_field_value;
}

When we changes these line of codes ourselves, it solves the issue, that EmailAddress was not sent as an empty value to MArketingCloud.

@prasadnevase
Copy link
Collaborator

Hi @uprise10 thank you for pointing that. Could you please raise a pull request?

We would review and merge it after testing. Thank you again. cc @kiranpotphode

@uprise10 uprise10 linked a pull request May 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants