on 2017-08-09 12:05 PM
With the help/input of Nolan Nosari , David Petty , and Jeff Letterman,
I was able to create an alternative Save and Close button.
*** Nolan had already created something and I want to give the bulk of the credit for my code to Nolan.
Nolan had a very slick idea of adding an html element and then using javascript to modify that button.
https://community.rsa.com/message/896348?commentID=896348#comment-896348
This option will work fine, for the most part. However, I did notice one tiny hiccup for me. I had attachment fields on the form where I wanted to add my save and close. When adding an attachment, the iframe would refresh and cause a 2nd html save and close button to appear on the layout.
This alternative method uses all javascript to create the html element and alter its properties. It also checks for the existence of our element. So, if it was already created, no need to do it again (on a refresh).
Also, using Jeff's input, I was able to use an HTML 5 object called sessionStorage to add a "flag" or an attribute to the record that helps you to close the record after the save.
I believe Nolan's method was using cookies. Which works just fine, but I just wanted an alternative and using Jeff's input, I used the sessionStorage object.
David contributed to helping me fix my icon issue. ...While using javascript to create my element, I was not "escaping" my html characters correctly and my icon wasn't being rendered. David provided a snippet with the corrected identifier.
Find the code attached below.
*insert all disclaimers here... I take no responsibility for use of this code. This is just loaded here to acknowledge the wonderful sharing members of the community and post my final output of all their help.
Thanks again guys!
Next task is to override the master email button when using advanced workflow...
UPDATE: 2018-04-11 - Discovered that the previously attached code will be quirky in version 6.3 P5.
Reason being is that they brought back save and close button with this version. However save and close doesn't seem to be available for apps with AWF.
So, for those of us using apps with AWF still wanting the save and close, you need to make a minor update to this code.
I haven't fully tested, but the attached code references the master_btnSave. With version 6.3 P5, the master_btnSave is the Archer save and close.
The Save button is now actually master_btnApply.
If you understand custom objects and open the save and close attached files, this will make sense.