# Using a View-based POST to make a connected record is NOT connecting

**URL:** <https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704>\
**Category:** API & Custom Code\
**Created:** [June 22, 2022, 12:51pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704 "2022-06-22T12:51:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)\
**Post date:** [June 22, 2022, 12:51pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/1 "2022-06-22T12:51:51Z")

</div>

Has anyone had success using a View-based POST? (with ajax is even better) Or is there another way?  
I need to enter a new connected record but I am running the api from the child table. (I am basically taking an existing child and splitting it into two records. Each child represents a payment.)

I am successfully posting from the parent instead of the child, but the connection is not being made like the documentation suggests: [View-Based POST for Inserting a Connected Record](https://docs.knack.com/docs/view-based-post-for-inserting-a-connected-record)

I constructed the URL properly because it works and does POST a new record. 🙂  
[https://api.knackhq.com/v1/pages/scene\_XX/views/view\_RRR/records](https://api.knackhq.com/v1/pages/scene_XX/views/view_RRR/records)

However, the connection to the child is still missing.

The instructions say that the connection is made manually by using field\_1 but I cannot get that to work.  
(cURL)  
–data-raw ‘{  
“field\_1”: “5d65bad5614e4d001047b585”  
}’

So I am sending field\_1 with my parent id, but it does not enter the connection.  
I have also tried field\_1\_raw and neither works.

```auto
                    var ParentURL = "https://api.knackhq.com/v1/pages/scene_xxx/views/view_238/records";   
                    var MyDataObject = {						   
                        //"field_1": MyParentID, // does not work
                        "field_1_raw": MyParentID, // does not work
                        "field_105": SampleVariable,        
                        ...      
                        "field_103": 'Approved'       
                    }; 
                    
                    DoSomeAjax(ParentURL, 'POST', MyDataObject, function(NewPaymentData) {
                        console.log(NewPaymentData); // dumps new record, looks good but no connection to parent
                        var NewPaymentID = NewPaymentData.id;  
                        console.log("Payment " + NewPaymentID + " created.");  
                    }); 

```

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [June 22, 2022, 6:42pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/2 "2022-06-22T18:42:40Z")

</div>

Hi Robin,

When you want to insert connected records via API then you need to send that connected Key in URL as well.

you can watch that proper URL by inserting that record manually from that page in network tab.

Regards,  
sunny Singla

---

<div class="post-metadata">

**Author:** ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)\
**Post date:** [June 22, 2022, 7:27pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/3 "2022-06-22T19:27:11Z")

</div>

Okay, I have that, but what do I do with it? I assume you mean the end of this url, which is the id of the parent record.  
[https://myapp.knack.com/myapp#activities-new/activity-payments/623c602239e4c8001fcd250a/](https://myapp.knack.com/myapp#activities-new/activity-payments/623c602239e4c8001fcd250a/)

But where do I put that? I tried on the end of my api URL but it did not work, I tried both of these  
“[https://api.knackhq.com/v1/pages/scene\_xxx/views/view\_238/623c602239e4c8001fcd250a](https://api.knackhq.com/v1/pages/scene_xxx/views/view_238/623c602239e4c8001fcd250a)”;  
“[https://api.knackhq.com/v1/pages/scene\_xxx/views/view\_238/records/623c602239e4c8001fcd250a](https://api.knackhq.com/v1/pages/scene_xxx/views/view_238/records/623c602239e4c8001fcd250a)”;

I must be so close…

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [June 23, 2022, 4:24am UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/4 "2022-06-23T04:24:25Z")

</div>

Hello Robin,

Try below

var ParentURL = “[https://api.knackhq.com/v1/pages/scene\_xxx/views/view\_238/records](https://api.knackhq.com/v1/pages/scene_xxx/views/view_238/records)”;  
var MyDataObject = {   
//“field\_1”: MyParentID, // does not work  
“field\_1\_raw”: MyParentID, // does not work  
“field\_105”: SampleVariable,  
…  
“field\_103”: ‘Approved’  
};

MyDataObject.crumbtrail={};  
MyDataObject.crumbtrail[“edit-parent\_id”]=“623c602239e4c8001fcd250a”;

Then Post

Thanks  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)\
**Post date:** [June 23, 2022, 12:22pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/5 "2022-06-23T12:22:08Z")

</div>

> [@Sunny\_Singla](#):
>
> “623c602239e4c8001fcd250a”

Hmm, I understand at least what that is trying to do, but it still does not create the connection to the record.  
I have tried multiple iterations, with field\_1, with field\_1\_raw, without field\_1 at all, with double and single quotes around edit-parent\_id  
When I type .crumbtrail into my JS code window, it puts … underneath it, does that mean something? It does recognize it as valid for an object because it appears in the data list.  
It does add the record, just does not connect it.

```
                MyActivityID = "623c602239e4c8001fcd250a"
               var ActivityPaymentURL = "https://api.knackhq.com/v1/pages/scene_xxx/views/view_238/records";
                var ActivityPaymentObject = {						   
                    "field_1": MyActivityID, // I have tried this
                    //"field_1_raw": MyActivityID, // and this
                     ... 
                    "field_103": 'Approved'                
                }; 
                ActivityPaymentObject.crumbtrail={};
                ActivityPaymentObject.crumbtrail["edit-parent_id"]=MyActivityID;

```

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [June 23, 2022, 12:47pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/6 "2022-06-23T12:47:51Z")

</div>

Remove  
“field\_1”: MyActivityID, // I have tried this  
//“field\_1\_raw”: MyActivityID,  
if then still not work you can reach out for this on email we can check on your app.

As above code works for me.

Regards,  
Sunny Singla

---

<div class="post-metadata">

**Author:** ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)\
**Post date:** [June 23, 2022, 1:30pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/7 "2022-06-23T13:30:03Z")

</div>

(this conversation has been moved).

---

<div class="post-metadata">

**Author:** ![Sunny\_Singla](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/sunny_singla/32/1007_2.png) [@Sunny\_Singla](https://forums.knack.com/u/Sunny_Singla)\
**Post date:** [June 23, 2022, 2:02pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/8 "2022-06-23T14:02:33Z")

</div>

Without credentials, I’m not able to test.

for any professional help, you can email me or whatsapp me.

Regards,  
Sunny Singla  
+919855089359

---

<div class="post-metadata">

**Author:** ![RobinB](https://avatars.discourse-cdn.com/v4/letter/r/3d9bf3/32.png) [@RobinB](https://forums.knack.com/u/RobinB)\
**Post date:** [June 23, 2022, 9:59pm UTC](https://forums.knack.com/t/using-a-view-based-post-to-make-a-connected-record-is-not-connecting/12704/9 "2022-06-23T21:59:15Z")

</div>

Apparently I could not make that connection that way BECAUSE I had made my connection from the parent table instead of from the child.

I deleted the connection, reconnected from the child table, redid all my forms and views and functions which used the connection (that was fun) and then just posted to the child object in the first place. Sigh. But it WORKS now.
