Is there any way to mark a field/set of fields as being unchanged on a form page from code? We have some parameter fields which do not link to the page's data source, and have a separate button for managing saving this data (we are on 8.2.0, so cannot use multiple data sources for the same page) but at the moment when saving this data the fields will remain "dirty" and so the regular Save button will be shown & a warning will show if the user tries to navigate away from the page. What we would like is for the custom parameter saving button to clear those fields when it's finished and then mark them as unchanged/non-dirty so that this is avoided.
Like
Hello Harvey,
Use this code to set values to such parameters, the "Unsaved changes" popup won't be triggered in this case:
request.$context.setValue({ PageParameters_UsrTextParameter1_4ex6wda: "Test value for the text parameter", }, { preventStateChange: true });
There are also additional parameters that can be specified (but to prevent the "Unsaved changes" popup the preventStateChange is enough):
request.$context.setValue({ PageParameters_UsrTextParameter1_4ex6wda: "Test value for the text parameter" }, { preventAttributeChangeRequest: true, preventRunBusinessRules: true, preventStateChange: true, });
Thanks Oleg, but the request on this one is slightly different - given that these are page parameters with visible & user-editable fields on the page, when the user makes some changes to those fields and then clicks a button (which does not trigger a full save of page data), we want to be able to mark the specific fields as being "clean" from code in the same way that the OOTB Save button does for all fields on the page. Is this possible?
I'd love for the ability to just mark page parameters to not trigger the "is dirty" for a page at all. Sometimes I will use params for user interaction of some kind but there's no data to save for them, so I'd like to flag the parameters as something that doesn't trigger the need to save. I've not been able to find a way to do that :(
Harvey Adcock,
No, those are treated as actual changes to the page the user made manually and should trigger the pop-up.
Oleg Drobina,
So there is no way to manually mark specific fields that are dirty as clean then, the only way to mark fields clean is to mark every field as clean via the save/cancel buttons?
Ryan Farley,
Agreed, being able to specify that specific Page Parameters should never trigger the page to think there is unsaved data would help out in quite a few scenarios I've worked with.
Hello,
We have registered this idea for our R&D team. Thank you for pointing this out.