27
Views
13
Comments
Solved
How to Get screen Title On client action.
Question
Application Type
Reactive

I want to get Screen Title and pass it into Exception Action.

1.Created Client Action

2. Get Title by Javascript

3.Need to Pass ScreenTitle in to Exception Action

Is it Possible?

Because I don't want to input the Title Name

2026-01-28 16-57-48
Mihai Melencu
Champion
Solution

Hi @Dilmi Amar ,

You can avoid using JavaScript by using a local variable for the screen title. For example, I use a local variable called Title to hold the screen's title. You can set its default value to whatever you need and use it wherever necessary. 


Alternatively, if you prefer to get the browser title using JavaScript, you can use a JavaScript node in your action with the following code:

I attached a sample OML for both use cases.

TitleSample.oml
UserImage.jpg
Dilmi Amar

Hi @Mihai Melencu 

Thank you

2016-04-22 00-29-45
Nuno Reis
 
MVP

You can save the Javascript output parameter to a variable in the action. That way the exception flow will have access to it.

UserImage.jpg
Łukasz Kaproń

You can try to use this Javascript code:


const pageTitle = document.title;

console.log(pageTitle); 

UserImage.jpg
Dilmi Amarasingha

Hi @Łukasz Kaproń 

How to assign outputparameter

UserImage.jpg
Łukasz Kaproń

You can do it this way:

Now you can you Output Parameter "pageTitle"


2026-01-28 16-57-48
Mihai Melencu
Champion
Solution

Hi @Dilmi Amar ,

You can avoid using JavaScript by using a local variable for the screen title. For example, I use a local variable called Title to hold the screen's title. You can set its default value to whatever you need and use it wherever necessary. 


Alternatively, if you prefer to get the browser title using JavaScript, you can use a JavaScript node in your action with the following code:

I attached a sample OML for both use cases.

TitleSample.oml
UserImage.jpg
Dilmi Amar

Hi @Mihai Melencu 

Thank you

2024-06-07 22-37-38
Adriano Angeli

Complementing @Nuno Reis comment...

1) Create a client action.


2) Implement the logic to get a page title. (You can use the code passed by @Łukasz Kaproń)


3) Change the funtion parameter to Yes.


4) Call the function in the title parameter of your page.


2016-04-22 00-29-45
Nuno Reis
 
MVP

Why read the page title to use it as page title? The goal was to use it in the error message.

2024-06-07 22-37-38
Adriano Angeli


@Nuno Reis I think he wanted to read the title of the page, because, as we can see, @Dilmi Amar  considered @Mihai Melencu answer as resolved.

 
Both @Mihai Melencu answer and mine achieve the same goal.

2016-04-22 00-29-45
Nuno Reis
 
MVP

The difference is that you don't have a title set when you do document.title so you will not have the title in the function.

I would move that call in point 4 to inside the exception handler.

2025-11-18 12-43-07
Mariana Junges
Champion

The platform's best practices indicate that we should avoid using JS if we have another way to solve the problem and obtain the same result, so I believe that saving it to a variable and using the variable in both places would be more appropriate.

2016-04-22 00-29-45
Nuno Reis
 
MVP

That's why I disagree with most suggestions. It works... If nothing edits the title on runtime. And if nothing edits the title, you don't need to get it as you already know it.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.