fluid-api/src/main/java/com/fluidbpm/program/api/util/UtilGlobal.java
public void setFlatFieldOnJSONObj(
			String fieldNamePrefixParam,
			String fieldNameIdPrefixParam,
			Field fieldToExtractFromParam,
			JSONObject objectToSetFieldOnParam)
	{
		if(fieldToExtractFromParam == null)
		{
			return;
		}

		String fieldName = fieldToExtractFromParam.getFieldNameAsUpperCamel();
		if(fieldName == null || fieldName.trim().isEmpty())
		{
			return;
		}

		String completeFieldName = fieldNamePrefixParam.concat(fieldName);
		String completeFieldNameId = fieldNameIdPrefixParam.concat(fieldName);

		objectToSetFieldOnParam.put(completeFieldNameId,
				fieldToExtractFromParam.getId());

		Object fieldValue = fieldToExtractFromParam.getFieldValue();

		if(fieldValue == null)
		{
			objectToSetFieldOnParam.put(
					completeFieldName,
					JSONObject.NULL);
		}
		//Table field...
		else if(fieldValue instanceof TableField)
		{
			return;
		}
		//Multiple Choice...
		else if(fieldValue instanceof MultiChoice) {

			MultiChoice multiChoice = (MultiChoice) fieldValue;

			//Nothing provided...
			if(multiChoice.getSelectedMultiChoices() == null ||
					multiChoice.getSelectedMultiChoices().isEmpty())
			{

				objectToSetFieldOnParam.put(
						completeFieldName,
						JSONObject.NULL);
				return;
			}

			StringBuilder builder = new StringBuilder();
			multiChoice.getSelectedMultiChoices().forEach(selectedChoice ->
			{
				builder.append(selectedChoice);
				builder.append(", ");
			});

			String selectVal = builder.toString();
			if(selectVal != null && !selectVal.trim().isEmpty())
			{
				selectVal = selectVal.substring(0, selectVal.length() - 2);
			}

			objectToSetFieldOnParam.put(completeFieldName, selectVal);
		}
		//Other valid types...
		else if((fieldValue instanceof Number || fieldValue instanceof Boolean) ||
				fieldValue instanceof String)
		{
			if((fieldValue instanceof String) &&
					Field.LATITUDE_AND_LONGITUDE.equals(
							fieldToExtractFromParam.getTypeMetaData()))
			{
				String formFieldValueStr = fieldValue.toString();

				String latitudeTxt = this.getLatitudeFromFluidText(formFieldValueStr);
				String longitudeTxt = this.getLongitudeFromFluidText(formFieldValueStr);

				fieldValue = (latitudeTxt.concat(UtilGlobal.COMMA).concat(longitudeTxt));
			}

			objectToSetFieldOnParam.put(completeFieldName, fieldValue);
		}
		//Date...
		else if(fieldValue instanceof Date)
		{
			objectToSetFieldOnParam.put(completeFieldName, ((Date)fieldValue).getTime());
		}
	}
public void setFlatFieldOnJSONObj(
			String fieldNamePrefixParam,
			String fieldNameIdPrefixParam,
			Field fieldToExtractFromParam,
			JSONObject objectToSetFieldOnParam)
	{
		if(fieldToExtractFromParam == null)
		{
			return;
		}

		String fieldName = fieldToExtractFromParam.getFieldNameAsUpperCamel();
		if(fieldName == null || fieldName.trim().isEmpty())
		{
			return;
		}

		String completeFieldName = fieldNamePrefixParam.concat(fieldName);
		String completeFieldNameId = fieldNameIdPrefixParam.concat(fieldName);

		objectToSetFieldOnParam.put(completeFieldNameId,
				fieldToExtractFromParam.getId());

		Object fieldValue = fieldToExtractFromParam.getFieldValue();

		if(fieldValue == null)
		{
			objectToSetFieldOnParam.put(
					completeFieldName,
					JSONObject.NULL);
		}
		//Table field...
		else if(fieldValue instanceof TableField)
		{
			return;
		}
		//Multiple Choice...
		else if(fieldValue instanceof MultiChoice) {

			MultiChoice multiChoice = (MultiChoice) fieldValue;

			//Nothing provided...
			if(multiChoice.getSelectedMultiChoices() == null ||
					multiChoice.getSelectedMultiChoices().isEmpty())
			{

				objectToSetFieldOnParam.put(
						completeFieldName,
						JSONObject.NULL);
				return;
			}

			StringBuilder builder = new StringBuilder();
			multiChoice.getSelectedMultiChoices().forEach(selectedChoice ->
			{
				builder.append(selectedChoice);
				builder.append(", ");
			});

			String selectVal = builder.toString();
			if(selectVal != null && !selectVal.trim().isEmpty())
			{
				selectVal = selectVal.substring(0, selectVal.length() - 2);
			}

			objectToSetFieldOnParam.put(completeFieldName, selectVal);
		}
		//Other valid types...
		else if((fieldValue instanceof Number || fieldValue instanceof Boolean) ||
				fieldValue instanceof String)
		{
			if((fieldValue instanceof String) &&
					Field.LATITUDE_AND_LONGITUDE.equals(
							fieldToExtractFromParam.getTypeMetaData()))
			{
				String formFieldValueStr = fieldValue.toString();

				String latitudeTxt = this.getLatitudeFromFluidText(formFieldValueStr);
				String longitudeTxt = this.getLongitudeFromFluidText(formFieldValueStr);

				fieldValue = (latitudeTxt.concat(UtilGlobal.COMMA).concat(longitudeTxt));
			}

			objectToSetFieldOnParam.put(completeFieldName, fieldValue);
		}
		//Date...
		else if(fieldValue instanceof Date)
		{
			objectToSetFieldOnParam.put(completeFieldName, ((Date)fieldValue).getTime());
		}
	}
Sets the flat value on the {@code objectToSetFieldOnParam} JSON object.

If the {@code fieldToExtractFromParam} is not provided, nothing will be set.

If {@code fieldNamePrefixParam} or {@code fieldNameIdPrefixParam} is not set, an
{@link NullPointerException} will be thrown.

@param fieldNamePrefixParam The prefix field name.
@param fieldNameIdPrefixParam The prefix field name for id.
@param fieldToExtractFromParam The field to extract the value from.
@param objectToSetFieldOnParam The JSON object to set the field value on.

@see JSONObject
@see Field