• Tracey
  • NEWBIE
  • 0 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 47
    Questions
  • 42
    Replies

 

 

I have created a Visualforce Email template. I would like to format the date and checkbox in the Visualforce page.

Could somebody please advice me on how todo this? I prefer not create a custom formulae to resolve this problem

 

Dear Joe Smith

Contragulations on closing and winning this Opportunity: Opptest.

The contract deails are as follows

Account name:

test1

Legal name:

 

Date signed:

Wed Dec 09 00:00:00 GMT 2009

Date service begins:

Wed Dec 16 00:00:00 GMT 2009

SKU's

 
 

Coupons - []

 

Consulting - [SKU-CS-CON-CON-001]

 

DREAM - []

Lead Source:

DCLK Inside Sales

Customer Segment:

Marketer

Referral:

false

Salesperson:

Stephen Moore

Website:

 

Description:

 

Level of Sophistication:

High

NOTE to Accounting:

baabab

Amount:

0.0

Estimated volumes:

34534564

Sales cycle:

Annaul

  • December 10, 2009
  • Like
  • 0

 

Could somebody please let me know why I can update AccountAccessLevel field on the AccountTeamMember object?

 

 public class Acceleration_CollaborativeTeam {
     public static void updateAccountTeam(id accountid, id userid , string role, string action)
    {
        Boolean existingrecord = false;
        List<AccountTeamMember> atmlist = new List<AccountTeamMember>();
        for (AccountTeamMember atm : [select UserId, TeamMemberRole,Id,CreatedById,AccountId, AccountAccessLevel  from AccountTeamMember where (AccountId = :accountid and UserId =: userid and TeamMemberRole =: role)]) {
            existingrecord = true;
        }

              
        if (existingrecord = true)
        {     
            AccountTeamMember newatm = new AccountTeamMember();
            
            newatm.AccountId =  accountid;
            newatm.UserId= userid;

            newatm.TeamMemberRole = role;
          //  newatm.AccountAccesslevel = 'Read';

            atmlist.add(newatm);
        }

        if (atmlist.size() > 0) {
            insert atmlist;
        }
    }


}

 

  • November 24, 2009
  • Like
  • 0

I'm currently developing a customer portal where the client can select the asset when logging a case.

 

I only want to show the client certain Assets ( E.g where Asset product = "xyz")

 

Is there any way one can filter these records or does one have to use visual force for this? If visaul force is the only option could somebody please provide me an example on how to do this?

 

 

Thanks

 

Stephen

  • October 09, 2009
  • Like
  • 0

I currently developing a customer portal where the client can select the asset when logging a case.

 

I only want to show the client certain Assets ( E.g where Asset product = "xyz")

 

Is there any way one can filter these records or does one have to use visual force for this? If visaul force is the only option could somebody please provide me an example on how to do this?

 

 

Thanks

 

Stephen

  • October 09, 2009
  • Like
  • 0

I have created a custom field caled Related Product on the Asset object. The Trigger below is not updating this field when an Asset is inserted or updateed. Could someboby please explain to me what is wrong with this code?

trigger AssetRelatedProduct_BeforeUpdate on Asset (before insert, before update) {
    
            
    
    for ( Asset assetdata : [Select a.Related_Product__c, a.Product2Id, a.Id From Asset a  where  a.id in :Trigger.New])
   {
        for (Product2 productdata : [Select p.Name, p.Id From Product2 p where p.id = : assetdata.Product2id])
        {
            assetdata.Related_Product__c = productdata.Name;
        }
   }
   
}
  • September 13, 2009
  • Like
  • 0

I want to add a link into email which allows the use to select a url which will redirect the user directly to the case within the Customer Portal.

 

 

I tried the following but I states that the url does not exists

 

  https://emea.salesforce.com/secur/login_portal.jsp?orgId={!Organization.Id}&portalId={!Portal.Id}&startURL=https//emea.salesforce.com/{!Case.Id}

Can anybody provide me advise on how to resolve this?

Thanks

Stephen

 

 

  • August 19, 2009
  • Like
  • 0

I'm having trouble updating  case business hours in Apex Code.

 

Has anybody had this type of problem before?

 

Thanks

 

 

Stephen 

Could somebody provide me with apex code on how to create a case comment based on a new incoming email to a case?

 

 

