Wednesday, 21 September 2016

Creating a Custom Button using PR file

Hello All,

Recently i had a requirement where i was required to add a new button on List applet to perform some update operation. This is very basic requirement and can be easily done by creating a button at applet control and associating a script to perform the desired operation.

This time i thought to work without a SRF recompile, so i tried this with PR file and i actually saved a lot of time and learned something new.

Actual Requirement was like :

  • Need to Create a button in the Highlighted area








  • Button Created using PR







Sample PR Code :









explanation of Code :

var id1 = this.GetPM().Get("GetFullId") + '-siebui-cust-Validate-btn' , Id which we are assigning to the button 


var ValidateBttn = "<button " +  
  "id= '" + id1 + "' " +  
  "class= 'siebui-ctrl-btn appletButton' " +  
  "aria-label=Validate" +  
  "type=\"button\" " +  
  "data-display=\"Active\" " + 
          "title=Validate" + ">" + "Validate" + "</button>" , code for custom button here we have defined Id, Label and Title for this button


.find(".siebui-icon-find").append(ActivateMemberBttn) , code finds Object with class siebui-icon-find and adds button near this object

to find the Place holder for button :








  • Click fn + F12 to open browser console
  • Select the element after which you want to place control
  • Look for its class, can be found under (Class : "") tag 
  • make sure the class is unique i.e. used only once in the current div else it will result in Creation of multiple buttons
Now complete you PR file and write any code you want to perform in your PR on button click event.
Register PR in Manifest Administration and you are good to go.

Hope this was helpful ...

3 comments:

  1. I think you got typo in the script, shouldn't be there "ValidateBttn" instead of "ActivateMemberBttn" ?

    ReplyDelete
  2. how would you try and search for a buttons id without going into the inspect element and looking it up?

    ReplyDelete
  3. Seven suggestions for powerful writing and accessing more creativity. Unique ways to eliminate writer's block and increase enthusiasm for the writer's journey. https://www.zhitomir.info/news_198441.html

    ReplyDelete

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...