Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How do i change the field reference for form options?
In the forms edit view i changed the field's reference of every
option,
but when i try to read the selected options in my
workflow it only returns the auto generated field reference
so my System.out should give me "Form field values :
favorite_color | data : color_red"
but instead i still get
the auto generated field reference names like this "Form field
values : Field51281366 | data : Option50738058"
this is the script i have running inside the workflow
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.dynamic.data.mapping.model.DDMFormInstanceRecordVersion;
import com.liferay.dynamic.data.mapping.service.DDMFormInstanceRecordVersionLocalServiceUtil;
import com.liferay.dynamic.data.mapping.storage.DDMFormFieldValue;
import com.liferay.dynamic.data.mapping.model.Value;
// Fetch the form record Id from the workflow context
long recVerId = GetterUtil.getLong((String)workflowContext.get(WorkflowConstants.CONTEXT_ENTRY_CLASS_PK));
// Initialize form record version
DDMFormInstanceRecordVersion recVer = DDMFormInstanceRecordVersionLocalServiceUtil.getFormInstanceRecordVersion(recVerId);
// Retrieve the form field values
List<DDMFormFieldValue> formFieldVals = recVer.getDDMFormValues().getDDMFormFieldValues();
for (DDMFormFieldValue fmval : formFieldVals) {
Value val = fmval.getValue();
String data = val.getString(Locale.ROOT);
String name = fmval.getName();
System.out.println("Form field values : "+name+"| data : "+data);
}
return;
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™