I don't one can add a trigger to a email object. We are using Case to Email on demand services.

 

 

Thanks

 

Stephen 

 Could somebody please explain to my why this fails?

 

public static ID[] GetAccountContacts(String AccountId)

 {

ID[] iddata = [select id from contact where AccountId];

 

return iddata;

 

}

Could somebody help me with this problem? I'm trying to Split an EmailCc values into separate email fields but I get the above error when I try and deploy this trigger to my production server.

 

 

 

trigger Acceleration_EmailCCSplit on Case (before insert, before update) {

    Map<String, Case> CaseMap = new Map<String,Case>();    Map<String,

Case> CaseMapOld = new Map<String,Case>();    Map<String, String> CaseMapOldNew = new Map<String,String>();

 

 

     for (Case casedata : System.Trigger.new)

   {

         if (casedata.EmailCC__c!=null) {

               System.debug('# EmailCC Outside 1.1 EmailCC__c ' + casedata.EmailCC__c);

            if (System.Trigger.isInsert) {              System.debug('# EmailCC Outside 1.2 System.Trigger.isInsert ' + System.Trigger.isInsert);

               CaseMap.put(System.Trigger.oldMap.get(casedata.id).EmailCC__c, casedata);

               CaseMapOldNew.put(casedata.EmailCC__c, casedata.EmailCC__c);

            }

                  if (System.Trigger.isUpdate) {

                       System.debug('# EmailCC Outside 1.3 System.Trigger.isUpdate ' + System.Trigger.isUpdate);

                        if (casedata.EmailCC__c != System.Trigger.oldMap.get(casedata.id).EmailCC__c){

                           System.debug('# EmailCC Outside 1.4 EmailCC is difference to previous version');                           System.debug(

'# EmailCC Outside 1.5 EmailCC Old = ' + System.Trigger.oldMap.get(casedata.id).EmailCC__c);                           System.debug('# EmailCC Outside 1.6 EmailCC New = ' + casedata.EmailCC__c );

                           CaseMap.put(System.Trigger.oldMap.get(casedata.id).EmailCC__c, casedata);

                           CaseMapOldNew.put(System.Trigger.oldMap.get(casedata.id).EmailCC__c,casedata.EmailCC__c);

                   }

              }

          }

    }

 

// List<Case> UpdateCases = new List<Case>();

 

System.debug('# EmailCC Outside 2.0 List Count ' + CaseMap.size());

System.debug('# EmailCC Outside 2.1 List keySet() ' + CaseMap.keySet());

for ( Case casedatalist : [SELECT EmailCC__c, Email_CC_1__c, Email_CC_2__c FROM Case Where EmailCC__c IN : CaseMap.keySet() ])

{

        System.debug('# EmailCC list Inside 2.2' + casedatalist.EmailCC__c);

        casedatalist.EmailCC__c = CaseMapOldNew.get(casedatalist.EmailCC__c);

        casedatalist.Email_CC_1__c = '';        casedatalist.Email_CC_2__c = '';

 

        Integer y = 0 ;

for(String s : casedatalist.EmailCC__c.Replace(',',';').Split(';')) {

y = y + 1 ;

System.debug('# EmailCC__c - s ' + y + ' :: ' + s);

if ( y == 1 ) {System.debug(

'# EmailCC__c - 1 found ' + s);

casedatalist.Email_CC_1__c = s;

} else if ( y == 2 ) {System.debug('# EmailCC__c - 2 found ' + s);

casedatalist.Email_CC_2__c = s;

}

// UpdateCases.add(casedatalist );

}

// Update UpdateCases;

 

}

}

How would one write a SOQL query that queries records in the last hour? 

 

 

Select n.IsPrivate, n.Id, n.CreatedDate, n.Body From Note n

where n.CreateDate.AddDate(-1, 'h')

I have created a class to handle my inbound emails.

 

I ran the debug logs but but I'm not seeing the class in the logs

Is it possible to deploy a trigger to production using Eclipse instead of creating and using a package

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}

 

How does one see the list of validation and workflow rules in Eclipse?

 

 

We recently copied across Salesforce production version to our sandbox.

 

I create some Testmethods for a new trigger that I built but now I'm getting an error on some of the validation rules that use the $User.ProfileId in the validation formulae. This makes sense because the Id will change in different orgs.

 

