Jump to content
  • 0

Create a record in a different table from a datapage


mhand

Question

Good day,

I have 3 tables (Directory, Interaction, Referrals). The Directory table is a list of resources and providers. Interaction is details about a specific interaction my team has with a caller. Referrals is a simple table that contains 3 fields (Directory_ID, Interaction_ID, Refer_Time) and is intended to track all of the times a specific entry in the Directory is referred to one of the callers from an interaction.  In a single interaction we can refer anywhere from 0 to 10 resources and those resources can be referred to any number of different Interactions.

I would like to build a search form of the Directory where the details page of the results would have a button that when it is pressed, it creates a new record in the Referrals table that contains the Directory_ID of the resource being viewed, the Interaction_ID that has been passed to the search datapage through an external parameter, and the timestamp of when the button was clicked.

I'm stuck....Does anyone here have an idea how to accomplish this?

Thanks

Marty

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello @mhand

To implement such a workflow you may use JavaScript.
Paste this code into the Header of the Submission form:

<script type="text/javascript">
function inputHandler() { 
 document.getElementById('InsertRecordTrxnType').value = document.getElementById('cbParamVirtual1').value 
 //cbParamVirtual1 needs to be changed according to the name of the Virtual field you have in your DataPage
}

document.addEventListener('BeforeFormSubmit', inputHandler);
</script>

Note that cbParamVirtual1 needs to be changed according to the name of the Virtual field you have in your DataPage.
Also, do not forget to Disable the HTML editor of the header in the advanced section.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...