Nov 08, 2024 08:17 AM
Hi folks
I am fairly new to automations so plz excuse my lack of expertise.
I am working on an automation that requires copying some data from 1 table into another table in certain circimstances.
One of the columns (DISCONNECT_PROMPT) is of single select type - both in the source table as well as destination table.
I am using the below code to insert the data but the it fails when the single select column is empty/blank in the source table.
Can you please help me identify a way to insert a nothing if the source field is empty?
Thanks in advance
await tabChangeHistoryLog.createRecordAsync({
'ROUTING_PROFILE': airTableKey,
'PRIMARY_Q (Mandatory)': strPRIMARY_Q,
'PREFERRED_ROUTING_ELLIGIBLE (Mandatory)': {name: airTableRecord?.getCellValueAsString("PREFERRED_ROUTING_ELLIGIBLE (Mandatory)") || "TRUE"},
'PREFERED_AGENT_SCORE (Optional)': intPREFERRED_AGENT_SCORE,
'LC_EXPIRATION_THRESHOLD (Optional)': intLC_EXPIRATION_THRESHOLD,
'IN_Q_REFRESH_RATE_IN_SECONDS (Mandatory)': intIN_Q_REFRESH_RATE_IN_SECONDS,
'SCHEDULE_GROUP (Mandatory)': strSCHEDULE_GROUP,
'OVERFLOW_Q (Optional)': strOVERFLOW_Q,
'EMERGENCY_FLAG (Mandatory)': {name: airTableRecord?.getCellValueAsString("EMERGENCY_FLAG (Mandatory)") || "FALSE"},
'EMERGENCY_ACTION (Optional)': {name: airTableRecord?.getCellValueAsString("EMERGENCY_ACTION (Optional)") || "REROUTE"},
'EMERGENCY_QUEUE (Optional)': strEMERGENCY_QUEUE,
'DISCONNECT_PROMPT (Optional)': {name: airTableRecord?.getCellValueAsString("DISCONNECT_PROMPT (Optional)") || ""},
'DISCONNECT_MESSAGE (Optional)': strDISCONNECT_MESSAGE
})
Nov 08, 2024 09:24 AM
Hey @nishant_tank!
What about only pushing Disconnect_Prompt only if it is not empty in the original table?
if (disconnectPromptValue) {
fields['DISCONNECT_PROMPT (Optional)'] = { name: disconnectPromptValue };
Please let me know if that helps!
Best,
Mike, Consultant @ Automatic Nation
Nov 09, 2024 02:34 AM - edited Nov 10, 2024 09:52 PM
Thanks for the suggestion @Mike_AutomaticN
Will your suggestion work if I put it inline inside the 'createRecordAsync' function call (like below)?
await tabChangeHistoryLog.createRecordAsync({
'ROUTING_PROFILE': airTableKey,
'PRIMARY_Q (Mandatory)': strPRIMARY_Q,
'PREFERRED_ROUTING_ELLIGIBLE (Mandatory)': {name: airTableRecord?.getCellValueAsString("PREFERRED_ROUTING_ELLIGIBLE (Mandatory)") || "TRUE"},
'PREFERED_AGENT_SCORE (Optional)': intPREFERRED_AGENT_SCORE,
'LC_EXPIRATION_THRESHOLD (Optional)': intLC_EXPIRATION_THRESHOLD,
'IN_Q_REFRESH_RATE_IN_SECONDS (Mandatory)': intIN_Q_REFRESH_RATE_IN_SECONDS,
'SCHEDULE_GROUP (Mandatory)': strSCHEDULE_GROUP,
'OVERFLOW_Q (Optional)': strOVERFLOW_Q,
'EMERGENCY_FLAG (Mandatory)': {name: airTableRecord?.getCellValueAsString("EMERGENCY_FLAG (Mandatory)") || "FALSE"},
'EMERGENCY_ACTION (Optional)': {name: airTableRecord?.getCellValueAsString("EMERGENCY_ACTION (Optional)") || "REROUTE"},
'EMERGENCY_QUEUE (Optional)': strEMERGENCY_QUEUE,
if (disconnectPromptValue) {
fields['DISCONNECT_PROMPT (Optional)'] = { name: disconnectPromptValue },
'DISCONNECT_MESSAGE (Optional)': strDISCONNECT_MESSAGE
})