Question

Only allow certain users to update a field

  • 23 May 2020
  • 5 replies
  • 763 views

Userlevel 3
Badge +9

We use permissions sets to specify whether users have none, query or full access to screens, but if for example 10 users in a permission set have full access to a screen, whats the easiest way to only allow 1 of them to update a specific field on that screen?

 

Thanks, Chris.


5 replies

Userlevel 3
Badge +9

Meant to put this in the technology section but cant see how to change it

Userlevel 7
Badge +21

Hi @chrisplant ,

You won’t be able to do this through a permission set along as the insert/update privilege cannot be controlled on a per field way. I think your best bet would be to use  a custom event with the type SQL to do this and raise an error message when a user how is not suppose to update this specific field tries to update it. You can do your validation on who can update and who cannot, in the SQL block it self (i.e. users who are granted a specific dummy permission set can update the field) . 

Cheers

Userlevel 5
Badge +10

This is an example of such an event, this is for Dutch and English.

 

BR/MR10

 

DECLARE 

  Is_Prop_Auth_   VARCHAR2(5)       :=  ifsapp.Posting_Prop_Auth_Util_API.Is_Proposal_Authorized('&NEW:COMPANY',&NEW:INVOICE_ID,1); 

  USRLANG_          VARCHAR2(55)     :=  '#USER_LANGUAGE#'; 

  MSGNL_              VARCHAR2(200)   :=  ‘XXX.'; 

  MSGENG_           VARCHAR2(200)   :=  XXX '; 

  role_                   NUMBER:=0; 

 

CURSOR get_role 

IS 

SELECT COUNT(1) 

  FROM ifsapp.fnd_user_role f  

  WHERE f.role IN (XXX) 

  AND f.identity = ifsapp.fnd_session_api.Get_Fnd_User; 

 

BEGIN 

  IF ifsapp.fnd_session_api.Get_Fnd_User  <>  'IFSAPP'  THEN 

    IF '&NEW:PARTY_TYPE' = 'SUPPLIER' THEN 

        OPEN   get_role; 

        FETCH  get_role INTO role_; 

        CLOSE  get_role; 

        IF role_ = 0 THEN 

              IF  '&NEW:AUTHORIZED' = 'TRUE'  AND  Is_Prop_Auth_ = 'FALSE'  Then 

                      IF USRLANG_ = 'nl' THEN 

                             Error_SYS.Appl_General('FOUT',MSGNL_); 

                      ELSE 

                           Error_SYS.Appl_General('ERROR', MSGENG_); 

                      END IF; 

              END IF; 

        END IF; 

    END IF;     

 END IF; 

END; 

Userlevel 3
Badge +9

Thanks, I did have a quick look at creating a custom field based on membership of an admin usergroup.

NVL(user_group_user_api.get_objkey('9C9D1908B38A49688B7B01C9624768C5',FND_SESSION_API.Get_Fnd_User),0)

And I then created a conditional field with a read only value which checks if the custom field is 0.

This works well but i then couldn’t see howto restrict someone removing the conditional field check.

Userlevel 3
Badge +9

In the end, I set the field to read only in the form properties. I then created a couple of custom menus that set the field to different values. The code checked to see if the current logged in user was a member of a specific user group. 

 

 

Reply