You need to sign in to do that
Don't have an account?
giri rocks
How to i populate custom picklist in triggers
How to i populate custom picklist in triggers
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
How to i populate custom picklist in triggers
Hope this works for you............
trigger addCampaignNames on Contact (before insert) {
//get the list of active campaign names
public List<Campaign> cm = [select Name from Campaign where IsActive=true];
public Integer cmSize = cm.Size();
public String cName='';
//each campaign name is appended with ;
for(Campaign cpp : cm){
cName+=';'+cpp.Name;
}
//when a new contact is created the active campaign names are populated to a custom field Campaign Member which is Mulit-select picklist field
for(Contact c: Trigger.New){
c.Campaign_Members__c =cName;
}
}
Please let me know if this resolves your issue
All Answers
Try this code.....
trigger testTrigger on Campaign (before insert) {
for(Campaign c :Trigger.New){
c.Active__c='yes'; //Active is a custom picklist field in Campaign object
}
}
In the above trigger, every time when a new campaign is created the active field is populated with yes.
Please let me know if this answered your question.
HI sravanthi...
i want to know how do i populate multiple values to a custom picklist in triggers
thanks for your help
You will need to assign values semi colon separated to that field if its type of multiselect.
Can you give more information on this..Is your picklist single select picklist or multi-select picklist and the scenario you want this field to be populated
if it is a multi-select picklist as Prasanna mentioned, You will need to assign values separated with semi colon
Hello sravanthi...actually i need to populate campaign names in the multi-piclist custom field in the contacts tab using triggers.....
can you help me on this issue????plz....
Ok to add campaign names to contacts before you insert a new contact, try the following code.
trigger addCampaignNames on Contact (before insert) {
for(Contact c: Trigger.New){
c.Campaign_Members__c = 'Test1;Test2;Test3'; //Campaign Members is a custom multi-select picklist field on Contacts object
}
}
Do you want this field to be populated with the same Campaign Names every time a new Contact is created?
Hello sravanthi....
i want all active campaign names in the multi -picklist custom field in the contacts tab...and the field must be populated automatically whenever new campaign is created...
thanks a lot for your help .
Hope this works for you............
trigger addCampaignNames on Contact (before insert) {
//get the list of active campaign names
public List<Campaign> cm = [select Name from Campaign where IsActive=true];
public Integer cmSize = cm.Size();
public String cName='';
//each campaign name is appended with ;
for(Campaign cpp : cm){
cName+=';'+cpp.Name;
}
//when a new contact is created the active campaign names are populated to a custom field Campaign Member which is Mulit-select picklist field
for(Contact c: Trigger.New){
c.Campaign_Members__c =cName;
}
}
Please let me know if this resolves your issue
thank you sravanthi this is exactly what i wanted..........
thank you very much....:)
Hi sravanthi,
I have got following task can you please help me....i need your help....i am new to salesforce crm .... their was no training....no one to help in salesforce crm ....
this task is going to decide my life.....plz help me....hope you understand ....
1.0 Statement of Work / Document of Understanding
Scope of Services, Deliverables, Charges, and other applicable terms:
This STATEMENT OF WORK (“SOW”)
Exide would like to engage ZesTech, Inc.to help Exide customize one or more salesforce data objects to improve workflow in report generation. Below is the problem description:
Exide is using a the standard reporting system in SFDC to leverage a use case in their company currently whereby they need a snapshot of summaries from opportunity and activity objects on weekly intervals at different hierarchies of users. They have a WEEKLY REPORT custom object which stores these snapshots. There are 3 levels of users: first level, mid management and upper management. The process is completely manual. Following is the current workflow of tasks:
1 – Exide has over 50 first level users who generate data which feeds into level 2 and level 3 reports. Level 2 (mid-management) does the largest amount of
summarizing. Level 3 (upper management) conducts a “cut and paste” of their Level 2 users‟ summarized data (fields).
2 – User at level 1 logs in to SFDC, opens the relevant reports, looks at summarized fields and copies values to a new row in the WeeklyReport custom object.
3 – User at Level 2, logs in to SFDC, runs a report on the WeeklyReport custom object (as well as some other reports). Level 2 user then looks at the summarized values of that report and creates their own row in WeeklyReport custom object which stores summary of that report.
4 – User at Level 3 logs in to SFDC, runs a reporton the Weekly Report custom object for level 2 users only and look at summarized data for all level 2 users. Level 3 user then looks at the summarized values of that report and creates their own row in WeeklyReport custom object which stores summary of that report.
5 – The process restarts on Saturday of each week.
Exide wants this manual process automated so that users don‟t have to copy-paste data into WeeklyReport custom object themselves. A workflow or apex code should do this.
This Statement of Work (SOW) defines the scope of work to be accomplished by Force 5, Inc. Changes to this SOW will be processed according to the procedure described in Appendix 1: “Project Change Control Procedure”.
1.1 Project Scope/Deliverables
The objective of this task is to provide Exide with Time and Material services required to help Exide customize one or more salesforce.com data objects to improve workflow in report generation.
ZesTech Deliverables:
ZesTech will use custom Apex programming to enable the creation and population of the three reporting tiers:
1. Create a Rules custom object which will basically keep record of the query conditions in the reports at atomic level. E.g. if the report displays all opportunities greater than $50,000 that are closed before July 1st 2010, there will be 3 entries in the Rules object:
a – condition = „StageName = Closed‟, Level = „1‟, ReportName = „Closed Oppty report‟
b – condition = „Amount > 50000‟, Level = „1‟, ReportName = „Closed Oppty Report‟
c – condition = „CloseDate < 07/01/2010‟, Level= „1‟, ReportName = „Closed Oppty Report‟
2. Create custom fields in Users standard object called “Level” and “IsEnabledForWeeklyReporting”. Level will signify the hierarchy level of users, while the Boolean field will enable the code to pick that user for summarization of data.
3. Create Batch apex classes for each level of users which will use the Rules custom object and the custom fields in Users object to summarize data for each level of users and insert data into the WeeklyReport custom object.
4. Create schedulable classes for each batch apex class which will schedule the code at specific required intervals
5. Unit testing for the batch and schedulable classes.
6. Testing and Deployment of code to production environment.
7. Create Mail-Merge Word Template which will print out data in the Weekly Report custom object record as a word document.
8. The intent of this customization is to eliminate unnecessary “cut and paste” operations.
9. The ZesTech will deliver the solution and implement for the Exide Salesforce.com Project Manager