• kirkevonphilly
  • NEWBIE
  • 155 Points
  • Member since 2012

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 41
    Replies

Hi

I have a object "proposal" with 2 lookup fields (not master relationship) : one for product and one for insurrance

What would be the syntax in "proposal" email template to call field from product / insurrance

 

I have tried many syntax but still empty : exemple for company field

{!Proposal__c.Company__c.Description__c}

{!Proposal__c.Company__r.Description__c}

{!Company__c.Description__c}

 

{!Proposal__c.Product__c.Description__c}

 

{!Proposal__c.Product__r.Description__c}

 

{!Product__c.Description__c}

 

Moreover is is possible to write in email template something like :

if (!Proposal__c.Type="xxx")

{

  • ezazeza
  • eazeaz
  • eeezaez

}

else

{

  • lml
  • lmlm
  • lmlm

}

Thanks for your help since I could not any document on this

NB : If I have thought about visualforce email but it seems that you can only add 1 related Object and I need 2

Regards

Hello everyone,

 

I created a batch class that has a list of some records of a custom object. And I want to send this list in an e-mail.

 

I tried using Workflow rules, but, it sends one e-mail for each record. What I want is to send one single e-mail with all records and its data fields, just like a table.

 

Here's the batch class

 

 

global class ticketClassBatch implements Database.Batchable<Ticket__c>, Database.AllowsCallouts {
Ticket__c[] Query; public ticketclassBatch(){ Query = [SELECT name, id, FROM ticket__c WHERE ticket__c.paid__c =: FALSE]; Return; } global iterable<Ticket__c> start(database.batchablecontext BC){ System.Debug('Records changed: ' + String.valueof(Query.size())); return(Query); } global void execute(Database.BatchableContext BC, List<Ticket__c> tickets){ for(ticket__C inf : tickets){ inf.alert__c = TRUE; } Update ticket; } global void finish(Database.BatchableContext BC){ } }

 

I want to send all records from this list  "Tickets" in the e-mail with it's name, and others fields.

 

Anyone knows how?

 

Thanks! 

 

Felipe Dias.

 

Dobby has no master. Dobby is a free elf.



I did some work in a sandbox before I activated it, and when I did go to activate it- received a warning that I would lose anything that was already in it.

So I went into the sandbox and used the download option to download the triggers I had created.  But now I can't figure out how to upload them back!

They are saved as .tgr and .cls files

Thanks, Amanda

 

I wanted to build a simple trigger on the Event that would make a checkbox true if the What field looked up to one of our custom objects, and false otherwise. But with my attempt at this, it keeps making the checkbox true regardless of what is related to the event and I don't understand why. Here's the code:

 

trigger WorkOrderCheckbox on Event (before insert, before update) {
 for(Event newEvent : trigger.new) {
  if(newEvent.What instanceof SVMXC__Service_Order__c) {
   newEvent.Work_Order__c = true;
  } else {
   newEvent.Work_Order__c = false;
  }
 }
}

What am I doing wrong here?

Is there a  way to find how many Fridays's there are between startdate and enddate? 

I have an issue with the email template. I wanted to put the record name(Auto number field) in to the tepmlate. This is an email triggering on task. SO I'm able to get the task fields but wanted to get the name of the record on which the task is creating.

 

 

Essentially im looking for an output in this fashion:      

Task Name = ARQ 000001   Hello Lucifer  a subject Pre-Meeting1 with Priority Not Started and duedate 2012-11-27 00:00:00 is been created.Please click here to open task

 

 

mail.setHTMLBody    ('Task Name = ' +tsk.related.Annual_Request__r.Name +'Hello  ' +theUser.Name+' '+ 'a subject '+tsk.Subject+' '+'with Priority '+tsk.status +' '+ 'and duedate ' + tsk.Activitydate +' '+'is been created.'+'<a href="https://cs3.salesforce.com/'+tsk.Id+'">Please click here to open task<a/>');

 

 

Please help me with this..

Hi all,

 

