Jump to content

Removing Record based on condition


Recommended Posts

@FinTheHuman Are you looking solely for JS script to do this? This is possible through table triggers. On an Update Trigger, use a Delete Block and set the conditions. I have this workflow for my ordering/receiving app, once Quantity Received is equal to Quantity Ordered, that record is completed and the trigger deletes it from my table. 

Link to comment
Share on other sites

Hey @FinTheHuman,

You can try using this code for your Tabular DataPage:

<div id="[@cbRecordIndex]"></div>

<script>
  
var yourfield = document.getElementById('[@cbRecordIndex]');
  
if ("[@field:Process]".trim().toLowerCase() == "Completed")
yourfield.parentNode.parentNode.style.display = "none";
  
</script>

Add this code inside HTML Block or in the Footer of your DataPage.

Make sure the you unchecked the "Enable HTML editor".

I hope this helps :)

~WatashiwaJin~

Link to comment
Share on other sites

@WatashiwaJin, I also have a similar condition or process for this kind of work-flow but the problem is the output will also depend on the type of user based on my authentication. (For example: If the user is an Employee, I need to hide the record of Inquiry_Type field with a vlaue of "only admin").

Note: I use a Search and Report form (Tabular).

I hope you help me with this. Thank you in-advance !

Link to comment
Share on other sites

Hi @IamGroot,

If that is the case then you can try using this script instead:

<div id="[@cbRecordIndex]"></div>

<script>

document.addEventListener('DataPageReady', function (event) {
if ("[@authfield:UserType]" == "Employee") {

var yourfield = document.getElementById('[@cbRecordIndex]');
  
if ("[@field:Inquiry_Type]".trim().toLowerCase() == "only admin")
yourfield.parentNode.parentNode.style.display = "none";
  
}
});

</script>

You can also try this documentation in that kind of process:

https://howto.caspio.com/authentications-and-connections/authentication/record-level-security/restrict-access-to-data-by-user-or-role/

I hope this answer your question.

~WatashiwaJin~

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
Reply to this topic...

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