LPS-22792 SF - first get, then set

Based on https://github.com/brianchandotcom/liferay-portal/pull/18872 suggestions