> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getfunctioncalledname.md).

# GetFunctionCalledName

Get the name of the function that is being called.

If no function is being called, an empty string is returned.

## Method Signature

```
GetFunctionCalledName()
```

### Arguments

This function does not accept any arguments

## Examples

### getFunctionCalledName Basic Example

Show results of calling a function directly versus by reference

[Run Example](https://try.boxlang.io/?code=eJydjrEOgjAQhmf7FBdYYHJxkspi4qiLL3CWA5rUlpQrDMZ3V1A0Jp0c77%2Fv%2F%2FKLwekK6mAVa2cBFQc0h%2Fd5xCtlOdzEavSa6RS4C5xBEqVG7EGhMVQB9ltIG%2BKF2M%2Fxi0vlxZcJ5IW4i1%2BrbH0p20050do20S1y%2FQTmduxb%2FGGEQSN4qsmTVfT1f6KzWwqwixii5DTlAWJed%2FI%3D)

```java

void function actualFunctionName() {
	writeOutput( "actualFunctionName() was called as: #getFunctionCalledName()#<br>" );
}
writeOutput( "<hr><h4>Calling actualFunctionName()</h4>" );
actualFunctionName();
writeOutput( "<hr><h4>Calling actualFunctionName() via reference</h4>" );
referenceToFunction = actualFunctionName;
referenceToFunction();

```

### Getters and Setters Example

Example of using getFunctionCalledName to create dynamic getters and setters

```java
//callednamedemo.bx
component
{
    variables.x1 = 1;
    variables.y1 = 2;

    function init() {
        return this;
    }

    function get() {
        var name = getFunctionCalledName();
        return variables[mid(name,4,len(name)-3)];
    }

    function set(value) {
        var name = getFunctionCalledName();
        variables[mid(name,4,len(name)-3)] = value;
    }

    this.getX1 = get;
    this.getY1 = get;
    this.setX1 = set;
    this.setY1 = set;
}

<!--- calledname.bxm --->

<bx:script>

	function test() {
		return getFunctionCalledName();
	}
	writeOutput( test() & "<br>" ); // test
	a = test;
	writeOutput( variables.a() & "<br>" ); // a
	o = new callednamedemo();
	// shows *real* methods get(), SetX1() and getY1(), etc.
	writeDump( o );
	o.setX1( 10 );
	o.setY1( 20 );
	writeOutput( o.getX1() & "<br>" ); // 10
	writeOutput( o.getY1() & "<br>" );
</bx:script>
 <!--- 20 --->
```

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJxljs0KwjAQhM%2FNUww5pSD0AUIEETz6Dmua1kJ%2BSn%2BUIL67SVpB8LTszDc7G421UBA4%2BQhPzqCGOuLFKqPvQeySZFW7ulHgQZPqzXJZvV6G4M9krWmviRH1AZZuxir%2BNfGkGboQoJnnK2%2FJYioU4HkUaaaY%2BvMq0TTQYYzo9gvZTGxGuik4lEDcPk7ifwDU0%2BB%2FO7Zggkv2A8H8Sts%3D)

```java
yell = ( Any name ) => {
	echo( name );
	dump( var=getFunctionCalledName(), label="Function was called as" );
};
yell( "yell" );
say = yell; // copy function
say( "say from " );
yell = say; // copy function again
yell( "yell from say" );

```

## Related

