Bitrix24 – 如何在数组中获取电话数据

huangapple go评论57阅读模式
英文:

Bitrix24 - Webhook how to get data phone in array

问题

可以使用以下代码来获取工作电话或座机电话的数据:

[PHONE] => Array
(
    [0] => Array
        (
            [ID] => 45545
            [VALUE_TYPE] => WORK
            [VALUE] => +351911111111
            [TYPE_ID] => PHONE
        )
    ...
    (其它电话数据)
    ...
    [2] => Array
        (
            [ID] => 45549
            [VALUE_TYPE] => HOME
            [VALUE] => +351220000000
            [TYPE_ID] => PHONE
        )
    ...
    (其它电话数据)
    ...
)

如果你想要获取工作电话的数据,可以使用以下代码:

$work_phone = $result['PHONE'][0]['VALUE'];

如果你想要获取座机电话的数据,可以使用以下代码:

$landline_phone = $result['PHONE'][2]['VALUE'];

希望对你有所帮助。

英文:

In bitrix24 it is possible to create webhooks to obtain contact data. In contacts, the phone field is an array that is made up of several arrays but I don't understand how I can get the data from the work phone or landline phone array.

To get the phone data I use SELECT[] with the PHONE parameter. Can anyone help me with the structure, I've tried PHONE[0] without success.

Thank you in advance

 [PHONE] => Array
                    (
                        [0] => Array
                            (
                                [ID] => 45545
                                [VALUE_TYPE] => WORK
                                [VALUE] => +351911111111
                                [TYPE_ID] => PHONE
                            )

                        [1] => Array
                            (
                                [ID] => 45547
                                [VALUE_TYPE] => MOBILE
                                [VALUE] => +351910000000
                                [TYPE_ID] => PHONE
                            )

                        [2] => Array
                            (
                                [ID] => 45549
                                [VALUE_TYPE] => HOME
                                [VALUE] => +351220000000
                                [TYPE_ID] => PHONE
                            )

                        [3] => Array
                            (
                                [ID] => 45551
                                [VALUE_TYPE] => FAX
                                [VALUE] => +351210000000
                                [TYPE_ID] => PHONE
                            )

                        [4] => Array
                            (
                                [ID] => 45553
                                [VALUE_TYPE] => PAGER
                                [VALUE] => +351230000000
                                [TYPE_ID] => PHONE
                            )

                        [5] => Array
                            (
                                [ID] => 45555
                                [VALUE_TYPE] => MAILING
                                [VALUE] => +351240000000
                                [TYPE_ID] => PHONE
                            )

                        [6] => Array
                            (
                                [ID] => 45557
                                [VALUE_TYPE] => OTHER
                                [VALUE] => +351250000000
                                [TYPE_ID] => PHONE
                            )

                    )

答案1

得分: 1

在 JavaScript 部分,我将读取字段值为 "work",而不是在 Webhook 中获取该字段,这样问题就解决了。

英文:

Instead of getting the field in the webhook, on the javascript side I'll read the field value = work and the problem is solved.

huangapple
  • 本文由 发表于 2023年6月22日 00:46:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76525499.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定