Profile.Model does not return the value of a customer field.

By default, the Profile model returns the values as shown below

To get the required fields values other than in the profile model, update the profile model by extending it and add the field to the response.

// This code is used to get the value of customer subdividion from profile model//

_.extend(Profile, {
getSubDivision: function getSubDivision() {
var customFields;
var subdivision;
if (session.isLoggedIn2()) {
customFields = customFieldsParser(customer.getCustomFieldValues());
subdivision = customFields.custentity_tag_partner;
} else {
subdivision = '';
}
return subdivision;
}
});
Application.on('after:Profile.get', function afterProfileGet(Model, responseData) {
responseData.subdivision = Model.getSubDivision();
});

Leave a comment

Your email address will not be published. Required fields are marked *