# IFRAME not appending variables to uri

**URL:** <https://community.hubspot.com/t/iframe-not-appending-variables-to-uri/84768>\
**Category:** APIs & Integrations\
**Tags:** sdk\
**Created:** [July 5, 2023, 9:46pm UTC](https://community.hubspot.com/t/iframe-not-appending-variables-to-uri/84768 "2023-07-05T21:46:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reiterth73](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/reiterth73/32/97040_2.png) [@reiterth73](https://community.hubspot.com/u/reiterth73)\
**Post date:** [July 5, 2023, 9:46pm UTC](https://community.hubspot.com/t/iframe-not-appending-variables-to-uri/84768/1 "2023-07-05T21:46:38Z")

</div>

Hi,

i’m trying to embed an iframe, but i don’t get the parameters appened as described here:

[https://app-eu1.hubspot.com/docs/139789941/doc/platform/create-custom-cards-with-projects#iframe](https://app-eu1.hubspot.com/docs/139789941/doc/platform/create-custom-cards-with-projects#iframe)

`exports.main = async (context, sendResponse) => { sendResponse({ sections: [{ type: 'text', text: 'Clicking the button will open a modal dialog with an iframe that displays the content at the provided URL.', }, { type: 'button', text: 'Open iframe', onClick: { type: 'IFRAME', // Width and height of the iframe (in pixels) width: 800, height: 600, uri: "https://www.example.com.cc/senttome", associatedObjectProperties : [ 'email',] }, }, ], });};`

I would expect the following src url:

[https://www.example.com.cc/senttome?email=displayed@user.com](https://www.example.com.cc/senttome?email=me@example.com)

But i get:

src=“[https://www.example.com.cc/senttome#https://app-eu1.hubspot.com](https://www.example.com.cc/senttome#https://app-eu1.hubspot.com)”

Any ideas?

Tom

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [July 6, 2023, 8:05am UTC](https://community.hubspot.com/t/iframe-not-appending-variables-to-uri/84768/2 "2023-07-06T08:05:27Z")

</div>

Hello @reiterth73  
It seems that the variables you’re trying to append to the URI of the iframe are not being included correctly. Instead of appending the variables as query parameters using the “?” symbol, it appears that the variables are being added as a fragment identifier using the “#” symbol.  
you can modify the URI parameter in your code to include the query parameters correctly.

```lia-code-sample
exports.main = async (context, sendResponse) => {
 sendResponse({
 sections: [
 {
 type: 'text',
 text: 'Clicking the button will open a modal dialog with an iframe that displays the content at the provided URL.',
 },
 {
 type: 'button',
 text: 'Open iframe',
 onClick: {
 type: 'IFRAME',
 // Width and height of the iframe (in pixels)
 width: 800,
 height: 600,
 uri: "https://www.example.com.cc/senttome?email=displayed@user.com",
 associatedObjectProperties : [
 'email',
 ] 
 },
 },
 ],
 });
};

```

With this modification, the email parameter will be correctly appended to the URI as a query parameter, resulting in the following URL:

```lia-code-sample
https://www.example.com.cc/senttome?email=displayed@user.com

```

Make sure to replace [displayed@user.com](mailto:displayed@user.com) with the actual email value you want to include in the URL.

---

<div class="post-metadata">

**Author:** ![reiterth73](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/reiterth73/32/97040_2.png) [@reiterth73](https://community.hubspot.com/u/reiterth73)\
**Post date:** [July 6, 2023, 11:03am UTC](https://community.hubspot.com/t/iframe-not-appending-variables-to-uri/84768/3 "2023-07-06T11:03:05Z")

</div>

@himanshurauthan thx for input.  
Sure if i hardcode the parameter it works.

But i want to fill the parameter dynamically

 ![image.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/c/d/cd7f04e482628a22eb51c3997eef68c251108c86.png)

if i click on “open iframe” the email form the current opened contact E-Mail should be appended, like described here:

 ![reiterth73_0-1688641312885.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/d/dd25aa3ac7205af3bbaa1a8ad7e7c2d05d783086.png)

---

<div class="post-metadata">

**Author:** ![reiterth73](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/reiterth73/32/97040_2.png) [@reiterth73](https://community.hubspot.com/u/reiterth73)\
**Post date:** [July 7, 2023, 3:58pm UTC](https://community.hubspot.com/t/iframe-not-appending-variables-to-uri/84768/4 "2023-07-07T15:58:21Z")

</div>

Finally I found a solution which works for me:

I added “propertiesToSend” to my card defintion

`{ "type": "crm-card", "data": { "title": "Info iframe", "location": "crm.record.sidebar", "fetch": { "targetFunction": "crm-card", "objectTypes": [{ "name": "contacts", "propertiesToSend": ["hs_object_id", "email", "lastname"] } ] } }}`

In the serverless function i use the following code:

`exports.main = async (context, sendResponse) => { sendResponse({ sections: [{ type: 'text', text: 'Clicking the button will open a modal dialog with an iframe with some parameters.', }, { type: 'button', text: 'Open iframe', onClick: { type: 'IFRAME', width: 800, height: 600, uri: "https://www.example.com?token=" + context.secrets.PRIVATE_APP_ACCESS_TOKEN + "&portal=" + context.portalId + "&user=" + context.user.userId + "&contact=" + context.propertiesToSend.hs_object_id, }, },], });};`
