# How do I call an OH3 UI script from a rule

**URL:** <https://community.openhab.org/t/how-do-i-call-an-oh3-ui-script-from-a-rule/113274>\
**Category:** Scripts & Rules\
**Created:** [January 7, 2021, 1:33am UTC](https://community.openhab.org/t/how-do-i-call-an-oh3-ui-script-from-a-rule/113274 "2021-01-07T01:33:57Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [January 7, 2021, 3:22am UTC](https://community.openhab.org/t/how-do-i-call-an-oh3-ui-script-from-a-rule/113274/2 "2021-01-07T03:22:34Z")

</div>

> [@diddie17](#):
>
> I have a common piece of JS code that needs to be called from a number of rules, that I have tested and working in the OH3 UI Scripts interface. I just can’t work out how to actually call the script from a rule.

A library or a Script (as shown in the Script page in MainUI). If the latter, you can’t find the ID because it’s not a Rule so it doesn’t have an ID. If the latter, why not the former? See [OH 3 Examples: Writing and using JavaScript Libraries in MainUI created Rules](https://community.openhab.org/t/oh-3-examples-writing-and-using-javascript-libraries-in-mainui-created-rules/108526).

If you have a Script (i.e. it’s defined through the UI and appears in the list on the Script page, I don’t know how much I can help without more information.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/4/6/464a8fb8c2eafb232f2373d12cebfd467686e626.png)

I’ve circled the UID of the Create Rule Example in the screen shot above. That’s the ID you need to use.

---

_[View the full topic](https://community.openhab.org/t/how-do-i-call-an-oh3-ui-script-from-a-rule/113274)._
