Working …
This value you provided is not a number. Please try again.
This value you provided is not an integer. Please try again.
The value entered is not a valid Vanderbilt Medical Record Number (i.e. 4- to 9-digit number, excluding leading zeros). Please try again.
The value you provided must be within the suggested range
The value you provided is outside the suggested range
This value is admissible, but you may wish to double check it.
The value entered must be a time value in the following format HH:MM within the range 00:00-23:59 (e.g., 04:32 or 23:19).
This field must be a 5 or 9 digit U.S. ZIP Code (like 94043). Please re-enter it now.
This field must be a 10 digit U.S. phone number (like 415 555 1212). Please re-enter it now.
This field must be a valid email address (like joe@user.com). Please re-enter it now.
The value you provided could not be validated because it does not follow the expected format. Please try again.
Required format:
REDCap Logo
Plugins, Hooks, & External Modules
Developer methods for
Plugins, Hooks, & External Modules
Hook functions

REDCap Developer Tools:
Documentation for Plugins, Hooks, & External Modules

REDCap Version 14.9.1
REDCap::renameRecord
(REDCap >= 11.3.3)
REDCap::renameRecord — Rename a record to change its record name to new record name in a project.
Description
mixed REDCap::renameRecord ( int $project_id, string $currentRecordName, string $newRecordName [, int $arm = NULL] )
Returns boolean if the specified record was successfully renamed to new record name.
Parameters
project_id
The project ID number of the REDCap project. If the project_id parameter's value is not numeric, it will throw an exception.
currentRecordName
The current record name of the specific record that you want to rename.
newRecordName
The new record name to which you want to rename the current record.
arm (optional)
The specific arm number in which the current record exists. If null, then in longitudinal projects with multiple arms, the specified record will be renamed to the new record name in all arms in which the record exists; otherwise it will rename the record only in the specified arm.
Return Values
TRUE if record is renamed, or FALSE if it does not. If any of the parameters are invalid (e.g., project_id, currentRecordName, newRecordName does not exist or is invalid), then NULL is returned.
Examples
Example #1:
Renaming a current record name to new record name in a classic/non-longitudinal project.
$projectId = 465;
$currentRecordName = "4";
$newRecordName = "record_4";
$renamed = REDCap::renameRecord($projectId, $currentRecordName, $newRecordName);
if ($renamed === null) {
// The parameters are not valid
} elseif ($renamed) {
// Record is renamed
} else {
// Record is not renamed
}
Example #2:
This example illustrates renaming record on a single arm.
$projectId = 465;
$currentRecordName = "4";
$newRecordName = "record_4";
$arm_number = 2;
$renamed = REDCap::renameRecord($projectId, $currentRecordName, $newRecordName, $arm_number);
REDCap 14.9.1 - © 2024 Vanderbilt University