Difference between revisions of "SetTargetPage"

From AgileApps Support Wiki
Line 10: Line 10:


:;Example:
:;Example:
:This code causes the Setup page (s=641) to be displayed.
<pre>
setTargetPage("Service?t=641&top_tab=none");
</pre>


Perform the following steps to display the security page:<br>
Perform the following steps to display the security page:<br>
Line 48: Line 43:
8. Click the '''Edit''' button to update any user details.<br>
8. Click the '''Edit''' button to update any user details.<br>
9. Click '''Save'''.<br>
9. Click '''Save'''.<br>
10. Now, the security page appears as the target page.
'''Result''': When user clicks on the Save button, the security page appears.


<noinclude>[[Category:Utility]]</noinclude>
<noinclude>[[Category:Utility]]</noinclude>

Revision as of 05:23, 15 March 2024

setTargetPage(String URL)
Description
Performs the action of clicking a link in the UI via the Java API
Sets the target page, URL is the relative path
Syntax
void setTargetPage(String URL)
Return
None
Example

Perform the following steps to display the security page:
1. Go to Configuration > Customization > Developer Resources > Classes > New Class.
2. Create the class with the following code.

package com.platform.nmag3.nmjip;
import com.platform.api.*;
public class Redirect
{
	public void setTargetAPIPageTest(Parameters params)throws Exception
	{
			try
			{ 
				Functions.setTargetPage("Service?t=923&targetpage=ChangeSecurityQuestion.jsp");
			}
			catch(Exception exp)
			{ 
				throw new Exception("setTargetAPIPageTest() method failed in JAVAAPITestClass"); 
			}
	}  
}

2. Go to Configuration > System Objects > User Business Rules.
3. Add a business rule for the Update event.
4. Ensure that you select the Unconditionally (Always) option in the Execution Criteria field.
5. Under actions to perform, select Invoke Method from the dropdown.
6. Select the class name as Redirect and choose method name as setTargetAPIPageTest() [class created in the step 2].
6. Save the Rule.
7. Go to Configuration > Access Management > Users.
8. Click the Edit button to update any user details.
9. Click Save.
10. Now, the security page appears as the target page.