cancel
Showing results for 
Search instead for 
Did you mean: 

Pass null when object is not found or data is not found in mapper

akarsh
New Contributor III

I have list of ifa numbers and I will do lookup to salesforce and get the account id mappings to it and form the below structure using mappings if the account is found.

 

"customerMappings": {
"0280944234": "0011H000034uSFAQA2"
},

if the Account is not found then  customerMappings will not be created.

when I try to access the data  using this
$.get("customerIFANumber") != null ? $customerMappings.get($customerIFANumber) : null

but if the customermapping is not present then it says error.

 


"error" : "$customerMappings is undefined. Perhaps you meant: $customerIFANumber, $yearofmanufacture",
"reason" : "'customerMappings' was not found while evaluating the sub-expression '$customerMappings'",
"resolution" : "Check the spelling of the property or, if the property is optional, use the get() method (e.g. $.get('customerMappings'))",

 

I tried this
$.get('customerMappings').get($customerIFANumber)

it didnt help 

failure:"Cannot invoke a method on a null value",value:"Please check expression syntax",reason:"Please check expression syntax",sub-expression:{...}
 
can anyone help me here
3 REPLIES 3

Aleksandar_A
Contributor III

Hello @akarsh,

Seems like the object $customerMappings is missing in the document, could you please verify that it exists?

akarsh
New Contributor III

$customerMappings is created when it finds that IFA number is present in salesforce. in this scenario the ifa number is not present in salesforce

svatada
Former Employee

@akarsh You can solve your problem using hasOwnProperty() expression. I am attaching a sample pipeline check it out.