I have a scenario where I need to create test coverage for some code that deals with Archived Activities (Events and Tasks with  isArchived =  TRUE).


1)  Aside from setting SeeAllData = TRUE, is there any way to create a few Archived records?

 

2)  I tried updating my Activities per the criteria here: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_guidelines_archive.htm, but it doesn't set isArchived to true for me.  I'm assuming this is some sort of nightly job?  If so, is there a system method that I can use to trigger this?  On the flip side, in a non-testing environment, if I update an Event or Task to violate the Archive criteria, isArchived is instantly updated to false.

 

Thanks in advance!

 

 

Hi all,

I have two topics that I want to subscribe to in my JS, but am having difficulty in doing so.  Any suggestions?

 

Topics:

topic/topic1

topic/topic2

 

How would I add topic2 as an additional subscripiton?

 

$.cometd.subscribe('topic/topic1', function(message) {
    reRender_Tables();
});

 

Can someone suggest a way to retrive the object type of a current record using JS or jQuery only?

Hi all,

 

On the Task object, you can suggest Subjects (Setup --> Customize --> Activities --> Task Fields --> Subject --> Task Subject Picklist Values)

 

Is there a limit to the number of options or total text in these options, similar to a picklist field?

 

I know on a picklist field, you can have as many options as you want, as long as the total character count for all options doesn't exceed a certain number (255?).  Is the same true for the Task Subject field?

 

Thanks!

I'm working on creating a Managed Package that will be installed into our client's customers' orgs. In that package are classes that perform callouts back to our client's org. Do you have any recommendations on how to secure this web-service based communication between our client and our client's customers' orgs? 

 

Thanks in advance!

This code isn't quite right, but I don't know how should I put it in this. The program should not make anything if those values (marked red) are null.

 

