Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to get the current pagepath in service

Avatar

Avatar
Level 1
vijithar4145255
Level 1

Likes

0 likes

Total Posts

15 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
vijithar4145255
Level 1

Likes

0 likes

Total Posts

15 posts

Correct Reply

0 solutions
View profile
vijithar4145255
Level 1

08-02-2021

I have used the below code to get the currentpagepath in modal but if I use same code in service it is not working nd currentpage value I am getting null. Can anyone help on this.

 

@ScriptVariable
protected Page currentPage;

 

public string getCurrenPath() {

String currentPagePath = currentPage.getPath();

return currentPagePath;

}

View Entire Topic

Avatar

Avatar
Validate 1
Level 6
KiranVedantam1992
Level 6

Likes

148 likes

Total Posts

150 posts

Correct Reply

42 solutions
Top badges earned
Validate 1
Establish
Give Back 3
Give Back
Boost 50
View profile

Avatar
Validate 1
Level 6
KiranVedantam1992
Level 6

Likes

148 likes

Total Posts

150 posts

Correct Reply

42 solutions
Top badges earned
Validate 1
Establish
Give Back 3
Give Back
Boost 50
View profile
KiranVedantam1992
Level 6

08-02-2021

Hi @vijithar4145255,

 

As per your comments, assuming you have request object, you can get the page URL like this:

Enumeration values = request.getHeaders(REFERER);

while (values.hasMoreElements()) {
pageURL = values.nextElement().toString();
}

Once you get the URL, you can trim it and fetch the path.

 

Hope this helps.

 

Thanks,

Kiran Vedantam.