What should I be using then. Should I be using $Profile.Name instead of $User.ProfileId in the validation formulae?

 

Below is a snippet of the error

 

Error Condition Formula: ($User.ProfileId = "00e20000000mxo7" 
|| 
$User.ProfileId = "00e20000000mxoD" 
|| 
$User.ProfileId = "00e20000000mwku" 
|| 
$User.ProfileId = "00e20000000mxsO" ) 
&& 
ISCHANGED(Description) 
&& 
NOT(ISPICKVAL (Status , "New"))
Value(s) Found: Status=New , Description=TestDescription2 , $User.ProfileId=00e20000000hFRI
Result: PASS - Continue
Rule Name: Can_not_Edit_Case_Error_Mess_if_Customer
Error Condition Formula: ($User.ProfileId = "00e20000000mxo7" 
|| 
$User.ProfileId = "00e20000000mxoD" 
|| 
$User.ProfileId = "00e20000000mwku" 

Could somebody please show me how to convert the scontrol below into a VisualForce page?

 


<a target="_blank" style="color: #000000; text-decoration: underline; font-family:'Arial','Helvetica',sans-serif;
font-size:75%;" href="http://www.linkedin.com/pub/dir/{!Contact.FirstName}/{!Contact.LastName}" >Get Contact Info</a>

 

 

Thanks

 

Stephen

I have installed the latest version of Eclipse and Force.com IDE but it does not allow me to create a new Force.com project

 

Could somebody recommend what versions I should be using?

 

I installed the following versions

Eclipse 3.4.2

Force.com IDE 16.0.0200906151227

I want to deploy a single Apex Trigger with using the Package menthod. The package method forces one to select all the triggers that one is using.

 

Is it possible just to deploy the one trigger (and testmethod) without using packages. Can this be done in Ecilpse?

 

 

Thanks

 

Stephen

I want to re-create the Customer Portal in force sites.

 

Has any body done this before and if not can you point me in the right direction?

 

 

Thanks

 

Stephen

I'm trying to copy a new user as contact by using a trigger but I'm getting the following error

 

MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Contact, original object: User

 

trigger Acceleration_User_Copyto_Contact on User (after insert, after update) {
    
   // Map<String,User> newLead = new Map <String, User>();
    
    system.debug('Acceleration_User_Copyto_Contact Trigger....');
 
    for ( User user : System.Trigger.new)
    {
        if  (user.Email.contains('acceleration'))
        {
            system.debug('Acceleration_User_Copyto_Contact Trigger..2.');
            Integer RecordCount = [select count() from Contact c where c.Email = : user.Email];
            
            system.debug('Acceleration_User_Copyto_Contact Trigger..2a .' + RecordCount);
            
            if (RecordCount == 0)
            {
                String AccountId = '';
                for ( Account a : [Select a.Id From Account a where Name = 'Acceleration']) 
                {
                    system.debug('Acceleration_User_Copyto_Contact Trigger..3.');
                     
                    AccountId = a.Id;
                
                    Contact con = New Contact();
                    con.AccountId = AccountId ;
                    con.Email = user.Email;
                    con.Firstname = User.Firstname;
                    con.Lastname = User.Lastname ;
                    con.User__c = User.Id;
                    insert con;
                }          
            }                   
        }
        
     }
    
    
}

 

Salesforce / Apex CRM Developer  - Contract London UK

Salesforce/CRM Developer Contract

Salesforce.com/Apex Developer required for our client an insurance company based in London  however has the added advantage of being able to work from home 3 days per week. You will be required to manage the administration, development and implementation of new functionality, changes and customisations to the CRM application according to customer requirements.

As a Salesforce developer you will have a proven track record in CRM development using Salesforce.com, have an innovative approach to Salesforce, have a solid Salesforce administration and development background and have knowledge of Apex code development and Visualforce development.

In addition you will be responsible for developing, testing and deploying solutions according to new customer requirements and producing and maintaining documentation for all projects

Skills: Salesforce.com Development; CRM Development; AppExchange; Salesforce Administration; Apex code development; Visualforce development; Change Control.

Our client is looking to interview and give immediate feedback so please send your CV immediately!!!

I'm looking for permanent Salesforce Developer to be based in the UK managing some administration but mainly development and implementation of new functionality, changes and customisation of a global CRM System.

 

You will be responsible for developing sandbox and production environments, producing innovative functional designs and driving adoption, data quality and best practice to meet all business requirementsI'm looking for someone with a proven track record in CRM development using Salesforce.com.

 

Competitive salary plus bonus.

 

Please let me know if your interested.

Help!!

 

Issue: I have an APEX script that reassigns to a specific owner based on certain criteria (effectively bypassing Auto Assignment rules). This works fine, however I'm trying to code an emailCaseOwner(Case) function that emails the case owner after it's assigned. The trigger I'm passing is Case update before.  The email that is ultimately sent to the case.OwnerID is not populating the merge fields.

 

The email template is used as the "Case Assigned Template" (Setup -> Customize -> Case -> Support Settings). I'm basically mimicing the checkbox when manually assigning a case owner "Send Notification Email".

 

End result of email being sent to assigned user:

Force.com Sandbox

Case Number:  -

Client:  -  

Created by: 

Subject:

Description:

 

APEX Code:

    public static void emailCaseOwner(Case a)
    {
        EmailTemplate template = [select Id from EmailTemplate where Name = 'NewCase4CRC' limit 1];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        mail.setTargetObjectId(tempContact.Id);
        mail.setTemplateId(template.Id);
        mail.saveAsActivity = false;
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail } );
    }