trigger CaseServiceAvailabilityTrigger on Case (after insert) {
    if (Trigger.isInsert) {
        for (Case updatedCase:System.Trigger.new) {
            System.Debug('CaseServiceAvailabilityTrigger : NEW CASE: ' + updatedCase.Id);
            
            // TODO: What to do if there is no old Case?
            Case oldCase = new Case();
            if (System.Trigger.oldMap != null) {
                oldCase = System.Trigger.oldMap.get(updatedCase.Id);
            } else {
                oldCase = updatedCase;
            }   

            // TODO: What happens if the case doesn't have a Setup?
            if(oldCase.Related_Setup__c == null && updatedCase.Related_Setup__c == null ) {

            System.Debug('CaseServiceAvailabilityTrigger: NO Setup defined for Case: ' + updatedCase.Id);

           
            // Add SA object to Case            
            ServiceAvailability saHelper = new ServiceAvailability();                        
            RecordType recordTypeI = [select Id, Name from RecordType where SObjectType = 'Service_Availability__c' and Name = 'Incident' LIMIT 1];
            saHelper.InsertServiceAvailabilityObjectToCase(updatedCase, System.now(), recordTypeI, true);             
            
            // Add SA object also to related Setup
            if (updatedCase.Related_Setup__c != null) {
                Setup__c relatedSetup = [select Id, Cost_Center__c, Name, Service_Availability__c from Setup__c where Id =: updatedCase.Related_Setup__c];
                if (relatedSetup != null) {                 
                    // Check if there are any previous SAs for corresponding Setup            
                    List<Service_Availability__c> oldSAs = [select Name, Status__c, Status_explanation__c, Duration__c, Start_DateTime__c from Service_Availability__c
                                                            where Setup__c =: updatedCase.Related_Setup__c                                                    
                                                            order by Name desc];
                    
                    if (oldSAs.Size() == 0) {
                        RecordType recordTypeS = [select Id, Name from RecordType where SObjectType = 'Service_Availability__c' and Name = 'Setup' ];                
                        saHelper.InsertServiceAvailabilityObjectToSetup(updatedCase, System.Now(), recordTypeS, updatedCase.Fault_Classification__c);
                    } else {
                        // Process the SA as if the Fault Classification was changed (manually)
                       saHelper.ProcessCaseServiceAvailabilityUpdate(updatedCase, oldCase, true);
                    }                                                    
                } else {
                    System.Debug('CaseServiceAvailabilityTrigger: NO Setup defined for Case: ' + updatedCase.Id);
                }
            }                                                        
        }
    }
}

 

           

  • September 05, 2013
  • Like
  • 0

HI

i wriiten one schedular class am getting this error after some days

its worked for me some days

but after its showing this error

 

System.DmlException: Update failed. First exception on row 0 with id 00T9000000Qj3DlEAJ; first error: ENTITY_IS_DELETED, entity is deleted: []

 

this is my class.

 

// **** schedular class for task escaltion

global with sharing class Task_Escalation implements Schedulable {

public List<Client_Requirement__c> clientreq=new list<Client_Requirement__c>();
public List<Client_Requirement__c> clientreq1=new list<Client_Requirement__c>();
public List<Client_Requirement__c> clientreq2=new list<Client_Requirement__c>();
public list<task> listtask=new List<task>();
public list<task> listtask2=new List<task>();
public list<task> listtask3=new List<task>();
public list<task> listtask4=new List<task>();
public set<id> listtask1=new set<id>();
public set<id> CRID=new set<id>();
public set<id> sysid=new set<id>();

global void execute(SchedulableContext SC) {

try{
//--------------------------------------------------------------------------------
// list of all client requirements
clientreq=[select id,name,RecordTypeid,Ownerid  from Client_Requirement__c];
system.debug('List of client requirement'+clientreq);
for(Client_Requirement__c cr: clientreq)
{
CRID.add(cr.id);// fetching the list of all client req IDS
}
// query for fetching the tasks that are not closed with in 3 days

listtask=[Select t.CreatedDate, t.Id, t.LastModifiedById, t.LastModifiedDate, t.OwnerId, t.Priority,
t.Status, t.Subject, t.WhatId, t.WhoId from Task t where Whatid=:CRID and Status='Not Started'  and Created_date__c=today and ActivityDate=null];
system.debug('List of tasks that are not closed with in 3 days '+listtask);
if(listtask.size()>0)
{
for(task t: listtask)
{
if(t.OwnerId=='00590000001qNM7' || t.OwnerId=='00590000001qNMq' || t.OwnerId=='00590000001qNMM' || t.OwnerId=='00590000001qNKQ' || t.OwnerId=='00590000001qNKu' || t.OwnerId=='00590000001qNMR' || t.OwnerId=='00590000001qNL6')
{
t.OwnerId='00590000001qNKB';// Assigning the crm owner to the all the tasks
listtask2.add(t);
}
}
update listtask2; //updating the tasks
system.debug('List of tasks that are updated to user crm head '+listtask2);
}

//-----------------------------------------------------

clientreq2=[select id,name,RecordTypeid,Ownerid  from Client_Requirement__c];
system.debug('List of client requirement'+clientreq2);
for(Client_Requirement__c cr: clientreq2)
{
sysid.add(cr.id);// fetching the list of all client req IDS and ownerid='00590000001qNKB'
}
system.debug('list of idssss for system admin'+sysid);

// query for fetching the task that crm head user not completed the tasks
listtask3=[Select t.CreatedDate, t.Id, t.LastModifiedById, t.LastModifiedDate, t.OwnerId, t.Priority,
t.Status, t.Subject, t.WhatId, t.WhoId from Task t where whatid=:sysid and Status='Not Started' and Created_date_after_6_days__c=today and ActivityDate=null];

system.debug('List of tasks that are not closed after 2 days '+listtask3);

if(listtask3.size()>0)
{
for(task t: listtask3)
{
if(t.OwnerId=='00590000001qNKB')
{
t.OwnerId='00590000001WzWy';// Assigning the system admin to the tasks that crm head user not completed
listtask4.add(t);
}
}
update listtask4;  // updating the tasks.
system.debug('List of tasks that are updated to user sysadmin head '+listtask4);
}
}catch(Exception e){system.debug('@@@@@@@@@@@@@@'+e);}
}
}

 

Regards

venkatesh

Hi,

 

I have developed functionality where I am generating a msword document through visual force code using contenttype attribute of <apex:page> tag. 

 

The word document is generated properly, however the formating of html and images are not shown properly, only the text is displayed.

 

Please let me know how can i make generated document to display correct html formatting and images.

 

thanks,

Amit.

Hi,

 

I need to send Remainder mails to users based on specific period of time using apex ccode.Could you please help me on this. As i am new to this sales force idont have idea.

 

Please share sample code or links which will be useful to complete my Task.

 

 

Regards

Lakshmi Prasanna.

Hi

I have a object "proposal" with 2 lookup fields (not master relationship) : one for product and one for insurrance

What would be the syntax in "proposal" email template to call field from product / insurrance

 

I have tried many syntax but still empty : exemple for company field

{!Proposal__c.Company__c.Description__c}

{!Proposal__c.Company__r.Description__c}

{!Company__c.Description__c}

 

{!Proposal__c.Product__c.Description__c}

 

{!Proposal__c.Product__r.Description__c}

 

{!Product__c.Description__c}

 

Moreover is is possible to write in email template something like :

if (!Proposal__c.Type="xxx")

{

  • ezazeza
  • eazeaz
  • eeezaez

}

else

{

  • lml
  • lmlm
  • lmlm

}

Thanks for your help since I could not any document on this

NB : If I have thought about visualforce email but it seems that you can only add 1 related Object and I need 2

Regards

Hi , 

 

I have a requirement where in i need to reschedule already scheduled apex classes. I have used System.Schedule method to achieve the same. Since System.Schedule only works with the class names(Need to give classname as a third parameter) and since that would become static , i tried using "Reflection concept of java" so that i can pass the instance of an object as a parameter and thus make it work for more than one class. (I have more than once class to schedule in my organisation). 

 

I get an error which states "Attempt to de-reference a null object"

 

The following is my Controller code. 

 

global with sharing class GetAllApexClasses {
    public PageReference shedulerClicked() {
        return null;
    }
public void scheduleClicked () {
        return ;
    }
    public String asyncapexjob { get; set; }
    public string className { get; set; }
    public String schedule  { get; set; }  
    public List<AsyncApexJob> apexclassList{get; set;}
    public List<ApexClass> classList{get;set;}
    public List<CronTrigger> CronList{get;set;}
    
    public GetAllApexClasses(){    
    apexclassList = new List<AsyncApexJob>();
    apexclassList = [SELECT ApexClassID, CompletedDate,Status,CreatedDate,TotalJobItems,CreatedBy.Name from AsyncApexJob ]; 
}

  public void sheduleClicked () 
  {
    {
             System.debug('Class Name : ' +className);
        Type t = Type.forName(className); 
        String sch = '0 10 * * * ?';
Id m=system.schedule('one', sch,(Schedulable)t.newInstance());

}
}
}

 The following is my Visual force page

 

<apex:page controller="GetAllApexClasses">
<apex:form >
 <apex:pageBlock >
  <apex:pageBlockTable value="{!apexclassList}" var="apexclass">
   <apex:column headerValue="Class Name" >
   <apex:outputField value="{!apexclass.ApexClassID}"/>
   </apex:column>
   <apex:column headerValue="Completed Date" >
   <apex:outputField value="{!apexclass.CompletedDate}"/>
   </apex:column>
   <apex:column headerValue="Status" >
   <apex:outputField value="{!apexclass.Status}"/>
   </apex:column>
   <apex:column headerValue="Created By" >
   <apex:OutputField value="{!apexclass.CreatedBy.Name}"/>
   </apex:column>
   <apex:column headerValue="CreatedDate" >
   <apex:outputField value="{!apexclass.CreatedDate }"/>
   </apex:column>
   <apex:column headerValue="TotalJobItems">
   <apex:outputField value="{!apexclass.TotalJobItems}"/>
   </apex:column>
   <apex:column headerValue="Schedule ">
   
   <apex:commandButton id="cb1" action="{!sheduleClicked}" value="schedule" rerender="hiddenBlock"> 
       <apex:param name="className" value="{!apexclass.ApexClassID}" assignTo="{!className}"/>
   </apex:commandButton>
   
   </apex:column>
     </apex:pageBlockTable>

</apex:pageBlock>
 <apex:pageBlock id="hiddenBlock" rendered="false"></apex:pageBlock>
</apex:form>
</apex:page>

 

 I am not able to reschedule my class and get the following error when i click on Schedule Command button

 

System.NullPointerException: Attempt to de-reference a null object

Error is in expression '{!sheduleClicked}' in page getapexclasses

 

Class.GetAllApexClasses.sheduleClicked: line 88, column 1

Pls help me as it is urgent. Any help would be greatly appreciated.

Thanks in advance

I'm trying to deploy a package from one sandbox to another and get a failure message:

 

Cannot deploy InstalledPackage in Package Manifest with any other types!

 

I'm using Eclipse version Helios Service Release 1 along with the Spring 2013 version of Force.com IDE.

 

Any clue what's going on?

 

Thanks.

 

I am getting an error saying "Variable myAccount does not exist". Thanks for any help

 

 

trigger trig_BatchLoadDaily on Account (before insert)
{

for(Account myAccount : trigger.new)
{
   
    //Person    
    if (myAccount.payout__Tax_Id_Type__c == 'S')
    {
        myAccount.FirstName                     = myAccount.Payout__Client_First_Name__c;
        myAccount.LastName                      = myAccount.payout__Client_Last_Name__c;

        //Update Person Account fields    
        myAccount.PersonMailingCity             = myAccount.BillingCity;
        myAccount.PersonMailingStateProv        = myAccount.BillingState;
        myAccount.PersonMailingStreet           = myAccount.BillingStreet;
        myAccount.PersonMailingZip              = myAccount.BillingPostalCode;
    }    
 
}
Update myAccount;    
    
}

Hi. I have a trigger that triggers for more records than I hope for

 

trigger createOrderforABFSCB on Stem_Cell_Bank__c (after update) {

    List<ChargentOrders__ChargentOrder__c> co = new List<ChargentOrders__ChargentOrder__c>();  
   
  for (Stem_Cell_Bank__c scb : Trigger.new) {

    if (scb.Stage__c == 'Stem Cells Banked') { /*scb to oscb*/
      
      //initiate the object to put values for furture record
      ChargentOrders__ChargentOrder__c c = new ChargentOrders__ChargentOrder__c();

      //map Order fields to SCB that is being created for this Order
      c.Stem_Cell_Bank__c = scb.Id; /*scb to oscb*/

          c.ChargentOrders__Date__c = date.today();
          c.Order_Item__c = 'Yearly Stem Cell Banking Fee';
      
      if(scb.Stem_Cells_Banked_Date__c!=null)
        c.ChargentOrders__Payment_Start_Date__c = scb.Stem_Cells_Banked_Date__c.addYears(1);
      else
        scb.addError('Cannot have empty stem cell bank date before stage is set to stem cell banked');
          
      //add this new object to the list that would be inserted later
      co.add(c);
    } //end if
  } //end for scb
  
  //once the loop is done, insert the new record to Order
  try{
    insert co;
  } catch (system.Dmlexception e) {
    system.debug(e);
  }

}

This seems to add a new record for all records with stage__c = 'Stem Cells Banked'

 

I need to add a new ChargentOrder record for existing Stem_Cell_Bank__c record only to the respective ID when Stage__c is updated to 'Stem Cells Banked'

 

I tried researching more about using oldMap and played around with the logic:

 

Stem_Cell_Bank__c oscb = Trigger.oldMap.get(scb.ID);

 

But having a hard time getting it work. Plus if I could add a checksum logic to only allow 2 ChargentOrder records to 1 Stem_Cell_Bank record it will help even more to not encounter these type of errors in the future

 

Any suggestions would be greatly appreciated

 

Thank you in advance

 

Daniel

Hi all,

 

I have a scenario where I need to create test coverage for some code that deals with Archived Activities (Events and Tasks with  isArchived =  TRUE).


1)  Aside from setting SeeAllData = TRUE, is there any way to create a few Archived records?

 

