1

I have a Lookup field "Assigned To" On child and "Assigned To" text field on Parent.AS soon as the "Assigned To" is populated on child object , "Assigned To" on parent is also updated with the id of "Assigned To" on child using workflow with formula Assigned_To__c.

Now I have a requirement to show the name on parent instead of id.So i changed my formula to Assigned_To__r.FirstName + " " +Assigned_To__r.LastName which is working fine.The only problem is I had to edit every record to to meet the criteria to see the change.

So my question is do i need to update every child record so the id get replaced with Name or is there some other alternative.

Evaluation Criteria for workflow is Evaluate the rule when a record is created, and every time it's edited

1

Short answer is Yes you need to update All child records to update value on Parents.

You can use SOQL and DML on Developer console to make it real quick and use some conditions to LIMIT number of records.

PS: As one Parent might have multiple child's so they overwrite the value on Parent. You need to handle this case.

  • Existing evaluation rule is someting like RecordType.Name =='BSU'&& ( (ISCHANGED(Assigned_To__c ) || ISNEW() ) || ( ISCHANGED( Actual_Completed_Date__c) || ISCHANGED( Actual_Start_Date__c ) || ISCHANGED( Actual_Received_Date__c)|| ISCHANGED( Target_Completed_Date__c ) ) ) .I cant change the field value in production.Blank update is not helping in this case – Samir Jan 3 '17 at 9:36
  • @Samir normally the best thing you can do here is remove this condition Save the WF update the records and put condition back. You can do this when not large number of users are active. – Tushar Sharma Jan 3 '17 at 9:38
1

I'd say your best bet would be to remove the Workflow Rule and the field it's updating and simply use a Text Formula Field that returns Assigned_To__r.FirstName + " " +Assigned_To__r.LastName.

If for whatever reason this isn't an option, one way (albeit probably not the best) to update records so your Workflow Rule can run would be to create a temporary field, say a checkbox called Force_Update__c and run a script that would simply tick it!

You can use Salesforce Workbench for this using a script similar to the following:

List<My_Object__c> objList = [SELECT Id, Force_Update__c FROM My_Object__c];

for (My_Object__c obj : objList) {
  obj.Force_Update__c = true;
}

UPDATE objList;

You can then delete the Force_Update__c field once everything has updated.

Some caveats:

  • Keep in mind you'll be subject to governor limits, in which case you could select 50,000 records where the Force_Update__c field is false
  • If you have a criteria for execution, you'd need to figure out how you can incorporate this

This is a hacky way of doing it and I've no doubt there's better ways, but it will work to execute your Workflow (criteria dependant).

  • Existing evaluation rule is someting like RecordType.Name =='BSU'&& ( (ISCHANGED(Assigned_To__c ) || ISNEW() ) || ( ISCHANGED( Actual_Completed_Date__c) || ISCHANGED( Actual_Start_Date__c ) || ISCHANGED( Actual_Received_Date__c)|| ISCHANGED( Target_Completed_Date__c ) ) ). creating a temporary field, say a checkbox called Force_Update__c and running a script would not fire the workflow – Samir Jan 3 '17 at 9:53
  • 1
    @Samir In which case you could add ISCHANGED(Force_Update__c) to the criteria, then remove it after you've updated everything. – Dan Jones Jan 3 '17 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.