Template Snippet:

Case Number: {!Case.CaseNumber} - {!Case.Product__c}
Client: {!Case.Contact} - {!Case.Account} {!Contact.Phone} {!Contact.Email}
Created by: {!Case.CreatedBy} {!Case.CreatedDate}

{!Case.Link}

Subject: {!Case.Subject}

Description: {!Case.Description}

I want to add a link into email which allows the use to select a url which will redirect the user directly to the case within the Customer Portal.

 

 

I tried the following but I states that the url does not exists

 

  https://emea.salesforce.com/secur/login_portal.jsp?orgId={!Organization.Id}&portalId={!Portal.Id}&startURL=https//emea.salesforce.com/{!Case.Id}

Can anybody provide me advise on how to resolve this?

Thanks

Stephen

 

 

  • August 19, 2009
  • Like
  • 0

Is it possible to fire off a trigger on the Note object and if one can not what is the possible work around for this?

 

Thanks

 

Stephen 

I have created a class to handle my inbound emails.

 

I ran the debug logs but but I'm not seeing the class in the logs

Is it possible to deploy a trigger to production using Eclipse instead of creating and using a package

Could somebody please show me how to convert the scontrol below into a VisualForce page?

 


<a target="_blank" style="color: #000000; text-decoration: underline; font-family:'Arial','Helvetica',sans-serif;
font-size:75%;" href="http://www.linkedin.com/pub/dir/{!Contact.FirstName}/{!Contact.LastName}" >Get Contact Info</a>

 

 

Thanks

 

Stephen

I have installed the latest version of Eclipse and Force.com IDE but it does not allow me to create a new Force.com project

 

Could somebody recommend what versions I should be using?

 

I installed the following versions

Eclipse 3.4.2

Force.com IDE 16.0.0200906151227

Please reply with your CV, rate & availability.  Cheers!

  • June 24, 2009
  • Like
  • 0

I want to deploy a single Apex Trigger with using the Package menthod. The package method forces one to select all the triggers that one is using.

 

Is it possible just to deploy the one trigger (and testmethod) without using packages. Can this be done in Ecilpse?

 

 

Thanks

 

Stephen

I want SOQL that returns Cases with the relevant Account Name

 

I tried the following SOQL statement but I'm receiving an error

 

Select c.Id, c.CaseNumber, c.AccountId, (Select a.Name From Account a) from Case

 

 

I tried following the guidelines in the following web site

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm

 

Thanks

 

Stephen

 

 

Could somebody provide me with sample code on how to upload attachments to cases in asp or aspx?

 

 

Hi,
 
I'm trying to update the BusinessHours field in Case based on some conditions.
 
I'm assigning businessHours Id value fetched from the Organisations Business Hours to this field.
 
Its throwing an error saying 'Illegal Assignment Id to SObject:BusinessHours'.
Is there any way to do this.
 
I read in the 'Apex Language Reference ' document that we cannot perform DML operations on this object.
But im updating the case not that object. Is it possible using apex?
 
