9
votes
Accepted
2 workflows vs Process builder. Which one is better?
You should go with Process Builder. The beauty of process builder is one process can handle multiple criteria updates and all of them will be in a single process like the one you have now.
Process ...
9
votes
Accepted
How do processes consume SOQL queries?
It's one DML and SOQL per 200 records or a single DML "chunk."
To illustrate this, consider the following code:
contact[] c = [select id from contact limit 5];
id accountid = [select id from account ...
7
votes
Truncate first five digits of postal zip codes
Assuming you want to take the first 5 digits from the zipcode field to use in the validation rule, you can use the LEFT function to do that. As per the Salesforce documentation, the LEFT(text, ...
6
votes
Accepted
Workflow Rule (Ischanged) - Field is not updated when the record is created
Well, aside from the AND being extraneous, you need to add an ISNEW check to your OR clause if you want it to fire on create. The ISCHANGED formula returns false on create.
OR(ISNEW(), ISCHANGED(...
6
votes
Accepted
Sum of fields in a field update when some of the fields are null
Your friend is the BLANKVALUE function that if the first argument is null, will use the second argument as the value of the expression
BLANKVALUE(Field__c,0) + BLANKVALUE(Field1__c,0) + ...
6
votes
Accepted
How to get parent data in a before insert context?
You can just query the PricebookEntry records instead:
Set<Id> entryIds = new Set<Id>();
for (QuoteLineItem item : trigger.new) entryIds.add(item.PricebookEntryId);
Map<Id, ...
6
votes
Accepted
Why does __r result in a null value?
You need to perform a separate query to retrieve names. Salesforce doesn't return values from related object's fields, though it will not give you the error rather it returns null.
Here is an ...
6
votes
Accepted
Optimistic locking when working via REST API
If the Ruby script updates a record between the time the user loads the edit page and clicks Save, they'll get a "record has been modified" error to prevent them from overwriting data.
If the user ...
6
votes
Making updates to mass records using batch apex faster
Based on your code, it's clear that there's not much you're going to do to improve performance. However, one major improvement would be to increase the scope size, assuming it does not cause you to ...
6
votes
Accepted
How to update picklist using REST API
As the other answer says, you can do this via the Tooling API if you want to use a REST call. You can find the details on their answer. The other option is to use the Metadata API which is a SOAP API. ...
6
votes
Fire Journey Builder when Contact Object is Updated
The documentation is a little misleading when it states: "The rule does not run when a record that previously met rule criteria is updated". Makes it sound like a record can't qualify again.
So for ...
6
votes
How would you use Schema.SObjectField to dynamically get the values of each field for the object?
You're looking for getPopulatedFieldsAsMap. This gives you a Map where the key is each populated field, and the value is each value stored in the record. Unpopulated values won't be present.
5
votes
Accepted
Before Insert Trigger not updating field
well, one issue is with your testmethod - you need to requery the Contact to get the value set in the trigger
Contact c = new Contact(LastName='x',MailingCountry='Angola');
insert c;
...
5
votes
Convert Trigger to use Dynamic Apex
I agree with @crop1645 that DLRS is a good option here, but if you must roll your own it would look something like:
Utilities
Getting Parent Ids
I consider the following utility essential. It is ...
5
votes
Accepted
How to update a field with Lightning Components?
I think the error lies in these lines
var action = component.get("c.account");
action.setParams({ "account": account });
try changing it to
var action = component.get("c.saveAccount");
var account ...
5
votes
Accepted
Adding One Year to Date Field Value Through Custom Button
It would look something like this:
{!requireScript("/soap/ajax/37.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject("Invoice_Statement__c");
c.id = "{!Invoice_Statement__c.Id}";
c....
5
votes
Accepted
help with trigger business logic
I advise you to implement this functionality declaratively. In this case, you simply need a Workflow Rule and a Validation Rule.
I highly recommend you read Visual Development – When to Click Instead ...
5
votes
Accepted
why the trigger is executing only once after workflow is fired?
The trigger(s) (and it is both Trigger 'A' and Trigger 'B' in your example) are only being executed once after the workflow field update because that's how Salesforce has decided to make things work.
...
5
votes
Accepted
priorvalue is blank or --None-- update internal status "In-progress" workflow
Try this.
AND(
ISBLANK(TEXT(PRIORVALUE(InternalStatus__c))),
NOT(ISNEW())
)
5
votes
Accepted
PrePopulate Task with related data even before creating a Task
Triggers are supposed to work that way. They do not pre-populate data on the screens but only update it during the transaction.
Out of the box, you will not be able to pre-populate data. If you can ...
5
votes
Refresh the page after the flow completes
Unfortunately, the UnofficialSF solution didn't work for me, but was able to get a similar solution working.
Similar to the UnofficialSF component, add the following aura component to your flow where ...
5
votes
Accepted
Send only udpated fields instead of all the field information
You can use the CDC (Change Data Capture) to get updates only on updated fields. You could also write manual code (Apex) to create a change delta, although this might require a lot of CPU time ...
5
votes
Accepted
What is the order of execution for the final approval actions in a standard approval process?
They will not be guaranteed to fire in the order you see listed, however this will still work out for you.
In Considerations for Field Update Actions that covers creating field updates for workflow ...
4
votes
Update check box using workflow
Go to Setup Menu->Create->Workflows->Process Builder->New->
NameYourProcess
Save
Add Object You wanna make this workflow work On
Mark "when a record is created or edited"
Save
Add Criteria -> ...
4
votes
Accepted
Workflow Rule Execution criteria
There's a limit of 5 recursions (e.g. five successive field updates that cause further rule evaluation), and a limit of 50 active workflow rules per object. In order for, e.g. WF2 to trigger WF3, it ...
4
votes
Accepted
How to set a value multiple times within same update
Not sure I fully understand, but I suggest:
for (Revenue_Pipeline_Schedule__c s : scope) {
Revenue_Pipeline__c p = pipelines.get(s.Revenue_Pipeline__c);
// First clear all
for (...
4
votes
How to do a batch job to update a field in a parent object from multiple child object fields?
If you want to persist your changes in the database, you have to perform a DML Operation (in this case update):
for (MyObject__c record : scope)
{
// manipulate data
}
update scope;
I would also ...
4
votes
Accepted
apex:inputField not binding value to controller
You have multiple forms on your page. You button is in a separate form so when you submit it does not grab the value from the input fields in the other form.
Wrap you entire code in the form as ...
4
votes
how to pass prior and current value to apex when record changes through process builder?
This can be achieved using below Class and Process Builder:
public class PrintInvocable {
public class MyInvocableVariable {
@InvocableVariable(label='Id' required=true)
public Id recId;
...
4
votes
Accepted
How can I update a text field on a child object with a value from it's parent without using a formula field?
This can be achieved by Workflow rule field update which will be executed on Product Rating object.
Workflow Evaluation criteria: Evaluate the rule when a record is created, and every time it's ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
field-update × 439trigger × 102
workflow × 101
apex × 96
formula × 38
process-builder × 37
formula-field × 27
update × 24
visual-workflow × 22
custom-field × 16
date × 14
approval-process × 14
before-trigger × 14
custom-object × 12
batch × 11
picklist × 11
lookup × 11
datetime × 11
lightning × 10
workflowrule × 10
visualforce × 9
javascript × 9
account × 9
marketing-cloud × 8
case × 8