+ Start a Discussion
Lavanya Ponniah 3Lavanya Ponniah 3 

How to do the trigger for below question?

For example I have Order object and vehicle Installation__c  ,i am adding product to that that order using order item.Now my question is the sumof the quantity of ordered  product has to copied to total product field in the vehicle_Installation__c whenever i create new Vehicle installation under the Order related list page.Then i need to input Installed_quantity__c in one field for that day.This value has to subtracted from the Total product field value and stored it in Pending_Installation__c field .Then record is saved,after that I want to create new Vehicle_Installation here I input Installed_quantity__c and it have to subtract the previous record value of Pending_Installation__c
You should be able to update the installation object with a cross-object formula field rather than a trigger.  I'm not sure where the installed quantity field is going to be, on the order object?  If so, that may need a trigger to calculate the value of the daily installations field.  Also, not sure where the pending installation field resides?  If you post a picture from Schema Builder that shows how all of these objects and fields are related, that would be helpful to understand what you are working on.