Dear @UDRO,
You're not accessing a field in routing, the form is not loaded. You can get some values from the item itself, including a lookup ID value, like this: FieldName + Id
//check if Item already exists, will return true for Edit and Display Form
if (item) {
// return Promise
return item.get()
.then(function (item) {
//if Item's Lookup field ID value is 1
if (item.LookupId === 1) {
//return ID of a Form Set
return '31fb1f41-63f3-48ff-a1c2-18b4e7f7c3e7'
}
});
}
Dear @UDRO,
It always depends on the item, which in turn is retrieved with pnpjs. One way to check it is to add console.log(item), like so:
//check if Item already exists, will return true for Edit and Display Form
if (item) {
// return Promise
return item.get()
.then(function (item) {
console.log(item);
});
}
Make sure to open browser's console and use setting Preserve log, so it doesn't get erased on redirection: