You can add a custom field of type "Traffic-Light" on any request of JIRA ServiceDesk: so, you will have got that field on ServiceDesk Portal being visible for all logged-in customers as well. (Please refer to the add-on version release nodes as older version do not support this feature.)
This requires at least JIRA ServiceDesk version 3.4.0 or newer! Using oder software versions, your traffic-light custom fields will not be rendered smart: just the color name will be displayed on ServiceDesk Portal requests.
Usage of Traffic-Light on JIRA Service Desk
While creating a new issue on JIRA Service Desk Portal, you can select any color of the configured traffic-light custom fields as shown below:
Viewing this request, you will see the content of the traffic-light custom field as colored image:
Automation of setting any traffic-light custom field to a certain value based on SLA data
Also, you can configure frequently scheduling for the automated setting of traffic-light custom field(s) depending on a pre-defined JQL.
Within the JQL, you can access your SLA fields as shown in my sample screen copy below: so, you can set a traffic-light to e.g. "yellow" in case of the risk breaching an SLA etc.
So, you cannot set traffic-light field(s) in real-time by Jira Automation but within the following provided time intervals. Generally, field updates every 15 min should be okay from a business perspective …