Any pointers will be of great help.
Thanks in advance.
  • August 13, 2008
  • Like
  • 0
Hello All,

Is anyone familiar with this program. The Set Up Guide provided an apex trigger code as an example however I continue to receive a warning message everytime I save this trigger.  Is there something wrong with the code?
ErrorError: Compile Error: unexpected token: at line 1 column 9

trigger batchRun on cron__Batch_Run__c (before insert, before update) {

// This Apex trigger is designed to fire when the batch workflow scheduler
// checks the Trigger Batch Run checkbox or when changes are made to the Batch Run
// record manually.


Boolean error = false; // Var used by each batch job to flag and return an error to the Batch Run object.
String results = ''; // Batch job results, also returned to the Batch Run object.

for (cron__Batch_Run__c batchRun : Trigger.new) {
System.debug(batchRun);

if ( batchRun.cron__Completed__c != null) {
System.debug('Job is already completed');
continue; // Job has alread run, skip all this

}


if ( batchRun.cron__Trigger_Batch_Run__c == true ) {

System.debug('Trigger Batch Run set. Running batch job.');

// --------------- Batch Job Housekeeping --------------------
Datetime lastrun = Datetime.now();
Datetime nextrun;
if(batchRun.cron__Run_Every_Units__c == 'Days') {
nextrun = lastrun.addDays(batchRun.cron__Run_Every__c.intValue());
} else {
nextrun = lastrun.addHours(batchRun.cron__Run_Every__c.intValue());
}
if (nextrun < Datetime.now()) {
nextrun = Datetime.now();
}

// Create the next Batch Run and configure it so that the scheduler workflow
// adds a Trigger_Batch_Run field update in the time-based workflow queue.
cron__Batch_Run__c newJob = new cron__Batch_Run__c(
cron__Scheduled_To_Run__c = nextrun,
cron__Trigger_Batch_Run__c = false,
cron__Batch_Job_Name__c = batchRun.cron__Batch_Job_Name__c,
cron__Batch_Job__c = batchRun.cron__Batch_Job__c,
cron__Run_Every__c = batchRun.cron__Run_Every__c,
cron__Run_Every_Units__c = batchRun.cron__Run_Every_Units__c,
cron__Trigger_Scheduler_1__c = true);
insert newJob;

// Update the current Batch Run dates and uncheck batch job trigger
batchRun.cron__Completed__c = lastrun;
if (batchRun.cron__Scheduled_To_Run__c == null) {
batchRun.cron__Scheduled_To_Run__c = lastrun;
}
batchRun.cron__Trigger_Batch_Run__c = false;

// ------------ End Batch Job Housekeeping -------------------


// ----------- Begin batch jobs -----------------
if (batchRun.cron__Batch_Job_Name__c == 'Sample Batch Job') {
error = false;
results = '';

// Insert your Apex code here... be sure to set vars 'error' and 'results' to
// pass batch results back to the Batch Run object.

}

// ----------- End batch jobs -----------------

// Report Governor Limit Stats and set return values
String limitText = 'Aggregate Queries: '+
Limits.getAggregateQueries() +'/' +
Limits.getLimitAggregateQueries();
limitText += '\nSOQL Queries: '+
Limits.getQueries() +'/' +
Limits.getLimitQueries();
limitText += '\nQuery Rows: '+
Limits.getQueryRows() +'/' +
Limits.getLimitQueryRows();
limitText += '\nDML Statements: '+
Limits.getDMLStatements() +'/' +
Limits.getLimitDMLStatements();
System.debug(limitText);

batchRun.cron__Results__c = results;
batchRun.cron__Results__c += '\n\n'+limitText;
if (error) {
// write error to batch run notes field and set error flag
batchRun.cron__Result__c = 'Error';
} else {
batchRun.cron__Result__c = 'Success';
}

} else { // end if trigger batch job flag set
System.debug('Refreshing time-based workflow queue');
// Alternate Trigger Scheduler flags to keep workflow queued and current
if (batchRun.cron__Trigger_Scheduler_1__c == false) {
batchRun.cron__Trigger_Scheduler_1__c = true;
batchRun.cron__Trigger_Scheduler_2__c = false;
} else {
batchRun.cron__Trigger_Scheduler_1__c = false;
batchRun.cron__Trigger_Scheduler_2__c = true;
}

}

}
}