You need to sign in to do that
Don't have an account?
Apex code cross object
Hi,
I am trying to create an Apex trigger between 2 cross object fields.
I have a custom object Sale_c , and there is a (number) formula field Outstanding_Data_c calculating the outstanding number of Data outstanding on the sale. The value of this field is constantly changin automatically when Data is delivered.
I have another custom object Sale_allocation_c and there is a number field SA_Outstanding_Data_c . I would like this field to be updated with the value of Outstanding_Data_c automatically. Not sure if it makes a difference but Sale_allocation_c is the child and Sale_c is the parent in the relationship.
Could anyone offer me some expertise and help me with the code? I would really appreciate it.
Many Thanks
I think you may be able to accomplish what you want by changing SA_Outstanding_Data_c to formula field. The formula will just be something like: Sale__r.Outstanding_Data__c
hi,
Thanks for the message. This can be done but I would need that field updating to be a text field and not a formula so, that I can use it in a roll-up summary on a different parent object.
I tried the formula, which works fine, and sending it to a text field by workflow and use that for my rollup summary field. But the workflow only updates the formula when it it created or edited, so it becomes out of sync after a while.
My other option would be APEx code trigger to trigger the workflow to update the text field everytime the formula field is updated.
Thanks