You need to set up a sustain MIDI parameter in the device you’re controlling. I assume it is a plugin. Here’s how to do it:
Using the project browser, go into the Devices folder, locate the device definition for the plugin, and enter the MIDI Parameters folder within. There should be three parameters. Select the ‘New Parameter’ menu. Name it ‘Sustain’, change the CC number to 64 (64 is the standard CC number for sustain).
When you record enable your track with the plugin, and start recording, then using the Sustain pedal should automatically create a Sustain parameter automation track.