Hi,
My use case is to add a button in the page that executes a process. This is pretty straight forward in freedom UI and i was able to achieve it.
However, the button always renders even during the creation of a record and update.
What i ended up doing is to create a new attribute "isButtonVisible" and creating 2 handlers; one for
crt.HandleViewModelInitRequest and crt.HandleViewModelAttributeChangeRequest
For the HandleViewModelInitRequest i check if the PrimaryModelMode is equal to "create" then i set that attribute to false. Subsequently, in the HandleViewModelAttributeChangeRequest handler if a field has changed value then i also set that attribute to false assuming that the PrimaryModelMode is update. Using the new attribute i set that to be used for the button visibility.
What i am asking is if there is a better way to go about achieving this goal? The behavior i am looking for is the same as the "Close" button in the form page. Is there some property that I'm missing that can be used instead to determin if the record is being updated or created. I just want the button to render only when there is no modification/creation being performed.
Any advise would be greatly appreciated.
Thanks,
J