* [ApplicationRestart](/boxlang-language/reference/built-in-functions/system/applicationrestart.md)
* [ApplicationStartTime](/boxlang-language/reference/built-in-functions/system/applicationstarttime.md)
* [ApplicationStop](/boxlang-language/reference/built-in-functions/system/applicationstop.md)
* [BoxAnnounce](/boxlang-language/reference/built-in-functions/system/boxannounce.md)
* [BoxAnnounceAsync](/boxlang-language/reference/built-in-functions/system/boxannounceasync.md)
* [BoxAST](/boxlang-language/reference/built-in-functions/system/boxast.md)
* [BoxModuleReload](/boxlang-language/reference/built-in-functions/system/boxmodulereload.md)
* [BoxRegisterInterceptionPoints](/boxlang-language/reference/built-in-functions/system/boxregisterinterceptionpoints.md)
* [BoxRegisterInterceptor](/boxlang-language/reference/built-in-functions/system/boxregisterinterceptor.md)
* [BoxRegisterRequestInterceptor](/boxlang-language/reference/built-in-functions/system/boxregisterrequestinterceptor.md)
* [BoxUnregisterInterceptor](/boxlang-language/reference/built-in-functions/system/boxunregisterinterceptor.md)
* [BoxUnregisterRequestInterceptor](/boxlang-language/reference/built-in-functions/system/boxunregisterrequestinterceptor.md)
* [CallStackGet](/boxlang-language/reference/built-in-functions/system/callstackget.md)
* [CreateGUID](/boxlang-language/reference/built-in-functions/system/createguid.md)
* [CreateObject](/boxlang-language/reference/built-in-functions/system/createobject.md)
* [CreateUUID](/boxlang-language/reference/built-in-functions/system/createuuid.md)
* [DE](/boxlang-language/reference/built-in-functions/system/de.md)
* [DebugBoxContexts](/boxlang-language/reference/built-in-functions/system/debugboxcontexts.md)
* [Dump](/boxlang-language/reference/built-in-functions/system/dump.md)
* [Duplicate](/boxlang-language/reference/built-in-functions/system/duplicate.md)
* [echo](/boxlang-language/reference/built-in-functions/system/echo.md)
* [EncodeForHTML](/boxlang-language/reference/built-in-functions/system/encodeforhtml.md)
* [GetApplicationMetadata](/boxlang-language/reference/built-in-functions/system/getapplicationmetadata.md)
* [GetBaseTagData](/boxlang-language/reference/built-in-functions/system/getbasetagdata.md)
* [GetBaseTagList](/boxlang-language/reference/built-in-functions/system/getbasetaglist.md)
* [GetBaseTemplatePath](/boxlang-language/reference/built-in-functions/system/getbasetemplatepath.md)
* [GetBoxContext](/boxlang-language/reference/built-in-functions/system/getboxcontext.md)
* [GetBoxRuntime](/boxlang-language/reference/built-in-functions/system/getboxruntime.md)
* [GetBoxVersionInfo](/boxlang-language/reference/built-in-functions/system/getboxversioninfo.md)
* [GetClassMetadata](/boxlang-language/reference/built-in-functions/system/getclassmetadata.md)
* [GetComponentList](/boxlang-language/reference/built-in-functions/system/getcomponentlist.md)
* [GetContextRoot](/boxlang-language/reference/built-in-functions/system/getcontextroot.md)
* [GetCurrentTemplatePath](/boxlang-language/reference/built-in-functions/system/getcurrenttemplatepath.md)
* [GetFileFromPath](/boxlang-language/reference/built-in-functions/system/getfilefrompath.md)
* [GetFunctionList](/boxlang-language/reference/built-in-functions/system/getfunctionlist.md)
* [GetModuleInfo](/boxlang-language/reference/built-in-functions/system/getmoduleinfo.md)
* [GetModuleList](/boxlang-language/reference/built-in-functions/system/getmodulelist.md)
* [GetModuleTree](/boxlang-language/reference/built-in-functions/system/getmoduletree.md)
* [GetRequestClassLoader](/boxlang-language/reference/built-in-functions/system/getrequestclassloader.md)
* [GetSemver](/boxlang-language/reference/built-in-functions/system/getsemver.md)
* [GetSystemSetting](/boxlang-language/reference/built-in-functions/system/getsystemsetting.md)
* [GetTempDirectory](/boxlang-language/reference/built-in-functions/system/gettempdirectory.md)
* [GetTickCount](/boxlang-language/reference/built-in-functions/system/gettickcount.md)
* [htmlEditFormat](/boxlang-language/reference/built-in-functions/system/htmleditformat.md)
* [IIF](/boxlang-language/reference/built-in-functions/system/iif.md)
* [Invoke](/boxlang-language/reference/built-in-functions/system/invoke.md)
* [IsInstanceOf](/boxlang-language/reference/built-in-functions/system/isinstanceof.md)
* [JavaCast](/boxlang-language/reference/built-in-functions/system/javacast.md)
* [ObjectDeserialize](/boxlang-language/reference/built-in-functions/system/objectdeserialize.md)
* [ObjectSerialize](/boxlang-language/reference/built-in-functions/system/objectserialize.md)
* [PagePoolClear](/boxlang-language/reference/built-in-functions/system/pagepoolclear.md)
* [Print](/boxlang-language/reference/built-in-functions/system/print.md)
* [Println](/boxlang-language/reference/built-in-functions/system/println.md)
* [RunThreadInContext](/boxlang-language/reference/built-in-functions/system/runthreadincontext.md)
* [SessionInvalidate](/boxlang-language/reference/built-in-functions/system/sessioninvalidate.md)
* [SessionRotate](/boxlang-language/reference/built-in-functions/system/sessionrotate.md)
* [SessionStartTime](/boxlang-language/reference/built-in-functions/system/sessionstarttime.md)
* [Sleep](/boxlang-language/reference/built-in-functions/system/sleep.md)
* [SystemCacheClear](/boxlang-language/reference/built-in-functions/system/systemcacheclear.md)
* [SystemExecute](/boxlang-language/reference/built-in-functions/system/systemexecute.md)
* [SystemOutput](/boxlang-language/reference/built-in-functions/system/systemoutput.md)
* [Throw](/boxlang-language/reference/built-in-functions/system/throw.md)
* [Trace](/boxlang-language/reference/built-in-functions/system/trace.md)
* [URLDecode](/boxlang-language/reference/built-in-functions/system/urldecode.md)
* [URLEncodedFormat](/boxlang-language/reference/built-in-functions/system/urlencodedformat.md)
* [writeDump](/boxlang-language/reference/built-in-functions/system/writedump.md)
* [WriteLog](/boxlang-language/reference/built-in-functions/system/writelog.md)
* [WriteOutput](/boxlang-language/reference/built-in-functions/system/writeoutput.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/system/getfunctioncalledname.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
