You need to sign in to do that
Don't have an account?
Matt Cooper 7
Apex Trigger To Update Owner On Master Record Based On Picklist Value On Detail Record
Hi,
I have a scenario where I am trying to create an Apex Trigger that updates the Owner on a master record based on the selection made on a picklist in a detail record.
My master object is:
Label: Agreement
Object Name: APTS_Agreement
API Name: Apttus__APTS_Agreement__c
My detail object is:
Label: Bank Account Details
Object Name: Bank_Account_Details
API Name: Bank_Account_Details__c
The picklist field is located on the Bank Account Details object and has a list of users in the system:
Field Label: TL Approver
API Name: TL_approver__c
Basically, one user will be coming in and creating an Agreement record. They will then create a Bank Account Opening detail record off that Agreement record that will have the TL Approver field on it. Whoever they select from the TL Approver field should then become the Owner of the Agreement record.
Can anyone help me out with this?
Thanks!
I have a scenario where I am trying to create an Apex Trigger that updates the Owner on a master record based on the selection made on a picklist in a detail record.
My master object is:
Label: Agreement
Object Name: APTS_Agreement
API Name: Apttus__APTS_Agreement__c
My detail object is:
Label: Bank Account Details
Object Name: Bank_Account_Details
API Name: Bank_Account_Details__c
The picklist field is located on the Bank Account Details object and has a list of users in the system:
Field Label: TL Approver
API Name: TL_approver__c
Basically, one user will be coming in and creating an Agreement record. They will then create a Bank Account Opening detail record off that Agreement record that will have the TL Approver field on it. Whoever they select from the TL Approver field should then become the Owner of the Agreement record.
Can anyone help me out with this?
Thanks!
All Answers
1. Number_of_projects__c which just counts the number of projects linked to the Sale
2. Number_of_completed_projects__c which counts the number of projects with status 'Completed'
Note that this will only work if the relationship is Master-Detail. If it isn't, you will have to either change it to Master-Detail or revert to an APEX trigger.
Then, based on the contents of the 2 roll-up fields, you can create a workflow rule on Sale that checks the current Sale status and substatus. If those are allright, then check if the 2 roll-up fields are equal (and you might want to check that they are >0 as well). If all of those prerequiresites are OK, then update the Sale status and substatus.
This answer doesn't seem related to my question. Were you trying to answer someone else's question?
Trigger.BAO_TL_Approver: line 13, column 1"
Can someone give me some guidance?
Thanks!