tashsmith
asked on
Setting a group of field values when document is saved
I have two groups set up controlling access to a particular database. These groups are called "ContentEditors" and "ContentAuthors".
When one of the users in either of these groups save a document, I would like to set a number of fields to the value "Waiting", regardless of their current values when a document is saved.
These are editable fields:-
p1
p2
p3
p4
This should not happen if the user is NOT in either of the two groups..
Any tips on how this can be done would be greatly appreciated..
Thank you
When one of the users in either of these groups save a document, I would like to set a number of fields to the value "Waiting", regardless of their current values when a document is saved.
These are editable fields:-
p1
p2
p3
p4
This should not happen if the user is NOT in either of the two groups..
Any tips on how this can be done would be greatly appreciated..
Thank you
ASKER
Right OK, the @UserRoles solution does seem more sensible. Both these groups have the role of 'publisher', which should govern this behaviour.
Would this be the way to deal wth this?
@If(@IsMember("[publisher]
@Do(
@Setfield("p1"; "Waiting");
@Setfield("p2"; "Waiting");
@Setfield("p3"; "Waiting");
@Setfield("p4"; "Waiting")
)
)
thks
Exactly. Note that member checking in Formula language is case-sensitive. For free is
@If(@IsMember("[publisher] "; @Lowercase(@Userroles));
@Do(
@Setfield("p1"; "Waiting");
@Setfield("p2"; "Waiting");
@Setfield("p3"; "Waiting");
@Setfield("p4"; "Waiting")
);
""
)
Note: additional line with ""
@If(@IsMember("[publisher]
@Do(
@Setfield("p1"; "Waiting");
@Setfield("p2"; "Waiting");
@Setfield("p3"; "Waiting");
@Setfield("p4"; "Waiting")
);
""
)
Note: additional line with ""
ASKER
OK, I have more than one form in the database design, is there somewhere globally that this can be placed?
ASKER
BTW the user gets a prompt to save on exit (esc) , we do not have a save button as such
> When one of the users in either of these groups save a document ...
Then how do they save? There is Esc, and then Yes, or Ctrl-S for save.
You say you have more forms, but are they doing exactly the same?
Please explain the desired functionality, as my assumptions are often wrong...
Then how do they save? There is Esc, and then Yes, or Ctrl-S for save.
You say you have more forms, but are they doing exactly the same?
Please explain the desired functionality, as my assumptions are often wrong...
ASKER
We have a number of forms, all of these forms will be used by documents and saved by people who will either, use CTRL-S of ESc and be prompted to Save.
In all cases this should work.
@If(@IsMember("[publisher] "; @Lowercase(@Userroles));
@Do(
@Setfield("p1"; "Waiting");
@Setfield("p2"; "Waiting");
@Setfield("p3"; "Waiting");
@Setfield("p4"; "Waiting")
);
""
)
Thanks
In all cases this should work.
@If(@IsMember("[publisher]
@Do(
@Setfield("p1"; "Waiting");
@Setfield("p2"; "Waiting");
@Setfield("p3"; "Waiting");
@Setfield("p4"; "Waiting")
);
""
)
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
What I meant by this should work, was that the script should run on all forms where the user has the role 'publisher'.
I have tested it on one form and it works very well.
I will add it to the QuerySave events of all forms that require it.
Thanks very much
I have tested it on one form and it works very well.
I will add it to the QuerySave events of all forms that require it.
Thanks very much
Welcome :)
Do all forms have the same fields? Are those forms very similar? Do you use subforms? If that's the case, you could add the formula to the QuerySave of a subform that you use in all forms.
Do all forms have the same fields? Are those forms very similar? Do you use subforms? If that's the case, you could add the formula to the QuerySave of a subform that you use in all forms.
ASKER
Yes I have added to the subform that holds the fields in question. All works a treat!!
The usual solution is to give a group a role as well, so you can use @UserRoles to find out a user's rights:
@If(@IsMember("ContentEdit
@Do(
@Setfield("p1"; "Waiting");
@Setfield("p2"; "Waiting");
@Setfield("p3"; "Waiting");
@Setfield("p4"; "Waiting")
)
)