Forum Discussion

akarsh's avatar
akarsh
New Contributor III
2 years ago

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

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