Jump to content

Execute application task by clicking on button on a DataPage


Recommended Posts

Hi there.

I needed to be able to execute an application task by clicking on a button on a DataPage.
Since application tasks manually can be executed only on the back end of the application, here is a workaround I came up with using triggered action:

1. Create an auxiliary table with one Text 255 field:
image.png.4b410db45dd7413becbe004bb35d7e58.png


2. Add one record to this table:
image.png.c3d374503785a7ac106bd002bfb41408.png

3. Create a triggered action on the auxiliary table that will run  on update and will be executing the required task logic (in this example, it will be sending emails to users stored in the main table)

image.png.47de7368b226a6017bf4204c1b1a403b.png


4. Now you can create a Details DataPage using the auxiliary table as a source with the following configurations:
4.1 Choose "Filter data based on your pre-defined criteria."
4.2 Select no filtering fields
4.3 On "Search and Report Wizard - Select Details Page Fields" choose Text 255 field from the table
4.4 Add header with the following CSS code snippet:
 

<style>
section div:not(.cbBackButtonContainer) {
display: none;
}
</style>

image.png.4fbae735869a29f8ec2af682affe4f72.png

4.5 Add the following JavaScript code snippet to the footer of your DataPage:

<script>
const alertMessage = 'Task was executed'
document.addEventListener('click', (e)=>{
if(e.target.getAttribute('type')=='submit') {
alert(alertMessage)
}

}, true)
</script>

image.png.b9e3defc09b4a3e69af6dd9356f44a36.png

4.6 "Destination after record update" is set to the "Same form."

With the aforementioned setup, you will get a DataPage with a single button that will trigger required actions upon click, which simulates application task behavior. 

 

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