Clickable button on a record to kick off Javascript process

Posted by Rollbase User on 11-Nov-2011 07:34

If I wanted to have a field on a record that kicks off a process (javascript ?) that represents a clickable button, how might I accomplish something like this? For instance, I have a project record and I want to create a bunch of Tasks from a table that hold Task templates. So, I read the Task Template and then insert to the Tasks table so that I have a bunch of Tasks for my Project.

All Replies

Posted by Admin on 11-Nov-2011 09:21

The best way to do this would be to:

1. Create a Trigger on your Project object to create one or more related records. You can use object script (query api) in your trigger to programmatically create as many related records as you want, or you can create a single record by using a Create Related Record trigger.

2. Enable the "Workflow" attribute on your Project object and create a Workflow Action that fires the Trigger you created above. Set this workflow action to "Render as Button" and assign it to the default Workflow Status on that object.

In this way you will have a button on your Project record view page that invokes the necessary action



Alternatively, you can edit your page and add a Script component (or create a Template field and add it to the page) that contains custom JavaScript which uses our AJAX API to create the necessary related records.



Hope this helps,

Matt

Posted by Admin on 15-Nov-2011 09:04

Thanks Matt. Was wondering if you had some simple javascript code laying around that I can use to add related records to a child table. I am still trying to see how you relate records and physically what gets stored, i.e. key values from Parent on child record?

This thread is closed