Support » Plugin: Dynamics 365 Integration » Empty field records are created from a Twig Form

  • Resolved thepiweb

    (@thepiweb)


    Hi,

    We are using a twig custom form to create new records for the lead entity.
    We have js validation and input requirement on the website form. Also in Dynamics all the fields are required. Even if we drop js and html validation and requirement we get an error and a message from dynamics that that all fields are mandatory and the data are not sent.
    Yet the last few days the lead entity is updated with multiple empty records.
    The account that creates these empty records is the one that is connected with the website and is used only for this purpose.
    We don’t have any evidence other than this that the website has been compromised. We find it also difficult that it is a spam bot creating relative few empty records.

    Is it possible to be a php bug?
    We were getting empty records before when we used two forms on a single page but prior to your fix with the _key attribute.

    Thanks

    • This topic was modified 1 year, 9 months ago by thepiweb.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor wizardist

    (@wizardist)

    Hi @thepiweb

    Could you share the template? How do you ease the requirements?

    Have you updated the plugin recently? What’s the version of the plugin and WordPress?

    Thanks

    Hi @wizardist

    This is our code

    [msdyncrm_twig]
    {% form entity="lead" mode="create" language=1032 required=["lastname", "emailaddress1", "firstname"] %}
    {% if form.submission and form.status %}
    <div class="row">
    <div class="col-12">
    <div class="alert alert-success">{{ form.parameters.messages.success ?? "Ευχαριστούμε για την εγγραφή σας στο Newsletter" }}</div>
    </div>
    </div>
    {% elseif form.submission and (not form.status) %}
    <div class="row">
    <div class="col-12">
    <div class="alert alert-danger">{% if form.parameters.messages.error %}
    {{ form.parameters.messages.error }}
    {% else %}
    {% for descriptor, message in form.errors %}
    <div>{{ descriptor }}: {{ message|join(', ') }}</div>
    {% endfor %}
    {% endif %}
    
    </div>
    </div>
    </div>
    {% endif %}
    
    <form class="form-inline" method="POST" data-toggle="validator">
    <fieldset>
    <div class="form-group">
    
    <input class="form-control" name="firstname" pattern="^[A-Za-zα-ωΑ-ΩΆΈΌΉΊϊΪϋΫέόώάίήύ\s]*$" required="" type="text" placeholder="Όνομα:" data-required-error="Το πεδίο είναι απαραίτητο" data-pattern-error="To πεδίο δέχεται μόνο χαρακτήρες και το κενό" />
    <div class="help-block with-errors"></div>
    </div>
    <div class="form-group">
    
    <input class="form-control" name="lastname" pattern="^[A-Za-zα-ωΑ-ΩΆΈΌΉΊϊΪϋΫέόώάίήύ\s]*$" required="" type="text" placeholder="Επίθετο:" data-required-error="Το πεδίο είναι απαραίτητο" data-pattern-error="To πεδίο δέχεται μόνο χαρακτήρες και το κενό" />
    <div class="help-block with-errors"></div>
    </div>
    <div class="form-group">
    
    <input class="form-control" name="emailaddress1" required="" type="email" placeholder="Email:" data-required-error="Το πεδίο είναι απαραίτητο" data-error="Μη έγκυρο email" />
    <div class="help-block with-errors"></div>
    </div>
    <button class="btn btn-default" type="submit">Εγγραφή</button></fieldset>
    <input name="_key" type="hidden" value="{{form.key}}" />
    
    </form>{% endform %}
    [/msdyncrm_twig]

    We use Version 1.2.19 of the plugin and WordPress 5.0.3.

    Thanks

    Edit: I don’t understand what you mean with ‘ease the requirements’.
    We use an input required attribute, a js validation and the fields are required also from the CRM side.

    • This reply was modified 1 year, 9 months ago by thepiweb.
    • This reply was modified 1 year, 9 months ago by thepiweb.
    Plugin Contributor wizardist

    (@wizardist)

    @thepiweb disregard that one question regarding requirements.

    It is not clear what happens yet. Try explicitly adding the “key” parameter to the {% form %} tag.

    Lots of factors may come into play, including different JS scripts, potentially conflicting WordPress plugins, and also in some situations even CRM workflows.

    Hi @wizardist,

    Do you mean I should add a key parameter with a custom value to the {% form %} tag?
    For example key=”1234″? Because value=”{{form.key}}” renders successfully a key (of the type 213cgf312gd..) on the front-end.

    Plugin Author alexacrm

    (@alexacrm)

    @thepiweb this is correct.

    Have you got a chance to check if you have any workflows in CRM that could possibly create duplicates if triggered?

    Does the problem persist?

    Unfortunately setting a custom key attribute on {% form %} did not solve things. The problem begun when in two days about 100 empty records where created on the leads entity from the account that is connected with the website. From then on every once in a while but almost every day 1 to 15 empty fields are created. Some are created in one minute, others between couple of minutes. Yesterday were created 15 and the day before only 1. There are hints, from my point of view, that their creation is triggered from a human factor or maybe a workflow. One reason is that they are created on ‘working hours’. Personally I don’t have access to the CRM workflows. I am only in charge of the plugin and the website implementation of the CRM. I have to exhaust all possibilities that the plugin or the certain form isn’t causing this.

    Thanks

    • This reply was modified 1 year, 8 months ago by thepiweb.
    Plugin Author alexacrm

    (@alexacrm)

    @thepiweb

    may I suggest that you add a hidden field to the form that you’d default to some value.
    Then in CRM you’d be able to see if the records are created by the form submission. If this attribute is set then the request is coming through the form, if not – something else is creating those records.

    Without access to other ingredients such as workflows, it’s hard to say what’s causing it.

    Thanks

    Hi,

    We added a hidden field to the form with a default value and indeed the value is not coming through with these empty records. So it seems these records are not created with the form submission.

    Yet, we changed the entity that the form is connected from Leads to a new custom one. The empty fields stopped being created on leads and started appearing to the new entity. It seems that, if not the form itself, the plugin may causing this.

    I want to add some more elements that I think will be useful.

    • this form is added to all pages on the footer through a wp widget
    • Wordpess along with the Crm is connected with an Exchange Mail Server 2016. We have noticed that when the mail server is down these empty fields are created in great numbers. Specifically when it is reported to us that the Exchange Server is down the empty fields are created every minute. Otherwise we see a couple or even only one in a single day.

    Thanks again in advance.

    • This reply was modified 1 year, 8 months ago by thepiweb.
    • This reply was modified 1 year, 8 months ago by thepiweb.
    Plugin Author alexacrm

    (@alexacrm)

    @thepiweb

    can you check what’s recored in createdby for those empty records?
    That would help to identify the source for the records

    Thanks
    George

    Hi,

    In the createdby of the empty records is recorded the account that is connected with website and the plugin. This account is used only for the connection of the site with the CRM.

    Thanks

    Plugin Author alexacrm

    (@alexacrm)

    @thepiweb can you do some fiddler trace (or using browser dev tools)? I’d be interested to see if multiple submissions are coming from the page or if the page is submitted once but then multiple records are crated by the server-side code.

    Unfortunately our client asked us to remove the specific form from the website.
    After the removal the empty records stopped.
    If I understand what you are saying let me note that the empty records didn’t seem to be triggered by any form submission.
    Personally I didn’t witness, during my tests, any empty record being created during or after a submission of the specific form or any other crm form we use on the site.

    Thanks

    Plugin Author alexacrm

    (@alexacrm)

    Thanks for letting us know. As you understand, we have limited resources to debug individual customers who use the free plugin and your case is a complete mystery.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Empty field records are created from a Twig Form’ is closed to new replies.