+ Start a Discussion
Sri KrishnamurthySri Krishnamurthy 

Setting profile before DML operations

Hi, Here is my scenario


1. I have a CFO PROFILE which announces the budget to buy some media (Stored in 'Media Finance' object). The STATUS field in this object is updated to 'BUDGET ALLOCATED' immediately.

2. The BUYER PROFILE buys the media one by one to create the line items. 

3. After creating the media line items, the buyer indicates that his purchases are DONE by clicking a 'PURCHASE DONE' CUSTOM button in the screen. This calls JAVASCRIPT function asking 'Are you sure?'. Now, if he presses 'Yes', then STATUS field in the 'Media Finance' object should go to 'MEDIA PURCHASED'. 

3. The 'Media Finance' object is the master for 'Media line items' object.




1. ORG DEFAULT for Media Finance object - PUBLIC READ ONLY

2. Media finance object has  START DATE, END DATE, BUDGET fields which are REQUIRED in the DB. I cannot make it to be 'required' only in the UI. These are absolutely required for the records in the DB.

3. I don't want to change the 'public read only' because all the fields on 'Media Finance' object should be absolutely read only for the BUYER profile.


What I tried:


1. I gave a 'MODIFY ALL' for BUYER PROFILE on 'Media Finance' object. This makes START DATE, END DATE, BUDGET also editable in the UI which is a chaos for BUYER.

2. I wrote a validation rule to make sure buyer is not updating START DATE, END DATE, BUDGET fields, but it does not solve the purpose. It still confuses the BUYER to do something other than pressing 'PURCHASE DONE' button.

3. Tried to update the record through JAVASCRIPT using sforce.connection method and it fails 'coz there is no permission.

4. My understanding is that, there is no way to give permission to edit only one field (while some other fields are 'required' in DB) in salesforce.


Is there any other better way to handle this situation? Your help is much appreciated.



Hi Krishnamurthy,


I hope you want to update something when a buyer clicks on the Button.


As he has only read permissions the update is failing.


Through javascript you can call a webservice class with global with out sharing and update the record there. The record will get updated easily.


and for standard UI the record will be read only as well.


Hope this helps...!