Help with coding for listViews trigger - Forum - Rollbase - Progress Community

Help with coding for listViews trigger

 Forum

Help with coding for listViews trigger

This question is answered

I'm at a loss for the correct coding to add an onchange trigger to the listViews field to record which view option was selected (see screenshot).

I'd deeply appreciate any guidance.

Thanks in advance.

Verified Answer
  • Using the code below, you can prepend a code to the onchange event of list view.

    $(function() {
      var previousOnchange = $("select:eq(0)").attr("onchange"); 
      $("select:eq(0)").attr("onchange", "alert(this.value);"+ previousOnchange);
    });

    What is your objective in adding a function to the onchange event of a list view?

  • Thanks for the quick response.  I'm creating an audit trail of User activities (e.g., pages visited, files opened, etc.).  Using the listView page onload trigger produces only a generic "(User Name)  opened Applications List View Page"  audit trail record. My goal it to specify in the audit trail record which specific listView was chosen.  Your function works perfectly for displaying the selected listView. How can I pass this listView ID on to the audit trail trigger?

    Thanks again

  • You can use the following code to accomplish this requirement:

    $(function() {
      previousOnchange = $("select:eq(0)").attr("onchange");
      $("select:eq(0)").attr("onchange", "rbf_setField('USER', {!#CURR_USER.id}, 'View_ID', this.value, false);"+previousOnchange);
    });

    First, you need to create a Text field with the integration name View_ID in USER object. Then, create a Create Audit Trail Record trigger with the following properties:

    • Timing: After Update
    • On Field Change: View ID
    • Trail Template: View ID {!View_ID} has been accessed.

    This should generate an audit trail containing the View ID everytime the view is changed.

  • Thanks Godfrey for the quick turnaround and flawless solution!!

    John

All Replies
  • Using the code below, you can prepend a code to the onchange event of list view.

    $(function() {
      var previousOnchange = $("select:eq(0)").attr("onchange"); 
      $("select:eq(0)").attr("onchange", "alert(this.value);"+ previousOnchange);
    });

    What is your objective in adding a function to the onchange event of a list view?

  • Thanks for the quick response.  I'm creating an audit trail of User activities (e.g., pages visited, files opened, etc.).  Using the listView page onload trigger produces only a generic "(User Name)  opened Applications List View Page"  audit trail record. My goal it to specify in the audit trail record which specific listView was chosen.  Your function works perfectly for displaying the selected listView. How can I pass this listView ID on to the audit trail trigger?

    Thanks again

  • You can use the following code to accomplish this requirement:

    $(function() {
      previousOnchange = $("select:eq(0)").attr("onchange");
      $("select:eq(0)").attr("onchange", "rbf_setField('USER', {!#CURR_USER.id}, 'View_ID', this.value, false);"+previousOnchange);
    });

    First, you need to create a Text field with the integration name View_ID in USER object. Then, create a Create Audit Trail Record trigger with the following properties:

    • Timing: After Update
    • On Field Change: View ID
    • Trail Template: View ID {!View_ID} has been accessed.

    This should generate an audit trail containing the View ID everytime the view is changed.

  • Thanks Godfrey for the quick turnaround and flawless solution!!

    John

  • Godfrey:

    How would I alter your code to use the text value (i.e., "All Applications") instead of the listId (i.e., 6839800) in the audit trail?

    Thanks,

    John

    Godfrey Sorita

    You can use the following code to accomplish this requirement:

    1
    2
    3
    4
    $(function() {
      previousOnchange = $("select:eq(0)").attr("onchange");
      $("select:eq(0)").attr("onchange", "rbf_setField('USER', {!#CURR_USER.id}, 'View_ID', this.value, false);"+previousOnchange);
    });

    First, you need to create a Text field with the integration name View_ID in USER object. Then, create a Create Audit Trail Record trigger with the following properties:

    • Timing: After Update
    • On Field Change: View ID
    • Trail Template: View ID {!View_ID} has been accessed.

    This should generate an audit trail containing the View ID everytime the view is changed.