The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, 16 July 2013

Controlling PeopleTools delivered Action Buttons

Each of the components you create in PeopleSoft has its own business case and user expectations behind it. You might want to allow user to save the pages for some components, in some cases it should be display only. There are scenarios where user coming into a component needs to go through the next or previous items listed in the search page without going back to the search page. Sometimes for some selected components user should be able to go back to the search page by clicking Return to Search button, but for some components it is not desired.

The question is how to enable or disable these buttons to the actual page which user sees. To address this scenario PeopleSoft has delivered some kind of facility by providing the options in the component properties in the Internet tab.

PeopleSoft Component Internet Properties

But these features may not be handy in all the scenarios. Enabling these properties will be static and will be applied across the components. What if you have a scenario where you have five pages in the component and you want to Enable the Save button for one page and not for the rest of the page?

In such cases a work around would be handy. You can do that feature with the help of an HTML area and javascript. Suppose your requirement is to hide the delivered Save button from a particular page in the component. Then all you have to do is to add an HTML area to that particular page. Select the properties of the HTML area and select the option Constant. Now insert the following piece of script into the script area as shown below and save the page. That’s it you have successfully customized that particular page in the component to hide the Save button.

JavaScript
<script language="javascript">
document.getElementById("#ICSave").style.display = 'none';
</script>


HTML area and JavaScript

Replace the code with the below piece of codes to hide other Tools delivered action buttons.

Add Button

<script language="javascript">
document.getElementById("#ICAdd").style.display = 'none';
</script>

Update/Display Button

<script language="javascript">
document.getElementById("#ICUpdate").style.display = 'none';
</script>

Return To Search Button

<script language="javascript">
document.getElementById("#ICList").style.visibility = "hidden";
</script>

Notify Button

<script language="javascript">
document.getElementById("#ICSendNotify").style.visibility = "hidden";
</script>

Sometimes this page can be associated with multiple components and you want to hide the button in one component and not in another component. In such cases you can assign the HTML area to a record field and assign the HTML code dynamically using PeopleCode.


Even though you have these workarounds available, I advice to use it only if you do not have any other choice. Even if you use it, use this only for your Custom pages. If you modify the delivered page, it may impact your application support. The main drawback with this approach is, your page have a chance to get broken when you do a PeopleTools update or when you change your style sheets. As long as you have tested with your current page and the Tools release is going to be the same, you are somewhat in a safer zone.

So what are other safe options available? One option you can consider is to create your own custom buttons for Save, Add etc and disable the corresponding tools buttons from the component properties. Now you can hide or unhide these buttons using normal PeopleCode. But yes, this method comes with its own difficulty of writing the desired code for each of the functions to which the buttons are tagged. If you are planning to place these buttons on a delivered page, it is going to be considered as a customization and be aware of it.


I know this is not the end of the road. If you have any better alternative of achieving these functionalities, feel free to drop in your ideas in the comments section.

5 comments:

  1. what is the cancel id button in secondary page?

    ReplyDelete
  2. This shouldn't be done.

    I am facing the issue with using javascript. This is a security breach because a developer can go to Browser Debugger and play with your javascript code.

    Regards
    Karmveer

    ReplyDelete
    Replies
    1. Agree with you Karmveer. The intention of the post is to throw up ideas on how to go beyond app designer and not to exactly implement the code samples.

      Changing the display property to none can cause potential security problems in certain cases as you have rightly pointed out. In such scenarios, you should think of other options such as looping through DOM and remove that element based on ID, passing the ID as parameter and not exposing it to the end user and so on.

      And finally opt this method only if you have to control these buttons only for certain pages within the component. Which obviously states that these buttons are available on the other pages and user could do the action (say Save) from one of the other pages in the component. So in such use cases the chances of security issues also remains lower.

      Delete
  3. This is not working for me.
    Please suggest

    ReplyDelete
  4. Nice post. I was checking constantly this blog and I am impressed! Extremely helpful information specially the last part I care for such info a lot. I was seeking this particular information for a very long time. Thank you and good luck. Click Here

    ReplyDelete

Note: only a member of this blog may post a comment.

Followers