UI Builder - New button opens existing record

thomaskennedy
Tera Guru

My Device page has one required param (table) and one optional (sysId). My List's Row Clicked handler opens a url, passing table and sysId, like so:

return {
    route: null,
    fields: null,
    params: null,
    redirect: null,
    passiveNavigation: null,
    title: "anything",
    multiInstField: null,
    targetRoute: null,
    external: {
        url: "/x/acso/rf/device/" + event.payload.table + "/params/sysId/" + event.payload.sys_id
    }
};

That works fine. But my New Button Clicked handler, which returns the same url without the sysId, opens an existing record -- and always the same record.

return {
    route: null,
    fields: null,
    params: null,
    redirect: null,
    passiveNavigation: null,
    title: "",
    multiInstField: null,
    targetRoute: null,
    external: {
        url: "/x/acso/rf/device/" + event.payload.table
    }
};

find_real_file.png

So I looked at the look_up_record data source on the Device page. The param test values are set up like this:

find_real_file.png

With the params set up this way (that is, with sysId left empty), the preview shows the RFD7110517 record I mentioned above.

find_real_file.png

That looks wrong to me. The data resource should return an empty arrray until a real sysId (or -1) is supplied.

If I change the test params and put in a -1 for sysId, now the data resource preview shows an empty array.

find_real_file.png

find_real_file.png

I could go back to my New Button Clicked handler and explicitly pass a -1, like /params/sysId/-1. But if I have to pass a -1 for sysId, then that param isn't really optional. This looks like a defect. Have I overlooked something?

 

 

1 ACCEPTED SOLUTION

DrewW
Mega Sage
Mega Sage

To get a new record I have always had to pass -1 for the sys_id.  The system has always worked that way.  I would say if its an issue its just an issue with the documentation.

View solution in original post

1 REPLY 1

DrewW
Mega Sage
Mega Sage

To get a new record I have always had to pass -1 for the sys_id.  The system has always worked that way.  I would say if its an issue its just an issue with the documentation.