Hello! I read all the documentation and all the discussions here but I still cannot make an extra field work.
In my main list I have a lookup column [Currency] to another list (lookup by Title). In the second list I have a column Rate. I have a Rate column in my main list (number column). I need Rate to be populated with the number from the second list (I need it on New form as I need to do calculation after). This is my script:
fd.spRendered(() => {
var lookup = fd.field('Currency');
lookup.extraFields = ['Rate']; // get extra fields
function updateFields() {
fd.field('Rate').value = lookup.value.Rate;
}
updateFields(); // update fields on form render
fd.field('Currency').$on('change', updateFields); // update fields whenever the lookup value is changed
});
And Extra column is set up on the form, what am I doing wrong?
@Margo Happy New Year Sorry, we were on a Christmas - New Year break.
In both lists, the internal name of columns is Rate, they are both Number columns.
I removed the line from the code and it is still not showing the value, here is the code now:
fd.spRendered(() => {
var lookup = fd.control('Currency');
function updateFields() {
fd.field('Rate').value = lookup.value.Rate;
}
updateFields();
fd.control('Currency').$on('change', updateFields);
});
I am doing it on a New form and getting this error in the console still:
Dear @katy,
Try to change fd.control('Currency'); to fd.field('Currency'); - we support both fields and controls, but it looks like you're using fields in this case.
Hi @Nikita_Kurguzov , that didn't work either :-(( I already created a new list with only these two fields to test and only this code - still not working. I wonder if I am missing something simple. I can make a video of this issue and send it to you if you could look or we can set up a meeting (during your work hours) as we've bought some service hours with you. What would be the best way?