|
| 1 | +- [Enable DETs for a project](#enable-dets-for-a-project) |
| 2 | +- [Find event ID for an event name](#find-event-id-for-an-event-name) |
| 3 | + |
1 | 4 | ## Enable DETs for a project |
2 | 5 |
|
3 | 6 | Within the REDCap project, go to Project Setup. |
4 | 7 | Find and click the Additional Customizations button. |
5 | 8 | Scroll to the bottom of the modal, and find the Data Entry Trigger section. |
| 9 | + |
| 10 | + |
| 11 | +## Find event ID for an event name |
| 12 | + |
| 13 | +There is no official REDCap API for retrieving an event ID, but this event ID is required for generating deep links to specific instance of forms within REDCap. |
| 14 | + |
| 15 | +To find the event ID, you can look at the `event_id` param in the URL of a form from your target arm and event. |
| 16 | +If there are no forms for the arm or event you're targeting, then with a little hacking, you can retrieve the event ID in the following way: |
| 17 | +1. From the home page of your target REDCap project, under **Project Home and Design**, click on **Project Setup**. |
| 18 | +2. Then, under **Define your events and designate instruments for them**, click `Define my events`. |
| 19 | +3. In your browser console, run the following JavaScript snippet: |
| 20 | + ```js |
| 21 | + edit_links = document.querySelectorAll("a[onclick^=beginEdit]") |
| 22 | + parse_onclick = a => |
| 23 | + a.getAttribute("onclick") |
| 24 | + .match(/beginEdit\("(?<arm>\d+)","(?<event_id>\d+)"\)/) |
| 25 | + .groups; |
| 26 | + console.table( |
| 27 | + Array.from(edit_links).map(a => ({ |
| 28 | + name: a.parentElement.parentElement.querySelector(".evt_name").textContent, |
| 29 | + ...parse_onclick(a) |
| 30 | + })) |
| 31 | + ) |
| 32 | + ``` |
| 33 | +The resulting table detials the `event_id` for each event defined in the current tab's arm. |
| 34 | +Click through the other tabs to see `event_ids` for other project arms. |
0 commit comments