Skip to Content
0
Oct 26, 2021 at 02:55 PM

get message value of responseBody

207 Views

Hello,

I'm trying to show error message from backend using "JSON.parse(actionResult.error.responseBody).message.value". It is working correctly on web version, but not working on mobile. Could you please help me what I am missing here? I'd like to show only message.

    var actionResult = clientAPI.getActionResult('update');

    if (actionResult && actionResult.error) {
        if (actionResult.error.responseCode > 0) { 
            return 'Update Fail [' + actionResult.error.responseCode +'] ' + JSON.parse(actionResult.error.responseBody).message.value;
        } else {
            return actionResult.error.message;
        }
    }  
    return 'Entity failed to update.';

Thanks.