I have documents that have 3 fields that can be used to "categorized" the document. For the breadcrumbs, I want to have these fields shown and the link will open up a view at that "category" level (open single category in view).
Now all "category" fields are not mandatory in the document. I thought I'd write up a SSJS function that would return the necessary object to control the breadcrumbs, but I am having a tough time figuring out what to do to have the link actually work.
My function looks like this, so far:
function getBreadCrumbs(doc:NotesDocument) {
var breadCrumbs=[];
//always add home as first level
var thisCrumb = {label:"Home", page:"/home"};
breadCrumbs.push(thisCrumb);
if(doc.hasItem("CategoryV2")) {
var label:String = doc.getItemValueString('CategoryV2');
if(label!="") {
var thisCrumb = {label:label, page:"/home"};
breadCrumbs.push(thisCrumb);
}
}
if(doc.hasItem("SectionNameV2")) {
var label:String = doc.getItemValueString('SectionNameV2');
if(label!="") {
var thisCrumb = {label:label, page:"/home"};
breadCrumbs.push(thisCrumb);
}
}
if(doc.hasItem("SubSectionNameV2")) {
var label:String = doc.getItemValueString('SubSectionNameV2');
if(label!="") {
var thisCrumb = {label:label, page:"/home"};
breadCrumbs.push(thisCrumb);
}
}
if(doc.hasItem("Subject")) {
var label:String = doc.getItemValueString('Subject');
if(label!="") {
var thisCrumb = {label:label};
breadCrumbs.push(thisCrumb);
}
}
return breadCrumbs;
}
What would be needed to have the link actually work: does the "page" object need to be named something else?
Thanks for the help/tips