How do i change the field reference for form options?

Jamie Sammons, modified 3 Years ago. New Member Posts: 6 Join Date: 5/23/22 Recent Posts

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;