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
sreeja gangishettysreeja gangishetty 

Trigger to update the field when the record is fisrt created but not every time it is created.

When I convert the opportunity to the project, then the 'Project number' field starts with 'SRM4011000' format. If I convert a single opportunity into many other sub level projects then the 'Sub level project number' field starts with 'SRM4011001' format. and every time a new sub level project is created the 'Sub level project number' will be increased by 1.

Now I have a requirement, to update the field from project to opportunity when the project is created for the first time but not every time the project is created.
Can anyone please help me solve this?

Thanks in advance
Lokesh KumarLokesh Kumar
Write a trigger on Project event after insert and have the condition to check if the field has value. If Yes don't update the Opportunity.

I hope it will give you some direction to write the logic.