• SalesForce Dummy
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 14
    Replies
Im trying to create a new work item with agile accelarator and I'm getting this error:

Apex trigger agf.ADM_WorkCRUDCheck caused an unexpected exception, contact your administrator: agf.ADM_WorkCRUDCheck: execution of BeforeInsert caused by: agf.ADM_ApplicationException: User has insufficient access to ADM_Work__c: (agf)

I'm getting this error as the Admin. I and everyone on the team that I'm selecting has full access to the Work object and it's related objects as well as all VF pages and classes for AA.

Please advice. Thanks.

OK I'm pulling my hair out. I'm trying to access a field from the account object after a contact is inserted. Here's the generic code:

 

trigger contactTest on Contact(after Insert)
{
 //Create list and set
 List<Contact> listContact = new List<Contact>();
 Set<Id> setContact = new Set<Id>();

 //Loop through trigger items
 For(Contact loopContact : Trigger.new)
 {
  //Create new contact for updating
  Contact newContact = new Contact(Id = loopContact.Id);

  //Get field from Account
  newContact.FieldFromAccount = loopContact.Account.FieldFromAccount;
  
  //Make sure distinct list of contacts
  if(!(setContact.contains(loopContact.Id))
  {
   listContact.add(newContact);
   setContact.add(newContact.Id);
  }
 }

 //Update list of Contacts
 update listContact;
}

 

The field comes up as null even though it's populated. It's a checkbox. What am I doing wrong?

This may be a simple yes or no question. I'm trying to update a field based on a string. Example.

 

//Create contact to update and set string to the email field.

Contact TestContact = new Contact(Id = '003121212121212');

string conField = 'Email';

 

//Update contact email field.

testContact.conField = 'test@email.com';

update testContact;

 

What I'm trying to do is access a field name for an object based on a string. Is this possible at all in APEX?

 

OK. I've been doing this for years and suddenly I'm getting an error("expecting right curly bracket, found 'For'"). Here's the class. Can anyone tell me why I'd be getting this error for my FOR statement?

publicwithsharingclass Monthly
{
     public List<Id> lstBudId = new List<Id>();
     publicSet<Id> setBudId = newSet<Id>();

     //Get list of budget periods that are older than today
     public List<Budget_Period__c> lstCBP = new List<Budget_Period__c>
          ([SELECT ID, BUDGET__C
          FROMBudget_Period__c
          WHERE PERIOD_END_DATE__C >= TODAY]);
 

     For(Budget_Period__c cbp : lstCBP)
     {
         
if(!setBudID.contains(cbp.Budget__c))
          {
               setBudId.add(cbp.Budget__c);
               lstBudID.add(cbp.Budget__c);
          }
     }
}

'm trying to hide a command buttong if a user is not a System Administrator but I'm getting a syntax error. The command button worked until I put in the rendered atrribute. Can anyone find the syntax error?


 

<
apex:commandButton
value="View Expanded"
action="{!toggleForecastExpanded}"
rendered="{!IF({!$User.ProfileId}== '00eU0000000qqCOIAY', false, true)}"
/>

Thanks for your help.

Is it possible to share logic between test classes. The example I have is creating a test class for a trigger on a task. I have to first create an account and then a contact and finally a task. Is there some way to place creation of the account and contact in a separate class and call the class whenever I need to create them? I thought that this was made possible in the last release but I can't find it anywhere.

I'm attempting to create a scheduled job programatically using system.schedule but I'm running into issues. I'm trying to pass the parameters "Schedule Name",  "Schedule Time" and "Class Name" from strings from an object in SFDC. The problem is I don't know exactly how to change a string into an object. 

This is what I have so far:
 
 //Iterate through list of job descriptions
 For(Manage_ScheduleJobs__c addJobs : schJobs)
 {
 //Get class name and job name
 string ClassName = addJobs.Class_Name__c;
 string jobName = addJobs.Job_Name__c;
 
 //Attempt to change string to class
 object classDev = ClassName;

//Get the id of the new scheduled job
Id jobId = System.schedule(jobName, '0 0 0 * * ?', new classDev());
}
What am I doing wrong?
Thanks.

 

I've created a map but am having a hard time figuring out how to pull data from it. Here's the map: Map m = new Map([SELECT ID, (SELECT ID FROM Contacts) FROM Account LIMIT 5]); How do I get to the fields from the Contact table?

This may be a simple yes or no question. I'm trying to update a field based on a string. Example.

 

//Create contact to update and set string to the email field.

Contact TestContact = new Contact(Id = '003121212121212');

string conField = 'Email';

 

//Update contact email field.

testContact.conField = 'test@email.com';

update testContact;

 

What I'm trying to do is access a field name for an object based on a string. Is this possible at all in APEX?

 

Im trying to create a new work item with agile accelarator and I'm getting this error:

Apex trigger agf.ADM_WorkCRUDCheck caused an unexpected exception, contact your administrator: agf.ADM_WorkCRUDCheck: execution of BeforeInsert caused by: agf.ADM_ApplicationException: User has insufficient access to ADM_Work__c: (agf)

I'm getting this error as the Admin. I and everyone on the team that I'm selecting has full access to the Work object and it's related objects as well as all VF pages and classes for AA.

Please advice. Thanks.

Hi All,

 

I have the query [Select Id from Email Template where IsActive =true LIMIT 1]. This query is retreving the deleted record and causing problem.Email Template object do not have 'IsDeleted' field to check for the deleted records.

 

 

Please suggest how I can prevent query from retreiving deleted record.

 

Thanks,

Srilakshmi 

OK I'm pulling my hair out. I'm trying to access a field from the account object after a contact is inserted. Here's the generic code:

 

trigger contactTest on Contact(after Insert)
{
 //Create list and set
 List<Contact> listContact = new List<Contact>();
 Set<Id> setContact = new Set<Id>();

 //Loop through trigger items
 For(Contact loopContact : Trigger.new)
 {
  //Create new contact for updating
  Contact newContact = new Contact(Id = loopContact.Id);

  //Get field from Account
  newContact.FieldFromAccount = loopContact.Account.FieldFromAccount;
  
  //Make sure distinct list of contacts
  if(!(setContact.contains(loopContact.Id))
  {
   listContact.add(newContact);
   setContact.add(newContact.Id);
  }
 }

 //Update list of Contacts
 update listContact;
}

 

The field comes up as null even though it's populated. It's a checkbox. What am I doing wrong?

This may be a simple yes or no question. I'm trying to update a field based on a string. Example.

 

//Create contact to update and set string to the email field.

Contact TestContact = new Contact(Id = '003121212121212');

string conField = 'Email';

 

//Update contact email field.

testContact.conField = 'test@email.com';

update testContact;

 

What I'm trying to do is access a field name for an object based on a string. Is this possible at all in APEX?

 

I am very new to Apex so please forgive me if this is a stupid question. 

I have 2 custom salesforce objects.  s1 and s2.  s2 has a field that is unique to both it and s1.  It is called identifier.  I am creating a trigger that will update the fields on s2 when s1 is updated.  What I cannot figure out how to do is inside the trigger apex to find the id of s2 based on the identifier field of s1. 

Thanks

OK. I've been doing this for years and suddenly I'm getting an error("expecting right curly bracket, found 'For'"). Here's the class. Can anyone tell me why I'd be getting this error for my FOR statement?

publicwithsharingclass Monthly
{
     public List<Id> lstBudId = new List<Id>();
     publicSet<Id> setBudId = newSet<Id>();

     //Get list of budget periods that are older than today
     public List<Budget_Period__c> lstCBP = new List<Budget_Period__c>
          ([SELECT ID, BUDGET__C
          FROMBudget_Period__c
          WHERE PERIOD_END_DATE__C >= TODAY]);
 

     For(Budget_Period__c cbp : lstCBP)
     {
         
if(!setBudID.contains(cbp.Budget__c))
          {
               setBudId.add(cbp.Budget__c);
               lstBudID.add(cbp.Budget__c);
          }
     }
}

Is it possible to share logic between test classes. The example I have is creating a test class for a trigger on a task. I have to first create an account and then a contact and finally a task. Is there some way to place creation of the account and contact in a separate class and call the class whenever I need to create them? I thought that this was made possible in the last release but I can't find it anywhere.

I'm attempting to create a scheduled job programatically using system.schedule but I'm running into issues. I'm trying to pass the parameters "Schedule Name",  "Schedule Time" and "Class Name" from strings from an object in SFDC. The problem is I don't know exactly how to change a string into an object. 

This is what I have so far:
 
 //Iterate through list of job descriptions
 For(Manage_ScheduleJobs__c addJobs : schJobs)
 {
 //Get class name and job name
 string ClassName = addJobs.Class_Name__c;
 string jobName = addJobs.Job_Name__c;
 
 //Attempt to change string to class
 object classDev = ClassName;

//Get the id of the new scheduled job
Id jobId = System.schedule(jobName, '0 0 0 * * ?', new classDev());
}
What am I doing wrong?
Thanks.

 

Is there any way to change or delete a Scheduled Job ?  I am able to create one easily enough, but once it is made I can only look at the values in the CronTrigger object, but not update them.  Also, it seems I cannot delete them.  I also looked at the System.AbortJob method, but that seems to only stop a job that is already running - I get an error if I try it on a Queued job.

 

The reason I am doing this is to try to create a 'sliding' job.  So, when a trigger is fired the job will run in 5 minutes.  But if the trigger is fired again before that 5 minutes is up, it will find the old job and either delete it and make a new one for 5 minutes out, or update the old one so the next scheduled time is in 5 minutes.

 

Any ideas are welcome!

 

Jason