Jump to content
  • 0

Triggered action to check if the record is already existing


Kuroshi
 Share

Question

Is there a way to create a triggered action that checks on another table? I have 2 tables. Once I enter a record on the first table, it will check if it is already existing in the second table. If it does not exist on the second table, I need the record to be submitted on the second table and if it already exists then it needs to do nothing. Would you be able to provide me a sample configuration for this?

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @Batchini,

You can checkout this trigger configuration which might help you achieve your workflow: 

Screenshot_22_B42940E216.thumb.png.24b4ff2cc79e649dd3bf07cef1de3f8a.png

What this trigger does is once you insert a record on the main table and it is not existing on the second table, it will save the records on the second table. Otherwise, it will not save since it is already existing in the said table.

I hope this helps.

- Barbie

Link to comment
Share on other sites

  • 0

Hi, just to add to the previous comment above. This can also be done in the DataPage level. If you would like to do it in this way. 

You may use a calculated field that will determine if that value is already existing in your table and just add a JavaScript that will prevent the form to be submitted if the value is existing:

CASE WHEN 
(SELECT COUNT(field_name) FROM Table_name WHERE fieldname = [@field:fieldname] THEN
'Existing' 
ELSE
'Not Existing'
END

Then, you may add this JavaScript in the footer of your DataPage:

<script>

 document.addEventListener('BeforeFormSubmit', clickHandler);

function clickHandler(event) { 

var calc = document.querySelector("[id*=fieldID]").innerText;

 

if (calc  == "Not Existing"){

event.preventDefault();

window.alert("Submission BLOCKED!");

}

else {
document.location = "http://www.mysite.com/menu.html";
}

}

</script>

 

Just change the field names and table names depending on the field that you are using. 

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...
 Share

×
×
  • Create New...