The CreatorCon Call for Content is officially open! Get started here.

UI Page Help !!

vidishaagarwal5
Tera Contributor

How we can access parameter from UI action to Ui Page?

2 ACCEPTED SOLUTIONS

Ravi Gaurav
Giga Sage
Giga Sage

Hi @vidishaagarwal5 

 

Example: pass parameter from UI action as shown below:

 

RaviGaurav_1-1760074867246.png

 

Method 1: Access parameter in html code.

We can attach value to html tag directly by using below syntax:
value="${sysparm_number}
Access parameter in UI Page HTML Code as shown below:
--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

Ravi Gaurav
Giga Sage
Giga Sage

Hi @vidishaagarwal5 

There are another methods..

 

Method 2: Access parameter in UI Page client script.

Access parameter in UI Page Client Script Code as shown below:

RaviGaurav_2-1760075028178.png

Note: remember to always use variable name starting with sysparm_xxxxx

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

5 REPLIES 5

Ravi Gaurav
Giga Sage
Giga Sage

Hi @vidishaagarwal5 

 

Example: pass parameter from UI action as shown below:

 

RaviGaurav_1-1760074867246.png

 

Method 1: Access parameter in html code.

We can attach value to html tag directly by using below syntax:
value="${sysparm_number}
Access parameter in UI Page HTML Code as shown below:
--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

M Iftikhar
Giga Sage

@vidishaagarwal5 ,

  // Get sys_id of the current record
    var sysId = current.getUniqueValue();
	var tableName = current.getTableName(); 

	// Get the current view name
    var viewName = action.getGlideURI().get("sysparm_view");
    if (!viewName) {
        viewName = "default"; // fallback if no view specified
    }

    // Build Service Portal URL (use your page ID: test)
    var portalPage = gs.getProperty('glide.servlet.uri') + 'sp?id=test&table=' + tableName + '&sys_id=' + sysId + '&view=' + viewName;

    // Redirect user to Service Portal page
    action.setRedirectURL(portalPage);

 

Above UI action script redirects with sys_id, table, view of record - update it for your use case, place this code under script section of your UI action.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

@M Iftikhar it didn't work for me

Ravi Gaurav
Giga Sage
Giga Sage

Hi @vidishaagarwal5 

There are another methods..

 

Method 2: Access parameter in UI Page client script.

Access parameter in UI Page Client Script Code as shown below:

RaviGaurav_2-1760075028178.png

Note: remember to always use variable name starting with sysparm_xxxxx

 

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

ï”— YouTube: https://www.youtube.com/@learnservicenowwithravi
ï”— LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/