I try to populate some fields when a field change and it's all ok but when I try to populate a single line text field with current user property nothing happens.
This is my code
function updateCurrentUserInfo() {
pnp.sp.profiles.myProperties.get().then(function(result) {
var props = result.UserProfileProperties;
for (var i = 0; i < props.length; i++) {
switch (props[i].Key) {
case 'CellPhone':
fd.field('prova').value = props[i].Value;
break;
case 'Title':
fd.field('JobTitle').value = props[i].Value;
}
}
});
}
fd.spRendered(function(){
fd.control('ContraenteLook').$on('change', function(value){
//populate Address field with the Extra field value
fd.field('Nominativo').value = fd.control('ContraenteLook').value.Nominativo;
fd.field('Cellulare').value = fd.control('ContraenteLook').value.Cellulare;
fd.field('Mail').value = fd.control('ContraenteLook').value.Mail;
fd.field('Privacy').value = fd.control('ContraenteLook').value.Privacy;
fd.field('CIPAnagrafica').value = fd.control('ContraenteLook').value.CIPAnagrafica.Title;
updateCurrentUserInfo();
});
});
The important line in the error log is the one that says Cannot set properties of undefined (setting 'value').
It means that at least one of the fields you're addressing isn't found: likely, you either made a mistake in the name or used an incorrect function (controls should be addressed with control(), and fields with field()).
Please check and let me know about your findings. If the issue persists, export your form and send it to support@plumsail.com
Could you provide screenshots of the whole console? This error doesn't seem very relevant indeed.
Additionally, you could export your form and send it to us at support@plumsail.com. That should make the whole debugging process much quicker