I have a "When a HTTP request is received" trigger set up as the first step in my flow. I have a Parse JSON step that gets the body content of the received request. It parses it to a schema that I generated from a sample payload. I cannot seem to set/initialize a variable with any data from the parsed JSON. The variable that I am using is the customer first name. It shows up as blank or null even if there is data in the output section of Parse JSON.
I am initializing the variable as a string and setting it to
body('Parse_JSON')?['body']?['estimate']?['customer']?['first_name']
I have ran into a roadblock on this. Any help is appreciated!
Parse JSON Output:
{
"body": {
"event": "estimate.scheduled",
"company_id": "5d99b484-c68c-4393-962d-bf3aac2514ce",
"estimate": {
"id": "csr_48efccec4eb54cdc998903ea1b76ecb7",
"estimate_number": "5",
"work_status": "scheduled",
"customer": {
"id": "cus_a6a2b9dc854747c8a9cbc053960460d7",
"first_name": "Will",
"last_name": "xxxxxx",
"email": "xxxxxxxxx@gmail.com",
"mobile_number": "5555555555",
"home_number": null,
"work_number": null,
"company": null,
"notifications_enabled": true,
"tags": []
},
"address": {
"id": "adr_6ba72fa2cd01462ca4e984230e67b368",
"type": "service",
"street": "xxx xxx Street",
"street_line_2": null,
"city": "xxxCity",
"state": "OH",
"zip": "xxxxx",
"country": null
},
"work_timestamps": {
"on_my_way_at": null,
"started_at": null,
"completed_at": null
},
"schedule": {
"scheduled_start": "2021-11-30T21:30:00Z",
"scheduled_end": "2021-11-30T22:30:00Z",
"arrival_window": 0
},
"assigned_employees": [
{
"id": "pro_d9ac17f383f84deab2acfcfc8078471f",
"first_name": "Will",
"last_name": "xxxxxx",
"email": "xxxxxxxxx@gmail.com",
"mobile_number": "5555555555",
"color_hex": "EF9159",
"avatar_url": "/assets/add_image_thumb.png",
"role": "field tech",
"tags": [],
"permissions": {
"can_add_and_edit_job": true,
"can_be_booked_online": true,
"can_call_and_text_with_customers": true,
"can_chat_with_customers": true,
"can_delete_and_cancel_job": true,
"can_edit_message_on_invoice": false,
"can_see_street_view_data": true,
"can_share_job": true,
"can_take_payment_see_prices": true,
"can_see_customers": true,
"can_see_full_schedule": true,
"can_see_future_jobs": true,
"can_see_marketing_campaigns": true,
"can_see_reporting": true,
"can_edit_settings": true,
"is_point_of_contact": false,
"is_admin": true
}
}
],
"options": [
{
"id": "est_856e1f5668004df8914e5583e82088c4",
"name": "Option #1",
"option_number": "5",
"total_amount": 564200,
"approval_status": null,
"message_from_pro": null
}
]
}
}
}
Solved! Go to Solution.
Hi @william_nr3,
Can you try:
outputs('Parse_JSON')?['body']?['estimate']?['customer']?['first_name']
Or:
body('Parse_JSON')?['estimate']?['customer']?['first_name']
Double check your input and your schema. I used the sample JSON you provided and it returns the first name using the JSON you supplied. But my JSON schema looks a bit different from yours.
Hi @william_nr3,
Can you try:
outputs('Parse_JSON')?['body']?['estimate']?['customer']?['first_name']
Or:
body('Parse_JSON')?['estimate']?['customer']?['first_name']
Both work. Interesting- the extra body was thrown in there automatically when selecting dynamic content. Thanks a ton.
User | Count |
---|---|
89 | |
40 | |
22 | |
20 | |
16 |
User | Count |
---|---|
136 | |
54 | |
47 | |
36 | |
25 |