2)  I tried updating my Activities per the criteria here: http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_guidelines_archive.htm, but it doesn't set isArchived to true for me.  I'm assuming this is some sort of nightly job?  If so, is there a system method that I can use to trigger this?  On the flip side, in a non-testing environment, if I update an Event or Task to violate the Archive criteria, isArchived is instantly updated to false.

 

Thanks in advance!

 

 

Error Message System.NullPointerException: Attempt to de-reference a null object   

 

"h" is holiday object (standard one)

 

error in this line - Class

b = h.ActivityDate.daysBetween(h.RecurrenceStartDate);

I have been trying to get the list of ivitees on an event.

 

I wanted to create this trigger on the EventRelation which is not possible,

 

I heard you can you use thw who Id, but I get a null when I use that Id.  any ideas??

 

Right now I am just outputing that data

public static void UpdateEventAgencyClientAttendees(List<Event> newValues){

Integer i = 0;

for (Event t : newValues){
i = i + 1;
system.debug('#### whoId and whatId: ' + t.WhatId + ':' + t.WhoId + ':' + i);
}
}

 

Hello everyone,

 

I created a batch class that has a list of some records of a custom object. And I want to send this list in an e-mail.

 

I tried using Workflow rules, but, it sends one e-mail for each record. What I want is to send one single e-mail with all records and its data fields, just like a table.

 

