• Anthony Huerter
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 10
    Replies
I could use some urgent help on an issue we are having.  We have 1 trigger and 4 classes that read off of Chatter Answers.  In the summer '16 release SFDC made that no longer available to orginiations.  This trigger and classes are erroring out, and I cant disable them, I cant code them out, and I cant even delete them because I keep getting those errors. "Entity is not org-Accessible"

Can anyone help?
I have built a trigger and was at 77% code coveragae until I had to make a modifcation and add in that If statement on line 5.  Now my code coverage is at 7%.  What am I doing wrong?


Tigger – I continue this same core code from line 3 to 7 – 11 times just with a different Transaction Territory
trigger OpportuntiyTerritoryID on Opportunity (before update) 
{
    //Id territortyId = [select id from Territory where name ='dfdfd'];
    for(opportunity opp : trigger.new)
      if (opp.account != null)
        if (opp.Transaction_Territory__c == 'South East')
    {Opp.Territory2Id = '0MIE0000000KyyT';// Try to get this ID from Query for using for loop(like territortyId)
  


My Test Class – this repeats 7 times
public class OpportuntiyTerritoryIDTest     

    static testMethod void test ()
    {
    Account acc = new Account(Name = 'Test Account');
    insert acc;
    
     Opportunity opp = new Opportunity(Name='TEST opp', StageName='Closed Won', Probability = 100, CloseDate=system.today());     
       opp.Type ='New Sale';
       opp.accountid = acc.id;
       opp.Transaction_Territory__c = 'Great Lakes';
       opp.activationcode__c = '00001234561';
       insert opp;
       opp.Transaction_Territory__c = 'HI';
       opp.Source_Type__c = 'Carbonite';
       update opp;
  } 
 
I am trying to build my frist trigger and I am stuck on somthing I am sure is very simple.  I am trying to update the Territory field on the opportutniy when a text field is a certain value on the opportutniy.  This is the field I am trying to update.

User-added image

here is my code

trigger OpportuntiyTerritoryID on Opportunity (After insert, after update) {
    for(opportunity opp : trigger.new)
        if (opp.Transaction_Territory__c == 'South East')
    {Opp.Territory2Id = '0MI180000004DOG';}
        }
       

And I am getting this error when I go to update that 'Transaction Territory' Text field.

Error:Apex trigger OpportuntiyTerritoryID caused an unexpected exception, contact your administrator: OpportuntiyTerritoryID: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.OpportuntiyTerritoryID: line 4, column 1

Any help is greatly appreciated.
Has anyone else encountered this problem or know what this error means?  Salesforce support was stumped as well.  I have a process builder that reads a text field and is updating the Territory2ID field with an ID based on that text field.  All of this is on the Opportuntiy.   This process will run fine for 3-4 hours then it seems at 12:00 PM is bugs outs and shoots me this error below. 

An error occurred at element myRule_1_A1 (FlowRecordUpdate).
Error occurred attempting to get data type for : RawFieldImpl[tableName: Opportunity, columnName: Territory2Id__NotFound]
 
I am trying to get a visualforce page to appear when a custom field meets a certain criteria.  Here is what I have now and this works but I need to only appear if:  Custom field is > 20 


<apex:page >
             <style> .bPageBlock { background-color: green !important; } </style>
                         <apex:form > <apex:pageblock title="testing"> <div>This is a green partner. </div>
                                   </apex:pageblock>                  
                          </apex:form>
</apex:page

I would also like the background color to change to yellow if custom field is between 11 and 19 and change to red if the custom field is <10 

This is my first time making a Visualfroce page so I am a little lost.  I have tried mulpile formulas but nothing seems to work.  Any help would be appreciated. 

Thanks
I could use some urgent help on an issue we are having.  We have 1 trigger and 4 classes that read off of Chatter Answers.  In the summer '16 release SFDC made that no longer available to orginiations.  This trigger and classes are erroring out, and I cant disable them, I cant code them out, and I cant even delete them because I keep getting those errors. "Entity is not org-Accessible"

Can anyone help?
I have built a trigger and was at 77% code coveragae until I had to make a modifcation and add in that If statement on line 5.  Now my code coverage is at 7%.  What am I doing wrong?


Tigger – I continue this same core code from line 3 to 7 – 11 times just with a different Transaction Territory
trigger OpportuntiyTerritoryID on Opportunity (before update) 
{
    //Id territortyId = [select id from Territory where name ='dfdfd'];
    for(opportunity opp : trigger.new)
      if (opp.account != null)
        if (opp.Transaction_Territory__c == 'South East')
    {Opp.Territory2Id = '0MIE0000000KyyT';// Try to get this ID from Query for using for loop(like territortyId)
  


My Test Class – this repeats 7 times
public class OpportuntiyTerritoryIDTest     

    static testMethod void test ()
    {
    Account acc = new Account(Name = 'Test Account');
    insert acc;
    
     Opportunity opp = new Opportunity(Name='TEST opp', StageName='Closed Won', Probability = 100, CloseDate=system.today());     
       opp.Type ='New Sale';
       opp.accountid = acc.id;
       opp.Transaction_Territory__c = 'Great Lakes';
       opp.activationcode__c = '00001234561';
       insert opp;
       opp.Transaction_Territory__c = 'HI';
       opp.Source_Type__c = 'Carbonite';
       update opp;
  } 
 
I am trying to build my frist trigger and I am stuck on somthing I am sure is very simple.  I am trying to update the Territory field on the opportutniy when a text field is a certain value on the opportutniy.  This is the field I am trying to update.

User-added image

here is my code

trigger OpportuntiyTerritoryID on Opportunity (After insert, after update) {
    for(opportunity opp : trigger.new)
        if (opp.Transaction_Territory__c == 'South East')
    {Opp.Territory2Id = '0MI180000004DOG';}
        }
       

And I am getting this error when I go to update that 'Transaction Territory' Text field.

Error:Apex trigger OpportuntiyTerritoryID caused an unexpected exception, contact your administrator: OpportuntiyTerritoryID: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.OpportuntiyTerritoryID: line 4, column 1

Any help is greatly appreciated.
I am trying to get a visualforce page to appear when a custom field meets a certain criteria.  Here is what I have now and this works but I need to only appear if:  Custom field is > 20 


<apex:page >
             <style> .bPageBlock { background-color: green !important; } </style>
                         <apex:form > <apex:pageblock title="testing"> <div>This is a green partner. </div>
                                   </apex:pageblock>                  
                          </apex:form>
</apex:page

I would also like the background color to change to yellow if custom field is between 11 and 19 and change to red if the custom field is <10 

This is my first time making a Visualfroce page so I am a little lost.  I have tried mulpile formulas but nothing seems to work.  Any help would be appreciated. 

Thanks