# How to apply ignored to false in postResponseMap function

**URL:** <https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174>\
**Category:** Integrator.io\
**Tags:** hooks, error-handling, javascript\
**Created:** [March 19, 2021, 8:17am UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174 "2021-03-19T08:17:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirubadevarajan](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@kirubadevarajan](https://connective.celigo.com/u/kirubadevarajan)\
**Post date:** [March 19, 2021, 8:17am UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/1 "2021-03-19T08:17:00Z")

</div>

I have the written the below postResponseMap hook function to remove certain records from array which doesn't qualify the condition.

```
function postResponseMap (options) { var newPostResponseMapData = []; var j=0 for (var i=0 ; i< options.postResponseMapData.length ; i++){ var offeringDetails = options.postResponseMapData[i].offeringDetails[0] offeringDetails.resources=offeringDetails.resources[1] if(offeringDetails.resources.length>0 && offeringDetails.vleinfoDetail.guestAttendUrl==null && offeringDetails.vleinfoDetail.vleProvider!=null && offeringDetails.vleinfoDetail.vleProvider.displayName=='Non Integrated VLE Provider'){ newPostResponseMapData[j] = options.postResponseMapData[i]; j=j+1; } else{ delete options.postResponseMapData[i] } } return newPostResponseMapData}
```

When the flow is executed, I am receiving the error "Extension result doesn't contain the same number of elements as the request object." due to truncation of records.

Let me know how to skip/remove certain records in postResponseMap hook/function without getting errors.

Note: There was no proper example for [postResponseMap](https://docs.celigo.com/hc/en-us/articles/360039655111-Hooks-for-integrator-io#postResponseMapHook) hook/function in help center.

---

<div class="post-metadata">

**Author:** ![stephenbrandt](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/stephenbrandt/32/6891_2.png) [@stephenbrandt](https://connective.celigo.com/u/stephenbrandt)\
**Post date:** [March 19, 2021, 8:20pm UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/2 "2021-03-19T20:20:01Z")

</div>

@kirubadevarajan,

I encourage others who might have gotten around this error to share their tips, but as you're probably aware the scope of this question is best treated with consulting help:

> If you would like to work with someone more closely to help you through your custom flows, you could consider consulting hours. Also, we have the integrator.io [Office Hours](https://docs.celigo.com/hc/en-us/articles/360045798291) program where you can call in and get a free consultation.

Also, are you familiar with a recently released feature, [Debug your scripts in integrator.io](https://docs.celigo.com/hc/en-us/articles/360057141091-Debug-your-scripts-in-integrator-io)? You can print the value of your data arrays or indices, above, to the script’s execution log at any point – before, during, or after the for() loop.

---

<div class="post-metadata">

**Author:** ![yvonnenemes](https://avatars.discourse-cdn.com/v4/letter/y/cab0a1/32.png) [@yvonnenemes](https://connective.celigo.com/u/yvonnenemes)\
**Post date:** [September 21, 2021, 6:47am UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/3 "2021-09-21T06:47:57Z")

</div>

Hi Kiruba,

We came across the same issue today. You might've already figured it out but just in case anyone else sees or comes across this, it seems like returning options.postResponseDataMap was what we needed to do. So we just modified each of the options.postResponseDataMap's array items (instead of creating a new array) with the data we needed and returned that same exact object back, i.e do this:

return options.postResponseMapData;

I hope this helps - good luck!

---

<div class="post-metadata">

**Author:** ![akberali](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@akberali](https://connective.celigo.com/u/akberali)\
**Post date:** [May 4, 2022, 7:47pm UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/4 "2022-05-04T19:47:16Z")

</div>

I have been running in the same issue, but I believe when you build the flow, make sure in postResponseDataMap you will have the same details as your request object.

Also, can you share your details if you solve the issue?

---

<div class="post-metadata">

**Author:** ![anithaabraham](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/anithaabraham/32/6964_2.png) [@anithaabraham](https://connective.celigo.com/u/anithaabraham)\
**Post date:** [May 5, 2022, 4:03pm UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/5 "2022-05-05T16:03:18Z")

</div>

Akber, you could check this updated [article](https://docs.celigo.com/hc/en-us/articles/360039655111-Hooks-for-integrator-io).

---

<div class="post-metadata">

**Author:** ![steveklett](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@steveklett](https://connective.celigo.com/u/steveklett)\
**Post date:** [July 11, 2022, 10:53pm UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/6 "2022-07-11T22:53:50Z")

</div>

@anithaabraham I went looking a the linked article but I don't see why you posted that link. It doesn't describe the `postResponseMap` function, it parameters or other requirements. Maybe I'm misunderstanding something. It would be nice if that article DID describe the function though because I'm here on the community pages trying to learn about how to use this function.

---

<div class="post-metadata">

**Author:** ![steveklett](https://avatars.discourse-cdn.com/v4/letter/s/e495f1/32.png) [@steveklett](https://connective.celigo.com/u/steveklett)\
**Post date:** [July 11, 2022, 11:00pm UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/7 "2022-07-11T23:00:58Z")

</div>

Interesting. The UI process to create a post response map function is odd. It seems you need to create the script record in the resource panel first, then come back and click the script icon on the export. Then you select the script file you created earlier. There is also a button to insert the function stub, which is nice because these are the docs I was wanting. Anyway, thought I'd share in case anyone else is struggling to create a postResponseMap script.

---

<div class="post-metadata">

**Author:** ![bhavikshah](https://sea1.discourse-cdn.com/flex001/user_avatar/connective.celigo.com/bhavikshah/32/8230_2.png) [@bhavikshah](https://connective.celigo.com/u/bhavikshah)\
**Post date:** [July 15, 2022, 11:29am UTC](https://connective.celigo.com/t/how-to-apply-ignored-to-false-in-postresponsemap-function/1174/8 "2022-07-15T11:29:06Z")

</div>

Here's the correct link for the article.   
  
  
[https://docs.celigo.com/hc/en-us/articles/5926315530139-Import-hooks#postResponseMapHook](https://docs.celigo.com/hc/en-us/articles/5926315530139-Import-hooks#postResponseMapHook)

The function needs to return the responseData array provided by options.responseData. The length of the responseData array **must** remain unchanged. Elements within the responseData array can be modified to enhance error messages, modify the complete \_json response data, etc...
