You need to sign in to do that
Don't have an account?
Sonia Genesse
Auto update a lookup field with a Trigger on a Customer Object for Detail Object
I realize after looking at the 2 additional Triggers needed, that they are a bit different. In these I would need to access the Detail object, not sure how to approach this.
Is this something you can help me with?
#1
I need to have the trigger update the Parts_Order_Line__c (lookup) on the SVMXC__RMA_Shipment_Order__c object, the detail object is SVMXC__RMA_Shipment_Line__c the Line Number field = NAME.
Once populated both the Product__c and the Parts_Order_Line_Serial_Number__c (both formula text fields) would need to be populated.
The Order Number on the SVMXC__RMA_Shipment_Order__c object = NAME and on the detail object SVMXC__RMA_Shipment_Line__c = SVMXC__RMA_Shipment_Order__c
#2
Need to have the trigger update the Work_Detail__c (lookup) on the SVMXC__Service_Order__c object, the detail object is SVMXC__Service_Order_Line__c the Work Detail Line Number field = NAME, update where SVMXC__Line_Type__c (picklist) = ‘Parts’
Once updated the Work_Detail_Part__c (formula text field) would need to be populated.
The Work Order number (Service Order Number) on the SVMXC__Service_Order__c object = NAME, the Work Order number on the detail object SVMXC__Service_Order_Line__c = SVMXC__Service_Order__c
Thanks for any assistance you can provide!
Sonia
Is this something you can help me with?
#1
I need to have the trigger update the Parts_Order_Line__c (lookup) on the SVMXC__RMA_Shipment_Order__c object, the detail object is SVMXC__RMA_Shipment_Line__c the Line Number field = NAME.
Once populated both the Product__c and the Parts_Order_Line_Serial_Number__c (both formula text fields) would need to be populated.
The Order Number on the SVMXC__RMA_Shipment_Order__c object = NAME and on the detail object SVMXC__RMA_Shipment_Line__c = SVMXC__RMA_Shipment_Order__c
#2
Need to have the trigger update the Work_Detail__c (lookup) on the SVMXC__Service_Order__c object, the detail object is SVMXC__Service_Order_Line__c the Work Detail Line Number field = NAME, update where SVMXC__Line_Type__c (picklist) = ‘Parts’
Once updated the Work_Detail_Part__c (formula text field) would need to be populated.
The Work Order number (Service Order Number) on the SVMXC__Service_Order__c object = NAME, the Work Order number on the detail object SVMXC__Service_Order_Line__c = SVMXC__Service_Order__c
Thanks for any assistance you can provide!
Sonia
All Answers
I'm a little confused as to what you are trying todo and most of that is because I don't completely understand your object model. You mention that formula fields would need to be updated. Formula fields by definition are not updated, they are automatically "updated" whenever the data is viewed based on the current data.
So you are trying to set the Product field on X number of SVMXC__RMA_Shipment_Line__c objects that are children of your SVMXC__RMA_Shipment_Order__c. The product field on your SVMXC__RMA_Shipment_Order__c is a text field that corresponds to the Name field on your SVMXC__Installed_Product__c object.
The SVMXC__RMA_Shipment_Order__c object is what is shown in the images posted above. And the SVMXC__RMA_Shipment_Line__c looks like this:
Ok so the Parts Order Line is a Related List on the RMA Shipment Order page:
And the second issue, you need to populate the Part field with the product's Id if the line type is equal to part? This is going to be very close to the trigger from the other issue. This trigger will probably need more love since I wasn't sure what the field names were.
As for #2 Part field name = Work_Detail_Part__c where SVMXC__Service_Order_Line__c.Name = SVMXC__Service_Order__c.Work_Detail__c , need the Product Name (SVMXC__Installed_Product__c) not the Product ID
I won't be able to test these right away since I need to deploy changes via change sets to Sandbox in order to test these triggers :/
So if I need to add fields as noted above, I'll need to do that first as well. Since we are not yet Live in our Prod Org, this will become our Sandbox post go-live.
Thanks again for helping me with this!!!
I completed the Change Sets for #1, here is what I have in the Trigger (Note changes per your ToDo's, but I have one error:
If Parts_Order_Line__c is the right right field on the SVMXC__RMA_Shipment_Line__c object.
Though that's giving me an error as well....?
That is the field we want to update the "Parts Order Line" on the the SVMXC__RMA_Shipment_Order__c. object.
However, this isn't working and throws an error........ "Invalid field SVMXC__RMA_Shipment_Line__c for SObject SVMXC__RMA_Shipment_Order__c at line 8 column 47"
OR am I being dense as mud today :)
This is because the Lookup field is populated with the Id of the object that it is pointing to. The name is displayed because it's easier to understand than using the random id :)
Here is the compile error I am getting now, since this field update is occuring on the SVMXC__RMA_Shipment_Order__c obejct shouldn't line 1 be for this object or not?
Thanks!
Sonia
Ok, not a very intuitive error, but I guess since the first Trigger we previously worked on had that name, I guess I can see why.
I now was able to place the Trigger (with a new name) on the SVMXC__RMA_Shipment_Line__c object and ran a quick test for creating a new Parts Order with a Parts Order Line.
The Parts Order Line had this error:
I did a quick search online and found it states the following, which was in regards to Account in this case:
You can't set the id of the account(or any object on insert), it gets set on its own. (this is why you see the error)
Any ideas?
Filter Criteria: Parts Order Line: Parts Order ID EQUALS Parts Order: Record ID
So bcuz it is a lookup, we should not assign an Id to that field, what do we need to do to update/replace the use of the Id?
Since we are working on Issue #1, I will send you all Fields for Object SVMXC__RMA_Shipment_Order__c and SVMXC__RMA_Shipment_Line__c, pls let me know if you require anything else other than these two Objects listed.
Thanks!
That should be what you need
I'll work on getting the change sets over to Sandbox for #3, should I send you the Object details of that one as well to make the process go smoother? We should be very close
One thing though, we are not using the Parent Work Order field, we us the auto numbering scheme to assign the Work Order number as the Record Id
Thanks so much for your time,I appreaciate everything. You've been a real life saver!!!