setTargetPage

From AgileApps Support Wiki
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
 Functions.setTargetPage("Service?t=923&targetpage=ChangeSecurityQuestion.jsp");
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"); 
			}
	}  
}

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