• apexnewbie
  • NEWBIE
  • 50 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 7
    Replies

I have a picklist field called Primary_Complaint_Code__c which includes about 200 values. If there is any value in this field, I would like to transfer that value to a new text field called All_Complaint_Codes__c. I'm hoping there is a way to specify all value rather than adding a line for each of the 200 values. I also have 2 other fields Secondary_Complaint_Code__c and Third_Complaint_Code__c with the same values and I need a field that holds all values for all Codes for reporting purposes. 

 

IF(ISPICKVAL( Primary_Complaint_Code__c ,"Smart Meters"),"Smart Meters;", null)

 

My report would be:

All_Complaint_Codes__c contain "Smart Meters" rather than having Primary_Complaint_Code = Smart Meters  or Secondary_Complaint_Code__c = Smart Meters or Third_Complaint_Code__c = Smart Meters.

 

 

I am trying to map the Lead Type field (picklist) to the account when the lead is converted. If the Lead Type = Salesforce.com, I want a checkbox on the account to be True. I'm missing how to convert the string to boolean to make it work.

 

trigger LeadTypeToAccount on Lead (before update) {

 

Map<Id,String> LeadType = new Map<Id,String>();

 

for(Lead lead : Trigger.new) {
if (lead.IsConverted) {
LeadType.put(lead.ConvertedAccountId,lead.Lead_Type__c);
}
}
List<Account> AcctList = [select Id from Account WHERE Account.Id IN :LeadType.keySet()];
for ( Account a : AcctList) {
If (LeadType = 'Salesforce.com')
a.Salesforce_com__c = LeadType.get(a.Id);
}
update AcctList;
}

 

***Save Error: Illegal assignment from String to Boolean

I have created a VF page that renders a Word doc. It works but is there any way to automatically open up Word. Right now the Word doc is downloading (I have Windows 7, Word 2010), but if somoeone doesn't know it's downloading, they might think nothing is happening. If it could open Word up rather than just save it to the download folder it would be much more obvious to a user.

 

Thanks

 

<apex:page standardController="Investment__c" showheader="false" contentType="application/msWord" cache="true"> 

Stumbling through a Trigger, found a few examples but I'm pretty sure I butchered them. I have a custom junction object called Contact_Notes__c. When a new one is created, I would like the date created field (or now()) to be added to a field on the standard Contact object called Last_Note_Date__c.  Any help is greatly appreciated. If I can at least find out if I'm on the right track anyway.

 

trigger UpdateContactNoteDate on Contact_Notes__c (After Insert) {

 

list<Contact_Notes__c> theContactNotes = new list<Contact_Notes__c>(); //create a list called theContactNotes
map<ID, Today> cnID = new map<ID, Today>(); //add two columns to theContactNotes list, ID and todays date

 

for (Contact_Notes__c nc:trigger.new) {
theContactNotes.add(l);
if (nc.Contact_Name__c != null) { //If the Contact_Name__c is not null in Contact_Notes__c put Contact_Name__c in the cnID column of theContactNotes list
cnID.put(nc.Contact_Name__c);
}

 

// Loop through the main list of Contacts

 

list<Contacts> theContacts = new list<Contacts>(); // List containing Contact records
for (Contact c:theContacts) {
if(cnID.get(Today.put(c.Last_Note_Date__c))) //if a contact matches theContactNotes list cnID column put Today in the Last_Note_Date__c field on Contact record
}
}


I have a picklist field called Primary_Complaint_Code__c which includes about 200 values. If there is any value in this field, I would like to transfer that value to a new text field called All_Complaint_Codes__c. I'm hoping there is a way to specify all value rather than adding a line for each of the 200 values. I also have 2 other fields Secondary_Complaint_Code__c and Third_Complaint_Code__c with the same values and I need a field that holds all values for all Codes for reporting purposes. 

 

IF(ISPICKVAL( Primary_Complaint_Code__c ,"Smart Meters"),"Smart Meters;", null)

 

My report would be:

All_Complaint_Codes__c contain "Smart Meters" rather than having Primary_Complaint_Code = Smart Meters  or Secondary_Complaint_Code__c = Smart Meters or Third_Complaint_Code__c = Smart Meters.

 

 

I am trying to map the Lead Type field (picklist) to the account when the lead is converted. If the Lead Type = Salesforce.com, I want a checkbox on the account to be True. I'm missing how to convert the string to boolean to make it work.

 

trigger LeadTypeToAccount on Lead (before update) {

 

Map<Id,String> LeadType = new Map<Id,String>();

 

for(Lead lead : Trigger.new) {
if (lead.IsConverted) {
LeadType.put(lead.ConvertedAccountId,lead.Lead_Type__c);
}
}
List<Account> AcctList = [select Id from Account WHERE Account.Id IN :LeadType.keySet()];
for ( Account a : AcctList) {
If (LeadType = 'Salesforce.com')
a.Salesforce_com__c = LeadType.get(a.Id);
}
update AcctList;
}

 

***Save Error: Illegal assignment from String to Boolean

I have created a VF page that renders a Word doc. It works but is there any way to automatically open up Word. Right now the Word doc is downloading (I have Windows 7, Word 2010), but if somoeone doesn't know it's downloading, they might think nothing is happening. If it could open Word up rather than just save it to the download folder it would be much more obvious to a user.

 

Thanks

 

<apex:page standardController="Investment__c" showheader="false" contentType="application/msWord" cache="true"> 

Stumbling through a Trigger, found a few examples but I'm pretty sure I butchered them. I have a custom junction object called Contact_Notes__c. When a new one is created, I would like the date created field (or now()) to be added to a field on the standard Contact object called Last_Note_Date__c.  Any help is greatly appreciated. If I can at least find out if I'm on the right track anyway.

 

trigger UpdateContactNoteDate on Contact_Notes__c (After Insert) {

 

list<Contact_Notes__c> theContactNotes = new list<Contact_Notes__c>(); //create a list called theContactNotes
map<ID, Today> cnID = new map<ID, Today>(); //add two columns to theContactNotes list, ID and todays date

 

for (Contact_Notes__c nc:trigger.new) {
theContactNotes.add(l);
if (nc.Contact_Name__c != null) { //If the Contact_Name__c is not null in Contact_Notes__c put Contact_Name__c in the cnID column of theContactNotes list
cnID.put(nc.Contact_Name__c);
}

 

// Loop through the main list of Contacts

 

list<Contacts> theContacts = new list<Contacts>(); // List containing Contact records
for (Contact c:theContacts) {
if(cnID.get(Today.put(c.Last_Note_Date__c))) //if a contact matches theContactNotes list cnID column put Today in the Last_Note_Date__c field on Contact record
}
}