0

I need to be able to remove the delete button when today is greater than a particular calculated date.

There are 2 ideas I had and issues with each:

1 - Set a custom field on the record for the particular calculated date. Then use a workflow action of Remove Button where the custom field is <= today. My issue is I am wondering if there is a way to get "today" because I expected the condition to change allowing me to do that. I tried to use a formula and can't find Now() as a valid function listed.

2 - Workflow are truly scripts in the background. That means the Remove Button should be available in API. Therefore, my idea was to do my conditioning in suite script and then call this function. However, this function also does not exist in supported form. Has anyone hacked this to find what the function that is called in Remove Button is?

If we can get either idea to work, or if you have a third I haven't thought of that accomplishes the same task, that would be great.

John
  • 302
  • 2
  • 23
TMann
  • 751
  • 2
  • 11
  • 33

2 Answers2

3

I figured out my own answer. In case someone else ever needs this (as I didn't see anything like this on stack overflow), here is how to do option #1:

Save the value to a custom field - custbody_block_dlt_date In a workflow, use the Remove Button function and use a formula condition The condition is: {custbody_block_dlt_date} < sysdate

"sysdate" is the way you can get "Now()" or "today" in the condition

TMann
  • 751
  • 2
  • 11
  • 33
0

An alternative could be to create a User Event Script, on the before load function, get the button object then use the .setVisible(visible) method to hide it based on a date criteria, you may also want to set other restrictions based on roles that allow certain individuals to still be able to delete the record, like high positioned accountants. That avoids creating unnecessary fields on your records, while still providing the functionality that you desire. This could easily be done in < 4 lines of JavaScript.

See nlobjButton for examples.

spectre-d
  • 509
  • 4
  • 14