function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sailaja majji 5sailaja majji 5 

Profile should be reverted after 24 hrs

Team ,

I have a requirement  .If a system admin is giving system admin access to another user ,then after 24 hours automaticaly it should be reverted back to original profile .

Can you give different approaches to achieve this  .

Here is my analysis .

I am thinking trigger best suits here ,not a workflow since we need previous profile value to revert it back  .

In trigger i was thinking how to revert the profile after 24 hrs .How can  we schedule the time for the profile to revert the change (do we need to write apex class and schedule it thorugh scheduler .)

Please let me know your thoughts 

Thanks,




 

Best Answer chosen by sailaja majji 5
sailaja majji 5sailaja majji 5

Just in case if somebody is facing the same scenario .
The below solutions worked for me and successfully went to production'.

I have created 2 fields on User object and written  a trigger to update a field and time trigger workflow to reset the profile after 24 hrs which inturn cals the trigger .

All Answers

ManojjenaManojjena
Hi Sailajja,

As per my knowledge it is not possibel to exectue a trigger based on time ,it is sure that it will execute only when you will do any DML on the particular object .

Depends on you rrecordset you need to decide you will go for batch and schedule or not .

Is there any definite set of user which profile will change for 24 hours ? if yes then you can give some indentification ,
Is it a regular process that System admin will give SysAdmin access to those user daily or weekly or monthly once .If it is then you can go for batch and schedule .if more number of user then both batch and schedule or only schedule .

Another option we can use time based work flow to achive this we can create a date fileld which wil update the date when the user recor dwil update from other profile to systemadmin and based on that date field we can execute the WF to update the user profile after 24 hour .

Let me know if it helps ,For futher help please clarify your requirment .

Thanks
Manoj

 
sailaja majji 5sailaja majji 5
Thanks Manoj ,

Time based workflow does look good but i am concerned about getting the user profiles old profile so that once 24 hrs are passed i can revert it back from system administrator to original profile . 
 
sailaja majji 5sailaja majji 5
And regarding the frequency it applies to any user who is granated temporary access as system adminustrator by system administrator .
 
ManojjenaManojjena
Hi Sailaja,

Old profile value you can get from formula filed ,while set the profile change date  through field update action .and entry criteria you need to check that the formula field value which does not contain system administrator .

let me know if it helps !!
Thanks 
Manoj
sailaja majji 5sailaja majji 5

Thanks Manoj ,
This is how i gave the workflow rule whihc evaluates to formula .Profile date change i think i can rely on last update date .
But i didnt  "Old profile value you can get from formula filed "
Can you send me the trigger rule and the action for the time trigger

Thanks,

Sailaja

 

sailaja majji 5sailaja majji 5

Just in case if somebody is facing the same scenario .
The below solutions worked for me and successfully went to production'.

I have created 2 fields on User object and written  a trigger to update a field and time trigger workflow to reset the profile after 24 hrs which inturn cals the trigger .
This was selected as the best answer