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
Hm_inviHm_invi 

how to modify the fields of a custom object field not directly related to opportunities?

I'm new to salesforce and coding. please suggest me what to do here!!!

I have three objects opportunities, projects and tasks.
relationship between them is,
Opportunity to projects--> lookup 
projects to tasks-->master-detail.

i need the status field on projects to populate 'complete' when an opportunity is closed won/lost. 
but i can't do this because the projects status field is a managed package formula field which cannot be edited.

The project status field formula is, if all its task records status fields are marked as complete then it will also be completed.

i dont see any relation directly from opportunity and tasks.

So now i need to make a trigger/process builder/workflow/lightning flow so when an opportunity is closed it will mark these tasks as complete which in turn marks the project as complete and make that unavailable to edit. 

How can i achieve this. I'm new to coding, so if it is a trigger how should the code be. 

Your help is really appreciated!!!!!!!
Ashish Singh SFDCAshish Singh SFDC
Hi KM_cj,

You can try creating a lightning flow that should invoke the Process once the Opportunity record is changed and stageName is closedWon/Lostt. You can use Get Record Element to Fetch all Project Records where Opportunity ID i.e. $record.Id. Then you may need to use Loop Element and try to store all the ProjectId in variables. After that, you need to again use Get Record Element and query all the Tasks where Project Id in Project Ids collected in previous step. Then using for loop over the Task Collected you should be able to set all tasks as close and finally use the Update Record Element to update these tasks in bulk

If you face any challenge with the flow then you need to follow the same logic in a trigger which should be invoked on After Insert and After Update for Opportunity Object.

Thanks,
Ashish Singh.
madonaa max 9madonaa max 9

Want to book a vacation to United States? Whether you're off for a romantic vacation, family trip, or an all-inclusive holiday, United States vacation packages on https://tinyurl.com/v8juumt8 Airlines Service</a> make planning your trip simple and affordable.

Read more: https://selfgrowth.com/articles/spirit-airlines-reservations-number-phone-24x7

https://selfgrowth.com/articles/spirit-airlines-customer-service-phone-number-open-24x7

https://www.airlines-help.us/