How to push data to external system using module logic hook

Hi All,

I need to know is it possible to push data from  sugar to external system using logic hook.I know web logic hook is enough  to push data even though i have an special requirement to push data using logic hook. I like to know is it any way to achieve this.

Parents Reply Children
  • If you want to send the Lead data to external system when Lead will create/save then the API or anything will use by the Sugar side not by the external system side. 

    So what you can do is you can create a form in the create.js in a function which triggers after saving of bean, populate the data of bean in fields of a form and then click submit which will hit the URL to the external system suppose  "www.xyz.com" and then you can get the data. 

  • Hello Maryam,

    Thank you very much for your support and suggestion.

     I will try the method which you suggested.

    Also if you have get any idea about the above suggested methods,Let me know.

    Thanks and Regards,

    Sino Thomas.

  • In the "saveAndClose" function of create.js, you can create a form and send it to 3rd party. That is the sample code.

                                       var form = $('<form></form>');                                     form.attr("method", "post");                                    form.attr("action", "">xyz.com");                                    form.attr("target", "_blank");                                    var field = $('<input></input>');                                     field.attr("type", "hidden");                                    field.attr("name", 'email');                                    field.attr("value", data['email']);                                    form.append(field);                                     var field1 = $('<input></input>');                                    field1.attr("type", "hidden");                                    field1.attr("name", 'category');                                    field1.attr("value", data['cat']);                                    form.append(field1);                                     var field2 = $('<input></input>');                                    field2.attr("type", "hidden");                                    field2.attr("name", 'type');                                    field2.attr("value", data['type']);                                    form.append(field2);                                     // The form needs to be a part of the document in                                    // order for us to be able to submit it.                                    $(document.body).append(form);                                    form.submit();                                }, this),                                error: function (error) {                                    console.log("API Failed");                                },                            });

    I am populating the data in the hidden type fields so that on the other side I can access them without any disturbance.