You need to sign in to do that
Don't have an account?

Apex class search for value in Field
On creation of a record I need to update its name based on a value on existing records.
For example a new record is created and the code Id is 12345
If a record exist with this value I need to set the new record code Id to 12345_001. This will continue so if the latestcode ID value is 12345_054 the new code Id needs to be 12345_055
So how do I search for this value and set the new one? Will this be an issue on data loads?
Thanks,
P
For example a new record is created and the code Id is 12345
If a record exist with this value I need to set the new record code Id to 12345_001. This will continue so if the latestcode ID value is 12345_054 the new code Id needs to be 12345_055
So how do I search for this value and set the new one? Will this be an issue on data loads?
Thanks,
P
Refer the URL to see how you can use aggregate results -> https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_agg_functions.htm
All Answers
Refer the URL to see how you can use aggregate results -> https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_agg_functions.htm