Here's the batch class

 

 

global class ticketClassBatch implements Database.Batchable<Ticket__c>, Database.AllowsCallouts {
Ticket__c[] Query; public ticketclassBatch(){ Query = [SELECT name, id, FROM ticket__c WHERE ticket__c.paid__c =: FALSE]; Return; } global iterable<Ticket__c> start(database.batchablecontext BC){ System.Debug('Records changed: ' + String.valueof(Query.size())); return(Query); } global void execute(Database.BatchableContext BC, List<Ticket__c> tickets){ for(ticket__C inf : tickets){ inf.alert__c = TRUE; } Update ticket; } global void finish(Database.BatchableContext BC){ } }

 

I want to send all records from this list  "Tickets" in the e-mail with it's name, and others fields.

 

Anyone knows how?

 

Thanks! 

 

Felipe Dias.

 

Dobby has no master. Dobby is a free elf.



I did some work in a sandbox before I activated it, and when I did go to activate it- received a warning that I would lose anything that was already in it.

So I went into the sandbox and used the download option to download the triggers I had created.  But now I can't figure out how to upload them back!

They are saved as .tgr and .cls files

Thanks, Amanda

 

Hi All,

 

When accessing rest API "https://login.salesforce.com/services/oauth2/token" with all the required parameters the response header is having 2 date parameters, which is making my middleware to throw an error. 

Is there anything salesforce can do to rectify this problem. I am trying to make my middleware to ignore the duplicate date header but with no success.

 

Any help guys!!!

 

regards

Krishna

Hi all,

 

I was wondering if anyone else has accompolished this task? We are working with Email-To-Case using SFDC agent. What we like to do is to setup multiple email aliases, from which the emails get forwarded to a mailbox where the  case can get created. The reason for this setting is to avoid having to create 10s of different mailboxes. We like to extract the alias from the email header and add it to a custom field against the case (to setup further assignment rules based on the alias).

 

The question is:

 

Does anybody know if the email alias is going to be available in the email header?

 

thanks in advance

Can someone suggest a way to retrive the object type of a current record using JS or jQuery only?