I have used already in a different list the functionality to set a library (rootfolder) based on a column field in the parent list. However it seems I can't replicate the same succes.
I am using the following code in JS editor
fd.spRendered(function(ctx) {
var dt = fd.control('ProjectLibrary');
dt.ready(function() {
setRootFolder();
});
//set root folder when Category field changes
fd.field('ProjectID').$on('change', function() {
setRootFolder();
});
function setRootFolder(){
var category = fd.field('ProjectID').value;
if(category){
dt.baseRootFolder = category;
dt.rootFolder = category;
}
}
Anyone any idea, what I am doing wrong ? I can't see it, have tried many other codes. (Constant, Dynamic, with var, with Strings, also tried other coloms in the SP list with or without Index. Don't know.
thanks for the response. Check @Nikita_Kurguzov comment, but it looks like your column is Text. What comes to my mind is, that InternalName of the column is not "ProjectID". Can you check it and send screenshot?
I think that the field is not present on the canvas.
You are trying to read data from ProjectID, but the field is not on the canvas in the designer.
Looks like code is working, but as the developer console alerts, you can see that "cannot read of properties "undefined"".
Try to check it if the field is present (and yes, I saw the image at the top). Please try to enable this field - disable "read only" for testing purposes.
strange behaviour. Sometimes I had some issues also with some text fields (randomly), on SharePoint 2019 (have not figured it out). Always solved by creating a new column and replaced that. Of course during the development, not in the production where all the documents were related to the field.
What about triming the input from ProjectID?
Like: