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
Ash Jones 10Ash Jones 10 

I need an Apex class with my trigger to avoid the 0% code coverage error

Hello All,
I have a very basic trigger in sandbox which i want to push it through the production. Without the test class i am getting the 0% code coverage error. Can someone please help me with this?
My Trigger: Order__c (Custom object), i want to update the OwnerId with the value in custome field Owner_Id__c.

trigger UpdateOwner on Orders__c (before insert) {
for (Orders__C a : Trigger.New) {
a.OwnerId = a.Owner_Id__c;
}
}

Thanks.
RKSalesforceRKSalesforce
HI Biren,

I order to achieve something without code we need to use configuration aspect of salesforce. In this case we don't require Test Classes. I hope inorder to achieve this requirement Workflow Field update and Process builder would work.

PLease mark as best answer if helped and Mark as best answer if helped for others help.

Regards,
Ramakant
Ash Jones 10Ash Jones 10
Hi Ramakant,
I can not change the OwnerId field with process builder or workflow rule. That is why i looked into trigger.