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
MegachuckmcMegachuckmc 

Updating fields cross-record

I'm trying to create a Workflow rule which does the following:
 
When a new record is created the workflow will search to find a previously created record which is related to the new record and then take the value in a field from the new record and update the corresponding field on the old record.
 
Or more specifically...
1) When a new Sales Order is created in my ERP system our integration tool creates a "Sales Order" record in Salesforce. We are using the Scribe integration tool and Sales Order object that they have implemented.
 
2) One of the fields on the Sales Order record is "Fulfillment Date" which comes over as blank.  Weeks later when the order actually ships the ERP creates an "Invoice" record in Salesforce in which the "Fulfillment Date" is now filled in with the shipping Date.
 
3) There is a field on both the Sales Order and Invoice record called "Master Number" which effectively ties these two records together.
 
What I want to be able to do is take the value from the "Fulfillment Date" field on the Invoice record and populate it onto the "Sales Order" record.
 
Any help or suggestions would be greatle appreciated!
 
Mike
FreshFresh
Hi Mike,

Unfortunately a cross-object workflow is not currently possible, nor is it possible to have a formula field take a value from a child record...

This can however be done with an Apex Trigger if you have a developer or if you feel like learning Apex. Because this is a fairly simple Apex Trigger, it may be a good one to cut your teeth on.

- Jeff
NPMNPM
Try searching Help and Training on cross object workflow.  There is good informatin there and at least one example of cross object workflow/field update.
FreshFresh
NPM is technically right in saying that cross-object workflows are possible, but they are only possible on the lowest hanging fruit. For example, I could have a workflow that notifies me when a new opportunity is created for a specific account, because the Opportunity is a child of the account, and thus I have access to all of the fields on the account.

That said, what you want to do would be to actually modify the parent record based on the child record which is not currently possible (the reason for this is that a record can have one parent, but multiple children, thus it would be impossible to tell which child to look at in a cross object workflow or formula).

An Apex trigger is still your best bet, but if it is always going to be a 1:1 ratio of Sales Order to Invoices, and if you have an integration expert on hand, it may be possible to effectually flip the two objects. What I mean is have a lookup to the Invoice on the Sales Order, and when the invoice comes in the integration tool could populate the Invoice lookup on the Sales Order object with the Id. Then, you could have a formula field look at the Fulfillment date.

I'll be anxious to see what you go with =)