AgileApps Support Wiki Pre Release

Difference between revisions of "SetTargetPage"

From AgileApps Support Wiki
imported>Aeric
 
Line 12: Line 12:
:This code causes the Setup page (s=641) to be displayed.
:This code causes the Setup page (s=641) to be displayed.


::{| border="0" cellpadding="5" cellspacing="0"
<pre>
|<pre>
  setTargetPage("Service?t=641&top_tab=none");
  setTargetPage("Service?t=641&top_tab=none");
</pre>
</pre>
|}
 
Perform the following steps:<br>
1. Create the below class in the Developer Resources.
 
<pre>
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");
}
}
</pre>
 
2. Go to '''Configuration > System Object > User Business Rules'''.<br>
3. Add a business rule for the Update event.<br>
4. Add a new Action called Invoke Method and select class name as Redirect and choose method name as setTargetAPIPageTest().<br>
5. Save the Rule.<br>
6. Go to '''Configuration > Access Management > Users'''.<br>
7. Select any User.<br>
8. Try to Edit and Save.<br>
'''Result''': When user clicks on the Save button, the security page appears.


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

Revision as of 10:23, 14 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
This code causes the Setup page (s=641) to be displayed.
 setTargetPage("Service?t=641&top_tab=none");

Perform the following steps:
1. Create the below class in the Developer Resources.

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 Object > User Business Rules.
3. Add a business rule for the Update event.
4. Add a new Action called Invoke Method and select class name as Redirect and choose method name as setTargetAPIPageTest().
5. Save the Rule.
6. Go to Configuration > Access Management > Users.
7. Select any User.
8. Try to Edit and Save.

Result: When user clicks on the Save button, the security page appears.