replacing on_sent_ok from wordpress

Hi all.

We have a code on our page managed by wordpress, which sends a form to Sugar (version 6.5.16 (compilation 1082)) by which the data is attached to the "potential customers" section.

The code that was there is the following: on_sent_ok: "SugarWebToLeadForm ('http://web.com/index.php?entryPoint=WebToLeadCapture', '1', 'e8f0dbbc-be80-ef5f03', 'https: // www web / submenu / '); "

Since the "on_sent_ok" function has been deprecated, I am using the new function, but it does not work for me. The code I use is:
add_action ('wp_footer', 'mycustom_wp_footer');
mycustom_wp_footer () {function
?>
<script type = "text / javascript">
contact-form-7.addEventListener ('wpcf7mailsent', function (event) {
SugarWebToLeadForm ('http://web.com/NUEVA/index.php?entryPoint=WebToLeadCapture', '1', 'e8f0dbbc-be80-ef5f03', 'https: //www.web/submenu/')
}, false);
</ script>
<? php
}

I'm pasting it into the functions.php file of the active theme.

Has anyone encountered this problem and had to make this change?