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
K_devK_dev 

execution of AfterUpdate caused Invalid field Ownerid for SObject Call_List__c

Developer script exception createopp : createopp: execution of AfterUpdate caused by: line 31, column 35: trigger body is invalid and failed recompilation: Invalid field Ownerid for SObject Call_List__c
 
Apex script unhandled trigger exception by user/organization: 005800000057Bpj/ 00D80000000PQ4F

createopp: execution of AfterUpdate

caused by: line 31, column 35: trigger body is invalid and failed recompilation: Invalid field Ownerid for SObject Call_List__c
 
can anyone please let me know ?
 
hitesh90hitesh90

can you please put your trigger code here?

souvik9086souvik9086

Check the field OwnerID for that object and it is better if you share your code to analyze it better.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

K_devK_dev

trigger createopp on Call_List__c (after update)
{
List<opportunity> opps=new List<opportunity>();
Set<String> callIds = new Set<String>();
for(Call_List__c ca:Trigger.New)
{
// after update
if(Trigger.IsUpdate && ca.Qualified_status__c!=Trigger.oldMap.get(ca.Id).Qualified_status__c && ca.Qualified_status__c=='converted'&&ca.Converted_to_Opportunity__c==false)
{
opportunity o=new Opportunity();

O.Name=ca.Account__c - ca.;
o.Accountid = ca.Account__c;
o.Product_Id__c=ca.Product__c;
o.StageName = 'Open';

o.CloseDate= Date.Today();
o.LeadSource = 'Abandon List';
o.Secondary_User__c = ca.Ownerid;
//QueueSobject que = [Select Id, Queue.Id From QueueSobject Where Queue.DeveloperName='calllist_queue' Limit 1];
o.Ownerid = ca.Sales_User__c;
o.Converted_to_Opportunity__c=true;
callIds.add(ca.Id);
opps.add(o);

system.debug('opportunity is '+o);

}
//update ca;
}
List<Call_List__c> callLists = new List<Call_List__c>();
for(Call_List__c call : [select Converted_to_Opportunity__c from Call_List__c where Id in :callIds])
{
call.Converted_to_Opportunity__c = true;
callLists.add(call);
}

if(callLists.size() > 0)
{
update callLists;
}

if(!opps.IsEmpty())
{
system.debug('********entered if');
try
{
insert opps;

}
catch(Exception e)
{
system.debug('******exception thrown'+e);
}
}
}

souvik9086souvik9086

There must be no field called OwnerId in teh object Call_List__c. Please check that.

Is this a detail object of Opportunity(Master-Detail)? Then the opportunity owner will be its owner. No field will be there called OwnerId.

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks