# How to refresh section conditionally by using javascript in customized control

**URL:** <https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703>\
**Category:** User Experience\
**Tags:** 7-3, user-experience, pega-academy\
**Created:** [October 14, 2020, 5:48am UTC](https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703 "2020-10-14T05:48:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AKASHA50](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AKASHA50](https://forums.pega.com/u/AKASHA50)\
**Post date:** [October 14, 2020, 5:48am UTC](https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703/1 "2020-10-14T05:48:33Z")

</div>

Hi,

I have a customized control written in javascript and after performing some user action, post changing the clipboard property value when I will click on that control then section should be get refreshed based on that property value.

Can you help me on this.

Thanks,

AKash

---

<div class="post-metadata">

**Author:** ![Chandan\_U](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@Chandan\_U](https://forums.pega.com/u/Chandan_U)\
**Post date:** [October 14, 2020, 10:28am UTC](https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703/2 "2020-10-14T10:28:36Z")

</div>

Hi,

Assuming your UI Control is a link or action performing control, we can add the refresh the section/Other section / Harness in the Action tab of that property, by specifying the when condition.

 ![Referance.png](https://pega1.discourse-cdn.com/pega/original/2X/2/27f91826460caecbb20b77f754521b7bd10bfec6.png)

Thanks

Chandan U

---

<div class="post-metadata">

**Author:** ![AKASHA50](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@AKASHA50](https://forums.pega.com/u/AKASHA50)\
**Post date:** [October 14, 2020, 10:34am UTC](https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703/3 "2020-10-14T10:34:49Z")

</div>

Thanks Chandan but in customized control we can’t add WHEN conditions. I have already tried it. Even I doubt that it would perform those mentioned actions or not..!

---

<div class="post-metadata">

**Author:** ![Chandan\_U](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@Chandan\_U](https://forums.pega.com/u/Chandan_U)\
**Post date:** [October 14, 2020, 10:36am UTC](https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703/4 "2020-10-14T10:36:59Z")

</div>

Hi Akash,

Can you share the Screenshot on how the control configuration is done? will help me to triage it more.

Thanks

Chandan U

---

<div class="post-metadata">

**Author:** ![duraisankar](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/duraisankar/32/7894_2.png) [@duraisankar](https://forums.pega.com/u/duraisankar)\
**Post date:** [October 14, 2020, 11:51am UTC](https://forums.pega.com/t/how-to-refresh-section-conditionally-by-using-javascript-in-customized-control/703/5 "2020-10-14T11:51:21Z")

</div>

Hi Akash,

You can use Pega JS refresh API into your JS code to refresh the section conditionally. [Pegasystems Documentation](https://community.pega.com/knowledgebase/articles/user-interface/refreshsection-public-js-api-control-actions)

```auto
function refresh_section_from_control(){
var options = { 
event: event
};
pega.api.ui.actions.refreshSection(options);
}

```

The above function refreshes the current section of the control when the function is called. You can call **refresh\_section\_from\_control()** function based on your logic inside the code.

Let me know if you have any more questions. Good Luck!
