Handling missing variables from a Webhook call

Answered

I am integrating Xano with Salesforce. I've gotten it to work fairly well but when data isn't populated in Salesforce the API callout doesn't include a null value for the variable but rather just strips it from the call.

An example is Middle Name. When it is populated in Salesforce the JSON looks like this:

{
'new':
[
{
'Id': '00QAd000007uz1ZLAQ',
'LastName': 'Johnson',
'FirstName': 'Joe',
'LeadSource': 'Trade Show',
'MiddleName': 'Bob',
'Salutation': 'Mr.',
},
],
'old':
[
{
}
],
'userId': '0054K000001cmRSQAY'
}

When it isn't populated it looks like this:

{
'new':
[
{
'Id': '00QAd000007uz1ZMAQ',
'LastName': 'Johnson',
'FirstName': 'Joe',
'LeadSource': 'Trade Show',
'Salutation': 'Mr.',
},
],
'old':
[
{
}
],
'userId': '0054K000001cmROQAY'
}

When Xano gets the second JSON there is a 500 error with the message: Unable to locate var: fromSalesforce.new.0.MiddleName

Is there a way to handle missing input variables like this somehow? I've tried checking for null but that seems to only check for a null value and not a missing variable.

1 reply