OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM How to create contacts from third party form?

This topic contains 1 reply, has 2 voices, and was last updated by  Andrey Yatsenko 5 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #30971

    cuongdn1102
    Participant

    I have an installation of orocrm 2.0.

    I created a third party form to create contact in orocrm. As many doc available to generate api key

    and wsse authentication and i done these .

    But i want to create contacts in orocrm from a third party form and code is here to do this-
    <?php ?>
    <!DOCTYPE html>
    <html>
    <head>
    <title>Rest api </title>
    </head>
    <body>

    <form id=”contactForm” method=”POST” name=”contactForm”>

    <input type=”text” name=”firstname” />
    <input type=”submit” name=”submit”>

    </form>

    <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js” type=”text/javascript”></script>
    <script type=”text/javascript”>
    $(function(){
    $(“#contactForm”).on(‘submit’, function(event){
    var $this = $(this);
    event.preventDefault();

    var values = {};
    $.each($this.serializeArray(), function(i, field) {
    values[field.name] = field.value;
    });

    $.ajax(‘http://localhost:8000/app_dev.php/api/rest/latest/contacts’, {
    type: “POST”,
    beforeSend: function(xhrObj){
    xhrObj.setRequestHeader(‘Authorization: WSSE profile=”UsernameToken” X-WSSE: UsernameToken Username=”hotel”, PasswordDigest=”07zx7Dq7Qx3rkIuIE7FwN8Y6Gyg=”, Nonce=”NWM3NDY4MjFhMDk3ODY4NQ==”, Created=”2017-07-27T10:59:27+01:00″‘);
    }
    }).done(function( data ) {
    console.log(data);
    });
    });
    });
    </script>
    </body>
    </html>
    This gives error-
    I don’t understand how to do this. Please give me any suggestion.

    Thanks.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #30973

    Andrey Yatsenko
    Moderator

    Take a look at how embedded forms are implemented, they look very similar to what are you trying to solve.

    Developer docomentation
    Admin guide

    OroEmbeddedFormBundle enables the application users to create integrated forms using UI, embed them into third-party sites with inline or iframe codes and collect the submitted information in the Oro application database.

    The security issue already solved there.

Viewing 1 replies (of 1 total)

The forum ‘OroCRM’ is closed to new topics and replies.

Back to top