Hi everyone,
In runtime, how can I know the name of the app (not module) that:
1) the running function/ action belongs to? E.g. how can I make a "GetAppName()" function that lives inside the app "ToDo_Core" that returns a string with the app name?
2) is the top-most app being executed? E.g. a user launching the "ToDo" app that internally calls a "ToDo_Core" app that has a "ToDo_Core/GetAppName()" function that should return the string "ToDo" (the name of the app that was originally run by the user). Something similar to "GetEntryEspaceName()".
This you can find in Rich widget
GetApplicationName(GetOwnerEspaceIdentifier())
Regards
-PJ-
Pramod Jain wrote:
thanks this is helpful. I used it and it is returning app name
Does GetEntryEspaceName() is not solving you purpose ?
Hi Pramod, the GetEntryEspaceName() gives me the module (eSpace) name. I want the name of the app that the module belongs to.
Here you go,
Try this it should give you the correct output.
SyntaxEditor Code Snippet
GetApplicationName... I don't find that function. Is it a System function?
How can I know the application from the eSpaceId? Only by querying the meta model tables? Isn't there a more efficient way?
Hi Kelson,
Querying the meta model is indeed the only way to get the current Application name, afaik.
Hi,
Let's consider the following scenario:
This means that GetApplicationName returns rather static name, not a really runtime application name.
Is there a way to obtain from GetCurrentApplicationName, called from AppA and AppB, the answers: "AppA" and "AppB", accordingly?
Tomasz
Hi Tomasz. The code that you are describing is correct - when the GetOwnerEspaceIdentifier executes, it returns the "tools" module, no matter what app calls it. There's no way to retrieve the module that called the "tools" module.
You may try using GetApplicationName(GetEntryEspaceId()) instead and see if that works for you. The difference is that:
Nice info Leonardo.
I was exploring a little further based on that and realized that those functions only exist on the server side.
On a mobile app you can't get that info only by calling client side actions.
So I did the following app:
The "Other Module" contains a server action that calls GetApplicationName(GetEntryEspaceId()).
So, I did a screen with three options:
The results are:
Cheers,
Renato
leonardo.fernandes wrote:
Leonardo,
GetEntryEspaceId work as expected. It is not a solution for all cases (it fails when using a screen shared by several applications) but in many cases it is good enough.
What do you mean with "having a screen shared by several applications"? Screens can only be shared by redirecting to it. If you have been redirected to a screen that belongs to Application A, then you *are* in Application A, no matter where did you came from.
Yes, of course. Therefore, when I reach from AppA for a screen from AppB, I must manually supply ApplicationId. It's just a statement.
Good to see that it solved your issue .. you can mark the post as solution .
Regards,
@Pramod: he can't, he's not the original poster of this topic :).