Purchase Order Form content not reflecting in Webhooks?

  • sadlow
    Asked on July 26, 2016 at 7:49 AM

    Dear team,

    I created a new form, which has a purchase order form widget in it, but when I submit the form, for the order widget there will be only posted an array, which does not contain name ("Motiv 1"), quantity name, quantity or price of the selected products.

    When I look in the inbox, everything looks just fine:

    Motiv 1 (Amount: 43.00 EUR, Auflage (Motiv 1): 5)  Motiv 2 (Amount: 57.00 EUR, Auflage (Motiv 2): 10)  Motiv 4 (Amount: 43.00 EUR, Auflage (Motiv 4): 5)  Motiv 7 (Amount: 29.00 EUR, Auflage (Motiv 7): 3)but the array only contains: "q139_meineProdukte":{"0":{"id":"1001"},"special_1001":{"item_0":"20"},"special_1002":{"item_0":"1"},"special_1003":{"item_0":"1"},"special_1004":{"item_0":"1"},"special_1005":{"item_0":"1"},"special_1006":{"item_0":"1"},"special_1007":{"item_0":"1"}},"how do I get this content posted to Webhooks as well? Your help is much appreciated! Did I maybe just forgot to check a box or something?

    Greetings, Marcel

  • Nik_C
    Replied on July 26, 2016 at 9:48 AM

    Well, I'm not sure if that can work since it is a Purchase order, but is it possible that you can provide to us your PHP url for your Webhooks so we can take a look and see if it is possible?

    Since maybe some fields in Webhooks are not matching your form so that's why they are not reflecting in Webhooks.

    We'll wait for your response.

    Thank you!

  • sadlow
    Replied on July 26, 2016 at 10:16 AM

    You can see in RequestBin how the last posts of the form have been delivered:

    http://requestb.in/18ka2hy1?inspect

    I hope that helps. Our PHP-Script has not been finished, because I couldn't figure out the location of the data I am trying to get from the posted form. 

  • Welvin Support Team Lead
    Replied on July 26, 2016 at 11:30 AM

    I haven't use Webhook for quite some time already but I think this is how the purchase order items are presented in webhook output. You can use the item ID to get the correct output, like for example, posting the data and echoing the correct label in the result. 

    I will also try to seek help from my colleagues about this matter. I'll let you know.

  • sadlow
    Replied on July 26, 2016 at 11:49 AM

    does that mean, that not every content, that is shown in the submission inbox of Jotform, is posted through webhooks? That would be VERY unfortunate, because it is of course the details of the user's choice that I would need for the processing php script. :-/

    Maybe someone has another idea, if this is the way it should be. If so, I would be happy if this can be solved in an update! 

  • Nik_C
    Replied on July 26, 2016 at 1:15 PM

    It means that it will not go through automatically, you have to create a PHP file that will pass the information to Webhooks. What I mean is that every field in your form you have to represent in your PHP file in order to pass that particular information.

    You can check this Webhooks example PHP scripts in this link in order to get an idea: https://www.jotform.com/help/248-Webhook-PHP-Script-Examples

    If you can let us know why you are integrating with Webhooks maybe we could try to find some workaround for you if this is not working as you expect?

    Please let us know.

    Thank you!

  • sadlow
    Replied on July 27, 2016 at 3:52 AM

    An additional php file to pass the information to Webhooks? I thought Webhooks passes all form data directly to the PHP script I linked in.

    https://www.jotformeu.com/form/61931347292357?preview=true

    Like you can see here, the user can choose between different billboards with checkbox and quantity which have custom prices. I simply want the user's choice to be given to the PHP script I have linked into Webhooks. I have created a lot of other working order forms like this, but this is the first one, where the user's choice is more complex and so I found this widget very helpful, but I just can't read out the data, although I can see in my jotform inbox that everything seems to be there. 

    In my PHP script I fetch the posted values like this:

    $payment = $obj['q108_input108'];

    $account_holder = $obj['q109_kontoinhaber109'];

    $iban = $obj['q110_ibannummer'];

     

    but if I do the same to the field with this more complex choice (I made a random choice here), I get an array, which does not contain all the needed information. The output of the array I get looks like this:

    Array  [0] => Array ( [id] => 1001) [special_1001] => Array ( [item_0] => 5 )[1] => Array ( [id] => 1002 )[special_1002] => Array( [item_0] => 10[special_1003] => Array( [item_0] => 1) [2] => Array( [id] => 1004) [special_1004] => Array ( [item_0] => 5 ) [special_1005] => Array( [item_0] => 1[special_1006] => Array ( [item_0] => 1) [3] => Array ( [id] => 1007) [special_1007] => Array (  [item_0] => 3  ))

    But there is either a name of the chosen checkboxes nor any amounts or quantities visible. 

    OK, I mean the value of [item_0] => 5 seems to be the chosen quantity. But this is the only value I could extract and still I have no product name or price for this.

  • liyam
    Replied on July 27, 2016 at 7:02 AM

    Hello Marcel,

    Our apologies, I think what Nik_C meant was that you need a PHP script in order to parse the data as received from the form via webhook. Anyway, I see that you do have set on your webhook settings a script that catches this data.

    Now, to answer the concerns at hand:

    When a form sends a post data, it does not submit the label values of the form. The label Motiv is also not directly part of the value in your products. But in checking your form's HTML source, Motiv 1 has the product ID value of 1001. So this means Motiv 1-7 has the product ID values of 1001-1007 as well, by coincidence. This is why you do not see any name with the word Motiv in the array. 

    With the things mentioned, this means that you will have to prepare an equivalent value for your product items such as the name, and the amount per product.

    Hope this clarifies some issues. 

     

  • sadlow
    Replied on July 27, 2016 at 7:17 AM

    Hi Iiyam!


    Thank you very much, that was not the answer I was hoping for, but definitely the information I needed! I'm still wondering, why the result of the order widget has been properly parsed all labels and amounts into the inbox of Jotform!? 

    Purchase Order Form content not reflecting in Webhooks? Image 1 Screenshot 20

     

    Do you see any other way to transport at least the total amount via Webhooks? Can I forward it somehow to another input-box which I could parse via Webhooks?

  • Welvin Support Team Lead
    Replied on July 27, 2016 at 9:02 AM

    Well, it's a different feature. I also wonder if you have tried submitting the form with the live Webhook URL in it, using the given arrays? I think the arrays will be automatically converted into the actual item name once submitted and received, including its quantity property. Can you try? 

    The total, you can use our calculation widget to do that.

    https://www.jotform.com/help/259-How-to-perform-calculation-in-the-form

    Just add the whole purchase order field in the equation to pass the total:

    Purchase Order Form content not reflecting in Webhooks? Image 1 Screenshot 20

  • liyam
    Replied on July 27, 2016 at 11:44 AM

    Just an update in addition to Welvin's response. 

    Since you are using a Custom URL thank you page, you can try making use of it to capture the post data of your form submissions, rather than using a webhook by enabling the POST data submission on your form (https://www.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page).

    Then just remove your webhook and make use of this method instead.

    Thanks.