Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Insert blank into singleselect field

Topic Labels: Automations
406 2
cancel
Showing results for 
Search instead for 
Did you mean: 
nishant_tank
4 - Data Explorer
4 - Data Explorer

 

 

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
})

 

2 Replies 2
Mike_AutomaticN
10 - Mercury
10 - Mercury

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 

nishant_tank
4 - Data Explorer
4 - Data Explorer

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
})