01-23-2024 02:55 AM
I have to extract "pw_cc__IsoCode_2__c" when in the payload "Country_of_Installation__r" is present.
Since both parent property Opportunity and child property Country_of_Installation__r are optional field i need to check if the node present before extracting the value. I tried in mapper $.get('Opportunity').get('Country_of_Installation__r').get('pw_cc__IsoCode_2__c') but this throws can not invoke a method on null value.
Tried other javascript functions but most of them are not supported here.
can anyone help me with proper script.
01-23-2024 07:06 AM
You can try with this expression:
$.hasPath("Opportunity.Country_of_Installation__r.pw_cc__IsoCode_2__c") ? $Opportunity.Country_of_Installation__r.pw_cc__IsoCode_2__c : null
Or, just simply map the field in the Mapper snap and check the Null-safe access checkbox.