Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2023 03:38 AM
var payload = JSON.parse(facilityPayload);
var dslDeviceName = (payload.enhSoiuShowServiceOrderReply.intDslAidNumber.dslDeviceName) ;
so if enhSoiuShowServiceOrderReply.intDslAidNumber.dslDeviceName is not present in the payload i am getting a undefined error. I understand why i am getting the error. But not able to figure how to validate it.
i tried JSUtils.notNil it didnt wok. i Also tried using the following function
i tried JSUtils.notNil it didnt wok. i Also tried using the following function
function myFunction(obj1) {
if (obj1 == null) {
obj1 = "";
} else if (typeof obj1 == undefined ) {
obj1 = "";
}
return obj1;
}
still not able to resolve it.
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2023 03:40 AM
Put your code in try catch block and then check.
try{
var payload = JSON.parse(facilityPayload);
var dslDeviceName = (payload.enhSoiuShowServiceOrderReply.intDslAidNumber.dslDeviceName) ;
}
catch(e){
}
Raghav
MVP 2023
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2023 03:40 AM
Put your code in try catch block and then check.
try{
var payload = JSON.parse(facilityPayload);
var dslDeviceName = (payload.enhSoiuShowServiceOrderReply.intDslAidNumber.dslDeviceName) ;
}
catch(e){
}
Raghav
MVP 2023
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2023 04:06 AM
Thanks @RaghavSh ..... it worked.