The max_length variable attribute is ignored when Map to Field is set to true for Record Producers in Service Portal. Instead the variable uses the max length of the Field to which it is mapped. The issue does not occur outside of Service Portal.
Steps to Reproduce
1. Log in to a pre-Kingston instance where Service Portal is enabled.
2. Go to "Record Producers" from the left navigation bar.
3. Open the OOTB record producer called "Report Outage".
4. Add a new Variable to the Record Producer named "test_var_1" (single line text).
5. Add a variable attribute "max_length=4".
6. Mark the "Map to Field" checkbox and select "Short Description" as the mapped field.
7. Open the same record producer in Service Portal. Notice the newly created variable will allow you to type a lot more than just the max 4 characters. The restriction is based on the Max Length of the "Short Description" field of the Task table.
This issue was fixed in Kingston. There is no workaround applicable. Please review the Fixed In section to determine the latest available patch your instance can be upgraded to.
Related Problem: PRB1118400