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
sales4cesales4ce 

Cannot reference a Managed Package Object's field in the trigger

Hi,

 

we have a managed package installed in our organization.

The managed package has a field called status. I am writing a trigger on the managed package object to send email alert whenever the status is updated.

 

For some reason i am unable to reference the status variable in my trigger. 

 

ErrorError: Compile Error: Variable does not exist: echosign_dev1__Status__c at line 7 column 12

Can't i write a trigger on my Managed package Object?

if i can, can't i reference the variable?

 

Any help/idea on this is highly appreciated.

 

Trigger:


 

trigger sendEmail on echosign_dev1__SIGN_Agreement__c (after Update) {
    List<Id> agrmtId=New List<Id>();
    
    for(echosign_dev1__SIGN_Agreement__c agrmt:Trigger.New){
        
        if(echosign_dev1__Status__c=='Signed')
            agrmtId.add(agrmt.Id);   
    }
}

 

trigger sendEmail on echosign_dev1__SIGN_Agreement__c (after Update) {
    List<Id> agrmtId=New List<Id>();      

 for(echosign_dev1__SIGN_Agreement__c agrmt:Trigger.New){              

 if(echosign_dev1__Status__c=='Signed')            

agrmtId.add(agrmt.Id);     

 }
}

 

Thanks,

Sales4ce

Best Answer chosen by Admin (Salesforce Developers) 
rungerrunger

Change

if(echosign_dev1__Status__c=='Signed') 

to

if(agrmt.echosign_dev1__Status__c=='Signed') 

All Answers

mikefmikef

yes you can write a trigger or any Apex code using managed package references.

 

Looks like you have the package namespace right just make sure the API name of Status is really Status__c and not something else.

rungerrunger

Change

if(echosign_dev1__Status__c=='Signed') 

to

if(agrmt.echosign_dev1__Status__c=='Signed') 

This was selected as the best answer