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
Ravi MehtaRavi Mehta 

How to update field with value provided by user, through Quick Action?

Hi There,

I need to setup a Quick Action on a custom object, which should ask user for an Amount to be Deposited/Credited, and accordingly Current Balance should get updated. Could you please help me setup such scenario?
Let me know in case you need any additional information for it.
Sagar PatilSagar Patil
Hi Ravi,

1.You can create formula field with return data type as Currency.
2. Create formula based on requirments.
3. When a user will enter amount in 'Amount to be Deposited/Credited' field and save the record, the formula field will display the calculated current balance.
4. If you want current balance to be calculated and populated automatically before saving the record then you will have to go with code approach only.

Hope this helps!

Kindly mark this answer as best answer if it helps you.

Regards,
Sagar
Selva Ramesh 4Selva Ramesh 4
Hi,
Just add the criteria in the predefined action of what you want in the custom action button.

The criteria should set on the current balance field like (Deposited__c+ Current Balance__C)

You should activate the feed tracking first then only you can use the quick action.

Tell me the exact scenerio i will make and let you know.

Thanks,
Selva
 
Ravi MehtaRavi Mehta
Hi,

I missed to mention that, I do need to keep the Opening Balance as well, which will be set by user when record is created, and then should not change.
  • When record is created, Current Balance = Opening Balance
  • When record is updated, Current Balance = Current Balance + Deposited Amount
Hence, the challenge with formula field would be, I have to set it up with formula as, Current Balance = Opening Balance + Deposited Amount, which would not give desired output on Current Balance.

However, my challenge is resolved now, after following below approach:

1. Created Number type fields Current Balance, and Deposit Amount.
2. Created a trigger to run before insert/update, and 
  • If Tigger.insert, then Current Balance = Opening Balance
  • else Current Balance = Current Balance + Deposit Amount
Thank you very much for your responses.