when-validate-record trigger [message #509268] |
Thu, 26 May 2011 15:35 |
deahayes3
Messages: 203 Registered: May 2006
|
Senior Member |
|
|
Hello all,
I am trying to write a procedure using when-validate-record that will clear all fields, display a message and ignore all commits if user is not authorized to have access to make changes to the form.
I have tried to use Clear_form(no_validate)and clear_record and neither works, any suggestions;
|
|
|
|
|
Re: when-validate-record trigger [message #509281 is a reply to message #509270] |
Fri, 27 May 2011 00:50 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Well, perhaps you should turn it upside down. Instead of checking whether that particular user is allowed to modify items' values at the END of the story, do that at the BEGINNING. A WHEN-NEW-FORM-INSTANCE trigger, or PRE-FORM, or even PRE-BLOCK might be the candidates. SET-BLOCK-PROPERTY built-in is what I have on mind. Depending on what exactly you want to prevent, you could combine several combinations. For example: UPDATE_ALLOWED specifies whether the operator or the application is allowed to update records in the given block. So you'd
if user = 'READER_ONLY' then
SET_BLOCK_PROPERTY('block_name', update_allowed, property_false);
else
SET_BLOCK_PROPERTY('block_name', update_allowed, property_true);
end if;
|
|
|
Re: when-validate-record trigger [message #509330 is a reply to message #509281] |
Fri, 27 May 2011 03:51 |
cookiemonster
Messages: 13964 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I'm with Littlefoot. If I, as a user, entered a load of data in form, clicked save, and then got an error message telling me I'm not allowed to do anything and everything I entered disappeared - I'd be very annoyed.
Tell the users they aren't allowed to do stuff at the start.
|
|
|
|
Re: when-validate-record trigger [message #509392 is a reply to message #509390] |
Fri, 27 May 2011 08:03 |
cookiemonster
Messages: 13964 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Then block them in when-new-record-instance. Use set_item_instance_property to change update_allowed and for the records in question.
You can also do that from post-query.
And to make the users lives easier you could set the visual attributes for those records to make them obviously different from the records they are allowed to modify.
|
|
|