Zoho Trusted Partner in Digital Transformation
Challenge: Preventing Zoho Flow from overwriting existing Creator record data with blank values during partial updates.
Solution: Implement conditional field mapping with selective update strategies that preserve existing data integrity.
Impact: Maintain data quality while enabling automated workflow updates.
Flow Structure Pattern:
1. Trigger (Webhook/Schedule/Form Submission) ↓ 2. Get Source Data ↓ 3. Decision Block: Check Field 1 ├─ If Not Empty → Add to Update Map └─ If Empty → Skip ↓ 4. Decision Block: Check Field 2 ├─ If Not Empty → Add to Update Map └─ If Empty → Skip ↓ 5. [Repeat for all fields] ↓ 6. Decision Block: Check if Update Map has data ├─ If Yes → Update Creator Record └─ If No → Log "No updates needed"
Optimized Code Implementation:
// Comprehensive selective update function
void updateCreatorRecordSelectively(int recordId, Map sourceData, string appName, string formName)
{
try {
// Initialize update map with only non-empty values
updateMap = Map();
// Define field mapping with validation
fieldMappings = {
{"source_field": "Task_Name", "target_field": "Name", "required": false},
{"source_field": "Task_Status", "target_field": "Status", "required": false},
{"source_field": "Due_Date", "target_field": "Due_Date", "required": false},
{"source_field": "Priority", "target_field": "Priority", "required": false}
};
// Process each field mapping conditionally
for each mapping in fieldMappings {
sourceField = mapping.get("source_field");
targetField = mapping.get("target_field");
isRequired = mapping.get("required");
sourceValue = sourceData.get(sourceField);
// Comprehensive empty value checking
if(isValidValue(sourceValue, isRequired)) {
updateMap.put(targetField, sourceValue);
info "Including field: " + targetField + " with value: " + sourceValue;
} else {
info "Skipping field: " + targetField + " (empty or invalid value)";
}
}
// Only proceed with update if we have fields to update
if(updateMap.size() > 0) {
criteria = "ID == " + recordId;
response = zoho.creator.updateRecords(
"your_account",
appName,
formName,
criteria,
updateMap,
Map(),
"creator_connection"
);
if(response.get("code") == 3000) {
info "Record updated successfully. Fields updated: " + updateMap.keys().toString();
return {"status": "success", "updated_fields": updateMap.keys(), "record_id": recordId};
}
}
} catch (e) {
info "Error in updateCreatorRecordSelectively: " + e.toString();
return {"status": "error", "message": e.toString()};
}
}// Enhanced value validation function
boolean isValidValue(string value, boolean isRequired)
{
// Handle null values
if(value == null) {
return isRequired ? false : false;
}
// Handle empty strings
if(value.toString().trim() == "") {
return isRequired ? false : false;
}
// Handle specific "empty" indicators
if(value.toString().toLowerCase() == "null" ||
value.toString().toLowerCase() == "undefined" ||
value.toString() == "0" && !isRequired) {
return false;
}
return true;
}
To implement these advanced Flow configurations, ensure you have access to:
creatorscripts@zoho.com | 8444552263
⭐ Proud Winner of Zoho Creator's Tech Star in Healthcare ⭐
Trusted by Businesses Worldwide
This email was sent automatically with Creator Scripts
© 2025 Creator Scripts - Zoho Trusted Partner in Digital Transformation