AgileApps Support Wiki Pre Release

Difference between revisions of "SetTargetPage"

From AgileApps Support Wiki
 
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:


;Syntax:
;Syntax:
  void setTargetPage(String URL)
:<syntaxhighlight lang="java" enclose="div">
  Functions.setTargetPage("Service?t=923&targetpage=ChangeSecurityQuestion.jsp");
</syntaxhighlight>


;Return:None
;Return:None


:;Example:
:;Example:
:This code causes the Setup page (s=641) to be displayed.


<pre>
Perform the following steps to display the security page:<br>
setTargetPage("Service?t=641&top_tab=none");
1. Go to '''Configuration > Customization > Developer Resources > Classes > New Class'''.<br>
</pre>
2. Create the class with the following code.


Perform the following steps:<br>
:<syntaxhighlight lang="java" enclose="div">
1. Create the below class in the Developer Resources.
 
<pre>
package com.platform.nmag3.nmjip;
package com.platform.nmag3.nmjip;
import com.platform.api.*;
import com.platform.api.*;
Line 36: Line 34:
}   
}   
}
}
</pre>
</syntaxhighlight>


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


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

Latest revision as of 05:30, 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
<syntaxhighlight lang="java" enclose="div">
Functions.setTargetPage("Service?t=923&targetpage=ChangeSecurityQuestion.jsp");

</syntaxhighlight>

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.

<syntaxhighlight lang="java" enclose="div">

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"); } } } </syntaxhighlight>

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.