# Custom Method from expression

**URL:** <https://forum.inductiveautomation.com/t/custom-method-from-expression/10142>\
**Category:** Ignition\
**Created:** [June 17, 2015, 7:54am UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142 "2015-06-17T07:54:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [June 17, 2015, 7:54am UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142/1 "2015-06-17T07:54:21Z")

</div>

I have a Custom Method on the Root Container called “GetText” that does a calculation that I would like to display as text in a label. When I have a project script that I want to run from a label express i use the runScript function with something like this:  
runScript(“project.GetText()”)  
but how do i call a script that is a Custom Method?

I have tried the following but none of them work:  
runScript(“GetText()”)  
runScript(“self.GetText()”)  
runScript(“parent.GetText()”)

Any help appreciated.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 17, 2015, 12:28pm UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142/2 "2015-06-17T12:28:06Z")

</div>

You can’t. ☹ The runScript() expression function only exposes the system._, project._, and shared.\* namespaces to the given script expression.

Passing a ‘this’ object sounds like a useful feature. Maybe you should put in a [feature request](http://ideas.inductiveautomation.com/)?

---

<div class="post-metadata">

**Author:** ![DavidWisely](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/davidwisely/32/10482_2.png) [@DavidWisely](https://forum.inductiveautomation.com/u/DavidWisely)\
**Post date:** [June 17, 2015, 1:59pm UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142/3 "2015-06-17T13:59:58Z")

</div>

Thanks for the info Phil.  
I’ll try a different tack.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 14, 2018, 8:15pm UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142/4 "2018-08-14T20:15:46Z")

</div>

Note to newcomers: as of v7.8, runScript supports the self keyword in component bindings.

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [August 21, 2019, 8:29am UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142/5 "2019-08-21T08:29:28Z")

</div>

Hello Phil, so is this now possible?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 21, 2019, 11:15am UTC](https://forum.inductiveautomation.com/t/custom-method-from-expression/10142/6 "2019-08-21T11:15:24Z")

</div>

Sort of. The custom methods of the component where the binding is placed are available to runScript(). They wouldn’t be available to bindings on another component. To have complete flexibility on what you can call, you still need my objectScript function.
