Forum Discussion

JordanBeatty1's avatar
JordanBeatty1
Qrew Captain
8 years ago

Need ideas for how to trigger an action on record modification

The use case:

Whenever a task is created, an action is triggered and it automatically creates an activity for the task. Though, occasionally said task description can be modified to enough that it warrants a new activity to be created for it. The issue is that  I cannot have the action trigger off the task description being modified as it is the discretion of the user when this need to happen, or things such as going back to edit typos and such would trigger it as well. Currently, I just have an URL button that carries forward the information to the activity form that the user can click to create the activity. Though, this could save two steps from not having to go the activity form then save it there.

I would like there to be something like a checkbox, so when it was checked it would trigger a record modification action to add the activity. So then similar to the URL button, it is at the discretion of the user as to when the task has been modified enough it warrants a new activity. They could check the box and just save the task and automatically create the activity instead of going to the activity form and save. Though, then the issue is it stays checked when the record is saved. Then it would not work the second time around the task is modified. Sorry if the use case was not clear. Any thought or ideas how I could do something like this? Its not huge, but 2 steps is 2 steps. 
  • Someone may have a simple native solution but if you're interested I've done this using custom code to do this so if you're interested contact me and I can give you some bits of code to use. Chuck@Chuck.Support
  • Here I s a button which will toggle a checkbox field. You can set the Notification to trigger when the checkbox field changes.

    var text NewToggle = IF(My Toggle field]=true, "0","1");

    var text URL= URLRoot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&rid=" & [Record ID#]
    & "&_fid_99=" & $NewToggle
    & "&apptoken=" & "XXXX";

    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);"

    Replace the 99 with the field ID of a checkbox field created to trigger the Notification.

    If you have disabled the need for app tokens, you don't need that last part of the URL formula variable, but it needs to end in a semi colon
  • Mhmm, essentially what I would need would be the check box it would stay checked when I saved the record, though the next time the record is opened in edit mode it would switch back to being unchecked automatically.
  • Why?


    The code I provided will simply reverse the checkbox between checked and unchecked every time the button is pressed.


    Just set the notification to Fire whenever the checkbox is changed.
  • While testing this I had to save the record before hand, then click the button, the page would reload and the checkbox would change and the action would fire. This is okay. If I pressed the button before saving it would ask me if I would like to save any changes, and even when I said yes I would lose them, though this just may be on my end.

    Maybe the next best thing is to incorporate the checbox flip into a button that saves the record. Have it flip the checkbox then save the record. That way I could hide checkbox and give them a separate option that if you click here to save it will create the activity for you