Hi There,
I have a weird situation for a custom object which uses "$CM.getFieldById(trackingID).value" in lower environment, and gets the value correctly, whether before saving the record for the first time, which returns it as "undefined", or a real integer value after saving the record.
The odd situation is in Pre Prod, where the same code returns "undefined" whether before or after saving the record, unless I bring the field on layout.
I added the "$CM" to the "Watch" panel in the Developer Tools, and I don't see entry for the field under the "_fields" when the trackingID field is off-layout.
Any idea?
platform version 2025_02 SaaS
Originally posted on February 28, 2025 in the Archer Community.
Comments
5 comments
Off layout fields will not be rendered in the page output, so they won't be accessible to a custom object. If you want to retrieve a value for an off-layout field, you can do it by using the current record id to pull the content record through the platform API. Then you can access the value you're looking for in the resulting FieldValues collection.
Originally posted on March 3, 2025.
Thank you for taking the time to reply to my question.
The issue I'm having is that I'm able to access this off-layout field in all lower environments as seen in the screenshot below taken from developer tools, and the value is undefined since it has not been assigned yet at that moment:
The same code deployed in pre-prod, and this is how it looks:
Originally posted on March 3, 2025.
There must be something I'm missing. To confirm:
It's that last bullet I'm puzzling over, as I do not believe you should be able to find a field in the DOM at all if it's truly off layout.
Originally posted on March 3, 2025.
That's exactly what's happening here.
In pre-prod, I'm not able to get the value of the off-layout field, and as you explained, I'm getting this error message:
I'm able to get the value of the off-layout field after saving the record in DEV as seen below.
Originally posted on March 3, 2025.
The behavior you are observing in pre-prod is consistent with what I would expect. If it's off layout, you shouldn't be able to retrieve its value using getFieldById() because no field with a matching ID should be on the page.
The behavior you are observing in DEV is puzzling to me, as Archer does not render off-layout fields. If it is truly the case that the field in question is off layout but somehow available in the DOM anyway, I'd recommend opening a support ticket, as that should not be the case.
Originally posted on March 3, 2025.
Please sign in to leave a comment.