Client Script - How do you obtain the current record ID when in detail view?

Client Script - How do you obtain the current record ID when in detail view?

I'm trying to gather the Account ID of the Account currently being looked at in Detail View of CRM.

I'm using a "button on click" client script execution, and am trying to create a logged call with input, based on button click.

eg - User goes to account, clicks button, screen pops with input, input then used in Call object creation and inserted to respective account.

Here is the sample script so far.

console.log("Canvas button clicked");
accountID = $Page.parent_record_id;
            var callRecord = {
                "data": [
                    {
                        "Subject": "Call Log",
                        "Call_Type": "Outbound",
                        "Call_Status": "Completed",
                        "Call_Start_Time": new Date().toISOString(),
                        "Description": notes,
                        "Account_Name": {
                            "id": accountId
                        }
                    }
                ]
            };

            console.log("Call record to be inserted: ", callRecord);

            ZDK.Apps.CRM.API.insertRecord({
                Entity: "Calls",
                APIData: callRecord
            }).then(function(data) {
                console.log("Call record created successfully: ", data);
                ZDK.Client.showMessage("Call logged successfully!");
            }).catch(function(error) {
                console.error("Error creating call record: ", error);
                ZDK.Client.showMessage("Failed to log call.");
            });

ZDK.Client.getInput(
    [{ type: 'text', label: 'Notes', name: 'notes' }],
    'Call Log',
    'Log Call',
    'Cancel',
    function(response) {
        console.log("User response: ", response);
        if (response) {
            var notes = response.notes;
            console.log("Notes: ", notes);

            var recordId = getRecordIdFromURL();
            if (recordId) {
                fetchAccountDetailsAndCreateCall(recordId, notes);
            } else {
                console.error("Record ID not found in URL.");
                ZDK.Client.showMessage("Failed to fetch record ID.");
            }
        } else {
            console.log("Call log canceled.");
            ZDK.Client.showMessage("Call log canceled.");
        }
    },
    function(error) {
        console.error("Error in notes pop-up: ", error);
    }
);