-
ChatterFeed
-
20Best Answers
-
0Likes Received
-
0Likes Given
-
0Questions
-
107Replies
How to increase the number of characters of the the help text [Custom field]
Hi all,
Do you know how we can increase the number of characters of the the help text on a Custom field?
Thanks in advance.
Do you know how we can increase the number of characters of the the help text on a Custom field?
Thanks in advance.
- Karim BAHAJI
- November 18, 2015
- Like
- 0
- Continue reading or reply
Trigger to fire on Before Delete
Hi All,
I am having below trigger which calls a method "sendNotification" when the account name is changed. I want this trigger to call the method when the account is deleted ie)on before delete operation. Please help me on how this can be done.
Abraham
I am having below trigger which calls a method "sendNotification" when the account name is changed. I want this trigger to call the method when the account is deleted ie)on before delete operation. Please help me on how this can be done.
trigger Contactcallout2 on Account(after update) { List<Contact> ListContact = new List<Contact>(); Set<ID> acctIds = new set<ID>(); for(Account acct : trigger.new) { if(Trigger.oldMap.get(acct.id).Name != acct.Name){ acctIds.add(acct.Id); } } if(acctIds.size() > 0){ for(Contact con : [SELECT id,Email,FirstName,LastName,phone,Title__c,Account.Name,status__c, AccountId FROM Contact WHERE AccountId IN : acctIds AND RecordTypeid = '012D6765454BaFA']){ WebServiceCallout.sendNotification(con.Id,con.Email,con.FirstName,con.LastName,con.phone,con.Title__c,con.Account.Name,con.status__c); } } }Many Thanks in advance
Abraham
- Abraham kumar
- October 13, 2015
- Like
- 0
- Continue reading or reply
Send email every day 4 PM
Hi All,
i want to send email every day 4 pm. for that i written some code.
Please check it below code once and let me know, what i have to do.
Please explain step by step.
I appriciate your response.
Thank you.
Rakesh.S
i want to send email every day 4 pm. for that i written some code.
Please check it below code once and let me know, what i have to do.
global class scheduledEmail implements Schedulable { public static String CRON_EXP = '0 20 16 * * * *'; global static String scheduleIt() { scheduledEmail sm = new scheduledEmail(); return System.schedule('Monthly Email', CRON_EXP, sm); } global void execute(SchedulableContext SC) { sendmail(); } public void sendmail() { Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); string [] toaddress= New string[]{'sircilla.rakesh7@gmail.com'}; email.setSubject('Testing Apex Scheduler-Subject'); email.setPlainTextBody('Testing Apex Scheduler-Body'); email.setToAddresses(toaddress); Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email}); } }
Please explain step by step.
I appriciate your response.
Thank you.
Rakesh.S
- Rakesh S
- October 10, 2015
- Like
- 0
- Continue reading or reply
Using hidden fields in APEX query
Hi
I need to have a dynamic query to retrieve the fields in Campaign object (keeping aside the governace limit) but when i execute a sample query with all the fields in query editor I see an error "No such column 'hierarchyactualcost' on entity 'Campaign'."
when i set this field as visible for profile and then execute the query i do not see this error. Any ways on how to fix this so that i can perform the query without any errors?
the code to get the fields from the object is:
Map <String, Schema.SObjectField> objectFields = Campaign.getSobjectType().getDescribe().fields.getMap();
for (SObjectField fld : objectFields.values()) {
query += ' ' + fld + ', ';
}
is there a way to see if the field is set as not visible and if so then do not consider the field in the query?
I need to have a dynamic query to retrieve the fields in Campaign object (keeping aside the governace limit) but when i execute a sample query with all the fields in query editor I see an error "No such column 'hierarchyactualcost' on entity 'Campaign'."
when i set this field as visible for profile and then execute the query i do not see this error. Any ways on how to fix this so that i can perform the query without any errors?
the code to get the fields from the object is:
Map <String, Schema.SObjectField> objectFields = Campaign.getSobjectType().getDescribe().fields.getMap();
for (SObjectField fld : objectFields.values()) {
query += ' ' + fld + ', ';
}
is there a way to see if the field is set as not visible and if so then do not consider the field in the query?
- PS81
- October 07, 2015
- Like
- 0
- Continue reading or reply
recursively deleting events and tasks below them in hierachy
Hello,
I have below usecase:
When User deletes a task or event, the tasks and events which are below them in hierarchy or they are linked to should also be deleted
Thanks for suggestions !
I have below usecase:
When User deletes a task or event, the tasks and events which are below them in hierarchy or they are linked to should also be deleted
Thanks for suggestions !
- Ab
- October 07, 2015
- Like
- 0
- Continue reading or reply
ATTACHMENT FILE &IMAGE UPLOAD
CONTROLLER
-----------
public class EmployeeRelatedList {
private Empolyee_Details__c empDetail;
public blob picture{get;set;}
public Integer counter {get; set;}
public EmployeeRelatedList(ApexPages.StandardController stdController) {
this.empDetail = (Empolyee_Details__c)stdController.getRecord();
}
public Pagereference save() {
try{
if(picture != null)
{
Attachment attachment = new Attachment();
attachment.body = picture;
insert attachment;
}
upsert empDetail;
return new Pagereference('/apex/Custom_pagenations');
}
catch(Exception e){
Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
return null;
}
}
}
VISUALFORCE PAGE
-----------------------
<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
<apex:form >
<apex:sectionHeader title="EmployeeInfo"/>
<apex:pageBlock title="EmployeeData">
<apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">
<apex:inputField value="{!Empolyee_Details__c.EmpId__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="SAVE"/>
</apex:pageBlockButtons>
<apex:inputfile value="{!Empolyee_Details__c.id}"></apex:inputfile>
</apex:pageBlock>
</apex:form>
</apex:page>
my requirement is i want to attahement the file as well as uplaod the image.i used the attachment object but i didint get any attatchment or image upload.
THANKS ®ARDS
RANGA
-----------
public class EmployeeRelatedList {
private Empolyee_Details__c empDetail;
public blob picture{get;set;}
public Integer counter {get; set;}
public EmployeeRelatedList(ApexPages.StandardController stdController) {
this.empDetail = (Empolyee_Details__c)stdController.getRecord();
}
public Pagereference save() {
try{
if(picture != null)
{
Attachment attachment = new Attachment();
attachment.body = picture;
insert attachment;
}
upsert empDetail;
return new Pagereference('/apex/Custom_pagenations');
}
catch(Exception e){
Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, e.getMessage()));
return null;
}
}
}
VISUALFORCE PAGE
-----------------------
<apex:page standardController="Empolyee_Details__c" extensions="EmployeeRelatedList" tabStyle="Empolyee_Details__c">
<apex:form >
<apex:sectionHeader title="EmployeeInfo"/>
<apex:pageBlock title="EmployeeData">
<apex:pageBlockSection title="Empolyee basic Details" columns="2" collapsible="false">
<apex:inputField value="{!Empolyee_Details__c.EmpId__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FirstName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.LastName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MiddleName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.DateofBirth__c}"/>
<apex:inputField value="{!Empolyee_Details__c.FatherMotherhusbandName__c}"/>
<apex:inputField value="{!Empolyee_Details__c.MartialStatus__c}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton action="{!save}" value="SAVE"/>
</apex:pageBlockButtons>
<apex:inputfile value="{!Empolyee_Details__c.id}"></apex:inputfile>
</apex:pageBlock>
</apex:form>
</apex:page>
my requirement is i want to attahement the file as well as uplaod the image.i used the attachment object but i didint get any attatchment or image upload.
THANKS ®ARDS
RANGA
- udayarangareddy mekala
- October 06, 2015
- Like
- 0
- Continue reading or reply
Sub-Header in DataTable
Hey Guys, I'm having trouble creating a table with a sub header. I'd like to use standard visualforce components but I'm not sure its possible. Here's a sample image. Currently, I'm using a dataTable with a column header of "Main Header". I having trouble creating the "Sub Headers". I've tried to nest dataTables but I dont want to subHeader to repeat. Any and All feedback is welcome. Thanks
- KRay
- October 06, 2015
- Like
- 0
- Continue reading or reply
Choosing Columns to display in <apex:relatedList />
I have a VisualForce page where I'm trying to display a standard related list by using the <apex:relatedList /> tag. It seems like this should be simple, but I can't seem to find any way to choose which columns are displayed in the related list; the only column being displayed is the "Name" column.
I've tried editing the related list layout on the custom object's page layout, but this didn't affect my VisualForce page.
Is there any way I can display more than just the "Name" column with an <apex:relatedList />?
I've tried editing the related list layout on the custom object's page layout, but this didn't affect my VisualForce page.
Is there any way I can display more than just the "Name" column with an <apex:relatedList />?
- Ahilya Srivastava
- August 26, 2015
- Like
- 0
- Continue reading or reply
How to add a confirm dialog to a command button?
I'd think this would work just fine, but it seems to prevent the action function from firing regardless of the confirm response
<apex:commandButton value="Remove All" action="{!removeAll}" rerender="form" status="LoadingStatus" onclick="return confirm('Are you sure?');"/>
- Ahilya Srivastava
- August 26, 2015
- Like
- 0
- Continue reading or reply
How to render as pdf when loading the existing website into the VF page
I have used the following cod to render as PDF, but website is not render when using the render as PDF/ but if I remove the PDF, the webpage is loading.
Code: <apex:page render="pdf"> // external webstie link (ex: bing.com) </apex:page>
Code: <apex:page render="pdf"> // external webstie link (ex: bing.com) </apex:page>
- Ahilya Srivastava
- August 26, 2015
- Like
- 0
- Continue reading or reply
Visualforce - Adding Scroll bar BlockTable
I'm displaying my records in a blocktable. I would like to limit 10 records visible to the user at a time and the user can scroll down to see the rest. How can I achieve this? Thanks
- SFDC NINJA
- August 25, 2015
- Like
- 0
- Continue reading or reply
How to enlarge image?
I have an image where i need to zoom in and zoom out the image . How do i go about it . Not getting proper solutions until now . Banging head onto this . Have taken image tag where following is the code:
<apex:image id="theImage" value="https://s3.amazonaws.com/{!bucketToList}/{!obj.key}? AWSAccessKeyId=AKIAJGN4J4RSRNW26IEA&" width="100" height="100"> </apex:image>
Please help !
- SFDC NINJA
- August 25, 2015
- Like
- 0
- Continue reading or reply
Application not working correctly due to Role not being defined on a specific user
Hello,
We have a customer service application where customer reps start from
a customer search page and help customers with various needs. SOQL queries are
executed to retrieve the data during a search.
I was logged in as a rep doing a search and kept getting "No Results Found".
I had been logged in as other reps and performed the exact same search and
had gotten results from the search just fine.
Long story short. I noticed on the troubled user that they did not have a user
role defined. After setting the role, the search worked fine.
Can anyone tell me why a lack of a user role would affect the application
like this ? Let me know if need more specific information.
Thanks, Chris
We have a customer service application where customer reps start from
a customer search page and help customers with various needs. SOQL queries are
executed to retrieve the data during a search.
I was logged in as a rep doing a search and kept getting "No Results Found".
I had been logged in as other reps and performed the exact same search and
had gotten results from the search just fine.
Long story short. I noticed on the troubled user that they did not have a user
role defined. After setting the role, the search worked fine.
Can anyone tell me why a lack of a user role would affect the application
like this ? Let me know if need more specific information.
Thanks, Chris
- Chris Voge
- August 07, 2015
- Like
- 0
- Continue reading or reply
How to use Apex Trigger to create OpportunityShare?
Hi,
I would like to create a trigger to create an OpportunityShare record for a particular user whenever a new Opportunity is created. The end goal is to create a trigger to automatically share all Opportunities when the Opportunities are created. Below is the logic I am using and the errors I am getting. I need help figuring out how I can create an OpportunityShare record via Apex Trigger. Any thoughts as to why I am getting the error?
Code:
I would like to create a trigger to create an OpportunityShare record for a particular user whenever a new Opportunity is created. The end goal is to create a trigger to automatically share all Opportunities when the Opportunities are created. Below is the logic I am using and the errors I am getting. I need help figuring out how I can create an OpportunityShare record via Apex Trigger. Any thoughts as to why I am getting the error?
Code:
List<OpportunityShare> oppShareList = new List<OpportunityShare>(); User usr = [Select Id, name from user limit 1];//i will be querying the user involved in real code for(Opportunity opp : oppList) { OpportunityShare oppShare = new OpportunityShare(); oppShare.OpportunityAccessLevel = 'Edit'; oppShare.OpportunityId = opp.Id; oppShare.UserOrGroupId = usr.Id; oppShareList.add(oppShare); } insert oppShareList;Error:
- Variable does not exist: OpportunityAccessLevel
- Raj R.
- August 07, 2015
- Like
- 0
- Continue reading or reply
Trigger going up two parents
Hi,
I've got a trigger, where my custom object (samples__c) is pulling info from the opportunity (the parent) and then from the account (the parent of opportunity). However, I had some difficutty getting parent object info. I believe the query should be something like var.opportunity__r.accountId And this works when I do a query, but not with dot notation, and I'm not sure why. So for example, this works in the query editor
SELECT opportunity__r.accountId FROM Samples__c
Here is my final code, I did a work around with some extra maps, is this correct? Or what am I missing?
Thanks,
I've got a trigger, where my custom object (samples__c) is pulling info from the opportunity (the parent) and then from the account (the parent of opportunity). However, I had some difficutty getting parent object info. I believe the query should be something like var.opportunity__r.accountId And this works when I do a query, but not with dot notation, and I'm not sure why. So for example, this works in the query editor
SELECT opportunity__r.accountId FROM Samples__c
/* THIS SHOULD WORK For(Samples__c samp:Trigger.new) { sampSetId.add(samp.opportunity__r.accountId); system.debug(sampSetId); } */
Here is my final code, I did a work around with some extra maps, is this correct? Or what am I missing?
Thanks,
trigger Samples on Samples__c (before insert) { List<Account> acctList = new List<Account>(); Set<id> sampSetId = new Set<Id>(); Set<id> acctSetId = new Set<id>(); Map<String, Account> acctMap = new Map<String, Account>(); Map<id, ID> OppAcct = new Map <id, Id>(); Id acctId; /* THIS SHOULD WORK For(Samples__c samp:Trigger.new) { sampSetId.add(samp.opportunity__r.accountId); system.debug(sampSetId); } */ // get the list of account ID's and add them to the set For(Samples__c samp:Trigger.new) { sampSetId.add(samp.opportunity__c); system.debug(sampSetId); } List<opportunity> OppList = [SELECT accountID from opportunity WHERE id IN :sampSetId]; for (Opportunity opp: OppList) { acctSetId.add(opp.accountId); OppAcct.put(opp.Id, opp.accountId); } // query the list of accounts based on the set of account id's acctList = [SELECT ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, Shipping_phone__c, Shipping_email__c FROM Account WHERE Id IN :acctSetId]; for (Account acct:acctList) { acctMap.put(acct.id, acct); } for (Samples__c samp :Trigger.new) { AcctId = OppAcct.get(samp.opportunity__c); Account acct = acctMap.get(acctId); system.debug('acct = '+acct); if (samp.Street__c == NULL) { samp.Street__c = acct.ShippingStreet; } if (samp.City__c == NULL ) { samp.City__c = acct.ShippingCity; } if (samp.Zip_Code__c == NULL ) { samp.Zip_Code__c = acct.ShippingPostalCode; } if (samp.Phone__c == NULL ) { samp.Phone__c = acct.Shipping_Phone__c; } if (samp.email__c == NULL ) { samp.Email__c = acct.Shipping_Email__c; } } }
- Mathew Andresen 5
- July 31, 2015
- Like
- 0
- Continue reading or reply
Does it exist a Method to get child object data ?
Hi all,
Im looking on way to make code easier to write (and read).
for now if i have to work on Contract , based on an Opportunity, i have to extract data from Opportunity (ie: opp.ContractID)
and then run a SQL query to get the Contract object linked to this Opportunity.
then i'm able to edit editable Contract fields.
is there any other way as there is a relation chip between those 2 objects ?
hope all this make sense..
thanks
Many thanks
Im looking on way to make code easier to write (and read).
for now if i have to work on Contract , based on an Opportunity, i have to extract data from Opportunity (ie: opp.ContractID)
and then run a SQL query to get the Contract object linked to this Opportunity.
then i'm able to edit editable Contract fields.
is there any other way as there is a relation chip between those 2 objects ?
hope all this make sense..
thanks
Many thanks
- mustapha L 1
- July 31, 2015
- Like
- 0
- Continue reading or reply
Output displaying ID not name
Hi
Hopefully a simple one. When I use this VisualForce page it returns the ID rather than the actual name value for Customer and Contact Role. What have I missed?
Hopefully a simple one. When I use this VisualForce page it returns the ID rather than the actual name value for Customer and Contact Role. What have I missed?
<apex:page standardController="Project__c"> <apex:pageBlock id="thePageBlock" > <apex:pageBlockSection title="Project Details" columns="1"> <p>Name: {!Project__c.Customer__c}</p> <p>Contact Role: {!Project__c.Project_Contact_Role__c}</p> <p>Start Date: {!Project__c.Start_Date__c}</p> <p>End Date: {!Project__c.End_Date__c}</p> </apex:pageBlockSection> </apex:pageBlock> </apex:page>
- GB
- July 31, 2015
- Like
- 0
- Continue reading or reply
Test method hitting Internal Salesforce Error: 694469977-8690 (1545795159) (1545795159)
I'm now working on an custom controller and vf pages that will override standard opportunity behaviours. So far is all good and we get expected results in sandbox with different user profiles. However when I wrote the test method for the controller and trying to run it, I got the following error:
Internal Salesforce Error: 694469977-8690 (1545795159) (1545795159)
After my investigation, this error occurs when inserting an custom object instance in test method, and below is the code block cause the issue:
Scenario__c sc = new Scenario__c(Opportunity__c=opp.Id, Medical_Centre__c=pryAcc.Id, Contracted_Hours_per_Week__c=40,
Contracted_Years__c=5, Evening_Hours_per_Week__c=5, Weekend_Hours_per_Week__c=6, Working_Weekends_per_Year__c=40, Weeks_Not_Req_to_Work_per_Year__c='4 weeks',
Has_VR_Status__c=true, Ack_Leave_Not_Carried_Over__c=true, Ack_Restricted_Internet_Access__c=true,
Ack_No_Appointment_Basis__c=true, Ack_No_STD_ISD_Mobile_Ph_Access__c=true,
Ack_Work_Equal_Share_of_Public_Holidays__c=true, Ack_Xmas_New_Year_Special_Roster__c=true, DWS_Position_Required__c='Yes', Selected_Price__c=true);
insert sc;
(opp.Id & pryAcc.Id are previoused inserted account and opportunity id, which required in scenario calculator)
If I removed this piece of code, the test passed but will pull down the coverage% of the whole test. I have gone through some online comments but no final solution to this issue.
Any advices on that?
Thanks in advance.
Stanley
Internal Salesforce Error: 694469977-8690 (1545795159) (1545795159)
After my investigation, this error occurs when inserting an custom object instance in test method, and below is the code block cause the issue:
Scenario__c sc = new Scenario__c(Opportunity__c=opp.Id, Medical_Centre__c=pryAcc.Id, Contracted_Hours_per_Week__c=40,
Contracted_Years__c=5, Evening_Hours_per_Week__c=5, Weekend_Hours_per_Week__c=6, Working_Weekends_per_Year__c=40, Weeks_Not_Req_to_Work_per_Year__c='4 weeks',
Has_VR_Status__c=true, Ack_Leave_Not_Carried_Over__c=true, Ack_Restricted_Internet_Access__c=true,
Ack_No_Appointment_Basis__c=true, Ack_No_STD_ISD_Mobile_Ph_Access__c=true,
Ack_Work_Equal_Share_of_Public_Holidays__c=true, Ack_Xmas_New_Year_Special_Roster__c=true, DWS_Position_Required__c='Yes', Selected_Price__c=true);
insert sc;
(opp.Id & pryAcc.Id are previoused inserted account and opportunity id, which required in scenario calculator)
If I removed this piece of code, the test passed but will pull down the coverage% of the whole test. I have gone through some online comments but no final solution to this issue.
Any advices on that?
Thanks in advance.
Stanley
- Stanley Ye
- July 16, 2015
- Like
- 0
- Continue reading or reply
IF Formula, Extra ',' Error
I'm trying to create a formula based on combination of 2 fields. Not sure what I'm missing.
(Class Name = Application & Application Count is not blank) = application count +1
(Class Name != Application & Application Count is not blank) = application count
(Class Name = Application & Application Count is blank) = 1
(Class Name != Application & Application Count is blank) = 0
(Class Name = Application & Application Count is not blank) = application count +1
(Class Name != Application & Application Count is not blank) = application count
(Class Name = Application & Application Count is blank) = 1
(Class Name != Application & Application Count is blank) = 0
IF( AND( Class__r.ClassName__c = 'Application', NOT(ISBLANK(Application_Count__c)), Application_Count__c + 1)), IF( AND( Class__r.ClassName__c != 'Application', NOT(ISBLANK(Application_Count__c)), Application_Count__c)), IF( AND( Class__r.ClassName__c = 'Application', ISBLANK(Application_Count__c))),1, IF( AND( Class__r.ClassName__c != 'Application', ISBLANK(Application_Count__c),0,NULL))
- Skeeter
- May 26, 2015
- Like
- 0
- Continue reading or reply
Email-to-Case creates case but does not enter case into queue
Hi there,
I have created a queue called 'Invoices'. I then created a Record Type called 'Invoices Support'.
I then created an 'Email-to-Case' process. I set the Case Origin to Invoice Email and set the Record Type to 'Invoices Support'
I then created an assignment rule based on the record type and case origin to match the values above and set assign to: Queue - Invoices.
When I send an Email to the correct address, a Case is created but it's not entered into any queue and the Case Owner is set to the default selection.
Any ideas on how to set this up correctly would be greatly appreciated!!
If you need more info just let me know, thanks!
I have created a queue called 'Invoices'. I then created a Record Type called 'Invoices Support'.
I then created an 'Email-to-Case' process. I set the Case Origin to Invoice Email and set the Record Type to 'Invoices Support'
I then created an assignment rule based on the record type and case origin to match the values above and set assign to: Queue - Invoices.
When I send an Email to the correct address, a Case is created but it's not entered into any queue and the Case Owner is set to the default selection.
Any ideas on how to set this up correctly would be greatly appreciated!!
If you need more info just let me know, thanks!
- hgill87
- May 18, 2015
- Like
- 0
- Continue reading or reply
Batch Apex - Two Queries
Hi all, I have the following code:
How can I make the accountList work inside the context of the batch? I would like to compare both lists for a match. Any other optimizations and improvements would be appreciated.
global class ProcessLinkBetweenWorlds implements Database.Batchable<sObject>, Database.Stateful { global List<Account> accountList = new List<Account>(); global Database.QueryLocator start(Database.BatchableContext bc) { accountList = [Select PersonContactId, concat_ID__c, PersonEmail, Name FROM Account WHERE PersonEmail != NULL AND FirstName != NULL AND IsPersonAccount = TRUE AND PersonMailingCountry != 'United Kingdom' AND Is_Master_Record__c = True]; // THIS QUERY IS TOO LARGE Set<String> accountConcatIds = new Set<String>(); for(Account a: accountList) { accountConcatIds.add(a.Concat_ID__c); } return Database.getQueryLocator( 'SELECT ContactId, SuppliedEmail, concat_ID__c From Case ' + 'WHERE ContactId = NULL AND SuppliedEmail = NULL AND Concat_ID__c IN : accountConcatIds' ); } global void execute(Database.BatchableContext bc, List<Case> scope){ System.Debug(accountList.Size() + '|' + scope.Size()); for(Case c : scope) { for(Account a : accountList ) { if(a.Concat_Id__c == c.Concat_ID__c) { // Match Found! } } } } global void finish(Database.BatchableContext bc){ } }
How can I make the accountList work inside the context of the batch? I would like to compare both lists for a match. Any other optimizations and improvements would be appreciated.
- Sam Cousins
- July 28, 2016
- Like
- 0
- Continue reading or reply
Queueable apex
HI All,
What is a Queueable apex and explain with example program?
Give an example for Chaining queueable apex & execution?
What is a Queueable apex and explain with example program?
Give an example for Chaining queueable apex & execution?
- Narasimha L
- July 28, 2016
- Like
- 0
- Continue reading or reply
After Update trigger on a User record
I wrote a trigger on the User object on the after inserted and after updated events. The trigger fires on the inset event, but not on the update event. I wrote a test class to verify and the same thing happened. Any ideas as to why? I don't see any solutions on this topic.
- Lewis Blau
- January 25, 2016
- Like
- 1
- Continue reading or reply
How to increase the number of characters of the the help text [Custom field]
Hi all,
Do you know how we can increase the number of characters of the the help text on a Custom field?
Thanks in advance.
Do you know how we can increase the number of characters of the the help text on a Custom field?
Thanks in advance.
- Karim BAHAJI
- November 18, 2015
- Like
- 0
- Continue reading or reply
Customization Movement
Hi,
I am new to Salesforce. I have done some customization/coding in trail organization. Now i want to move this customization to another trail organization of salesforce. Pls guide me the steps for the same.
Regards,
Harshit Vyas
I am new to Salesforce. I have done some customization/coding in trail organization. Now i want to move this customization to another trail organization of salesforce. Pls guide me the steps for the same.
Regards,
Harshit Vyas
- Harshit Vyas
- November 18, 2015
- Like
- 0
- Continue reading or reply
How to display event activity date and event activity datetime of lead on email template ?
Hi All,
I have a doubt regarding displaying merge fields on Email template. I want to display event activityDate and Event ActivityDateTime related to Lead object in an Email Template. I have written the merge fields like below:
Your appointment Date and Time is listed below:
{!Event.ActivityDate}
{!Event.ActivityDateTime}
But it is not working when sending a demo email. It is an urgent requirement. Please provide a solution for this.
Thanks in advance.
I have a doubt regarding displaying merge fields on Email template. I want to display event activityDate and Event ActivityDateTime related to Lead object in an Email Template. I have written the merge fields like below:
Your appointment Date and Time is listed below:
{!Event.ActivityDate}
{!Event.ActivityDateTime}
But it is not working when sending a demo email. It is an urgent requirement. Please provide a solution for this.
Thanks in advance.
- Swetha A 5
- November 18, 2015
- Like
- 0
- Continue reading or reply
Populating objects from custom button URL field
I am having a small issue populating 2 fields in my custom button, everything else seems to work fine but the account field does not populate anything and I cannot populate a user in the account contact field. comments by the problem areas. code:
and in fact i would rather have the primary user in the related list Contact Roles as the Account contact. Any help is greatly appreciated!
/setup/ui/recordtypeselect.jsp?ent=01I3B0000008YRp& retURL=%2F{!Opportunity.Id}& save_new_url=%2Fa2C%2Fe%3F{!Opportunity.Name} accid={!Opportunity.Id}& CF00N3B000000OKFI={!Opportunity.Primary_Contact__c}& CF00N3B000000OKFI_lkid={!Opportunity.Primary_Contact__c.UserId}&//not sure how to reference the user id here? CF00N3B000000OKFz={!Opportunity.Name}& CF00N3B000000OKFz_lkid={!Opportunity.Id}& CF00N3B000000OKFB ={!Opportunity.Account}&//this field is left blank, but these references work in any other field i assign them to CF00N3B000000OKFB_lkid={!Opportunity.AccountId}& 00N3B000000OKFR={!Today()+90}& Name=Quote For {!Opportunity.Name}
and in fact i would rather have the primary user in the related list Contact Roles as the Account contact. Any help is greatly appreciated!
- JJames
- November 01, 2015
- Like
- 0
- Continue reading or reply
VF email template want to show only last 2 activities related to opportunity
Hi,
I have created a Visual force email template related to opportunity. I want to show last 2 activities realted to opportunity in this email template.
But as per my code it is showing all activities related to opportunty.
How can i restrict number of avtivities show on the page.
here is my code:
<messaging:emailTemplate subject="Stage change reminder" recipientType="User" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
<h1 style="font-size:100%">
<p>Dear {!recipient.name},</p></h1>
<p>FYI, appended below is a snapshot of the last few activities related to this opportunity:</p>
<table border="3" style="width:100%">
<tr>
<th>View Activity</th>
<th>ActivityDate</th>
<th>Subject</th>
<th>Status</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.ActivityHistories}">
<tr>
<td><a href = "https://ap2.salesforce.com/{!cx.id}">View</a></td>
<td>{!cx.ActivityDate}</td>
<td>{!cx.Subject}</td>
<td>{!cx.Status}</td>
</tr>
</apex:repeat>
</table>
<p> Thank You</p>
<p> Salesforce Team </p>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Plz help me to show only last 2 activities.
Regards
Russell
I have created a Visual force email template related to opportunity. I want to show last 2 activities realted to opportunity in this email template.
But as per my code it is showing all activities related to opportunty.
How can i restrict number of avtivities show on the page.
here is my code:
<messaging:emailTemplate subject="Stage change reminder" recipientType="User" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
<h1 style="font-size:100%">
<p>Dear {!recipient.name},</p></h1>
<p>FYI, appended below is a snapshot of the last few activities related to this opportunity:</p>
<table border="3" style="width:100%">
<tr>
<th>View Activity</th>
<th>ActivityDate</th>
<th>Subject</th>
<th>Status</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.ActivityHistories}">
<tr>
<td><a href = "https://ap2.salesforce.com/{!cx.id}">View</a></td>
<td>{!cx.ActivityDate}</td>
<td>{!cx.Subject}</td>
<td>{!cx.Status}</td>
</tr>
</apex:repeat>
</table>
<p> Thank You</p>
<p> Salesforce Team </p>
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Plz help me to show only last 2 activities.
Regards
Russell
- Russell baker 1
- November 01, 2015
- Like
- 0
- Continue reading or reply
Have Custom button Show Validation Rule
Hello,
have a custom object called Bookings in our org.
This is fed off the opportunities and we have a current custom button that is called "modify order".
This button triggers a workflow email as well another workflow to check modify order as true.
Because we have a javascript code that pops up a window, it is not showing any validation rule even though I put this logic check below
Underlined
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
try {
// identify the record
var o = new sforce.SObject("Booking__c");
o.id = "{!Booking__c.Id}";
// make the field change
o.Modify_Order__c= "TRUE";
// save the change
var resulto = sforce.connection.update([o]);
if(resulto[0].success=='true'){
alert('Your Order has been Submitted for Modification');
location.reload();
}
else {
var errors = resulto[0].errors;
var errorMessages = "An error has occurred, please contact your Salesforce Administrator";
for ( var i = 0; i < errors.length; i++ ) {
errorMessages += errors[i].message + '\n';
}
alert( errorMessages ); // display all validation errors
}
} catch ( ex ) {
alert( ex ); // display any javascript exception message
}
have a custom object called Bookings in our org.
This is fed off the opportunities and we have a current custom button that is called "modify order".
This button triggers a workflow email as well another workflow to check modify order as true.
Because we have a javascript code that pops up a window, it is not showing any validation rule even though I put this logic check below
Underlined
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
try {
// identify the record
var o = new sforce.SObject("Booking__c");
o.id = "{!Booking__c.Id}";
// make the field change
o.Modify_Order__c= "TRUE";
// save the change
var resulto = sforce.connection.update([o]);
if(resulto[0].success=='true'){
alert('Your Order has been Submitted for Modification');
location.reload();
}
else {
var errors = resulto[0].errors;
var errorMessages = "An error has occurred, please contact your Salesforce Administrator";
for ( var i = 0; i < errors.length; i++ ) {
errorMessages += errors[i].message + '\n';
}
alert( errorMessages ); // display all validation errors
}
} catch ( ex ) {
alert( ex ); // display any javascript exception message
}
- Nathan Hahn
- October 23, 2015
- Like
- 0
- Continue reading or reply
I get this error while verification in Trailhead.
Hi ,
Please can anyone help me ,
I am trying to do this project in Trailhead.
Build a Conference Management AppCreating an Apex class ,but I get this error while verification.
This is the ERROR:
There was an unexpected error in your org which is preventing this assessment check from completing: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Either the plain text body or html body must be supplied.: []
Note: you may run into errors if you've skipped previous steps.
Please can anyone help me ,
I am trying to do this project in Trailhead.
Build a Conference Management AppCreating an Apex class ,but I get this error while verification.
This is the ERROR:
There was an unexpected error in your org which is preventing this assessment check from completing: System.EmailException: SendEmail failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Either the plain text body or html body must be supplied.: []
Note: you may run into errors if you've skipped previous steps.
- Hima Bindu Moka
- October 18, 2015
- Like
- 0
- Continue reading or reply
Can you please provide me the Salesforce Integration meterials with examples.
Hi All,
Can you please provide me the Salesforce Integration meterials with examples.
Thnaks in Advance!
Can you please provide me the Salesforce Integration meterials with examples.
Thnaks in Advance!
- raz r
- October 13, 2015
- Like
- 0
- Continue reading or reply
Apex class (Email Services)
Hello,
I want to use Email service in salesforce so that when i send mail through gmail then lead gets created in salesforce i tried it its working fine but i want to send gmail in specific format then it send me exception.
Please help me to fix out this issue..
now its giving me output in this way..
First Name: vishu21
Last Name: Kashyap
Job Title: Developer
Company Name :TMC
City: Noida
Notes:testing data
url:http://www.unisteeltech.com/solutions/fasteners.html
http://www.unisteeltech.com/solutions/fasteners.html
But i want to see my output in this format.
Name
Carrie Santi DeLucchi
Email
carriesanti@gmail.com<mailto:carriesanti@gmail.com>
Job Title
Web Developer
Company Name
Peak Interactive
City
Oakland
Notes
This is a test of the 3D printing form.
Attach your files here
* whats-happening-drop-down.jpg<http://3dprinting.uct.com/wp-content/uploads/gravity_forms/1-94a0761c56774dc9cb019cf78434661e/2015/09/whats-happening-drop-down.jpg>
Means it firstly search for 'Name' which is start position and Email which is anywhere in email body as end position like wise for all others..
Please help me to fix out this issue.
I want to use Email service in salesforce so that when i send mail through gmail then lead gets created in salesforce i tried it its working fine but i want to send gmail in specific format then it send me exception.
Please help me to fix out this issue..
global class CreateTaskEmailExample implements Messaging.InboundEmailHandler { global Messaging.InboundEmailResult handleInboundEmail(Messaging.inboundEmail email,Messaging.InboundEnvelope env){ Messaging.InboundEmailResult result = new Messaging.InboundEmailResult(); Lead[] newLead = new Lead[0]; String myPlainText= ''; myPlainText = email.plainTextBody; // String firstName = email.fromname.substring(0,email.fromname.indexOf(' ')); //String lastName = email.fromname.substring(email.fromname.indexOf(' ')); //String Emailaddress = env.fromAddress; String strEmailId = email.fromAddress; system.debug('email.fromAddress'+strEmailId); String[] emailBody = email.plainTextBody.split('\n', 0); String firstName; String lastName; String jobtitle; String city; String CompanyName; String Notes; String url; String[] url2; Integer i; list<String> newlist=new list<String>(); String textBody = email.plainTextBody; String blank = ''; String nullString = null; String whitespace = ' '; //list<String> newlist=new list<String>(); //String firstName; // insert code here /* Integer index = -1; for (Integer j=0;j<emailBody[j].length;j++) { if (emailBody[j].equals(firstName)) { index = j; break; } }*/ if(emailBody.size()>0 && emailBody[0]!=null && emailBody[0]!='') { //System.assert(!String.isNotBlank(blank)); //System.assert(!String.isNotBlank(nullString)); //System.assert(!String.isNotBlank(whitespace)); firstName = emailBody[0].substring(11); system.debug('emailBody[0].substring(11)'+emailBody[0].substring(11)); } if(emailBody.size()>1 && emailBody[1]!=null && emailBody[1]!='') { lastName = emailBody[1].substring(5); system.debug('emailBody[1].substring(10)'+emailBody[1].substring(10)); } if(emailBody.size()>2 && emailBody[2]!=null && emailBody[2]!='') { /*if(textBody.indexOf('Job Title:') > -1) { Integer startPos = textBody.indexOf('Job Title:'); Integer endPos = textBody.indexOf('.',textBody.indexOf('Job Title:')); jobtitle = textBody.substring(startPos+'Job Title:'.length(),endPos); jobtitle = emailBody[2].substring(10); }*/ jobtitle = emailBody[2].substring(10); system.debug('emailBody[2].substring(10)'+emailBody[2].substring(10)); } if(emailBody.size()>3 && emailBody[3]!=null && emailBody[3]!='') { /*if(textBody.indexOf('Company Name:') > -1) { Integer startPos = textBody.indexOf('Company Name:'); Integer endPos = textBody.indexOf('.',textBody.indexOf('Company Name:')); companyName = textBody.substring(startPos+'Company Name:'.length(),endPos); CompanyName = emailBody[3].substring(10); }*/ CompanyName = emailBody[3].substring(10); system.debug('emailBody[3].substring(10)'+emailBody[3].substring(10)); } if(emailBody.size()>4 && emailBody[4]!=null && emailBody[4]!='') { /*if(textBody.indexOf('City:') > -1) { Integer startPos = textBody.indexOf('City:'); Integer endPos = textBody.indexOf('.',textBody.indexOf('City:')); city = textBody.substring(startPos+'City:'.length(),endPos); city = emailBody[4].substring(5); }*/ city = emailBody[4].substring(5); system.debug('emailBody[4].substring(5)'+emailBody[4].substring(5)); } if(emailBody.size()>5 && emailBody[5]!=null && emailBody[5]!='') { /*if(textBody.indexOf('Notes:') > -1) { Integer startPos = textBody.indexOf('Notes:'); Integer endPos = textBody.indexOf('.',textBody.indexOf('Notes:')); Notes = textBody.substring(startPos+'Notes:'.length(),endPos); Notes = emailBody[5].substring(6); }*/ Notes = emailBody[5].substring(6); system.debug('emailBody[5].substring(6)'+emailBody[5].substring(6)); } for( i=6; i<100;i++){ if(emailBody.size()==i){ system.debug(i); break; } if(emailBody[i]!=null && emailBody[i]!='') { system.debug(i); system.debug(emailBody.size()); url = emailBody[i].substring(3); system.debug('emailBody[i].substring(6)'+emailBody[i].substring(6)); //url1 = emailBody[6].substring(4); url2 = url.split('/n'); // system.debug(url); system.debug(url); system.debug(url2); newlist.add('<a href="'+url+'">'+url+'</a><br/>'); system.debug('newlist'+newlist); } } // String strSubject = email.subject; // String myText=email.plainTextBody; //String myFromName = email.fromName; Lead[] leads = [SELECT Id, Name, Email,City , Title,Company,Description FROM Lead WHERE Email = :email.fromAddress]; try{ newLead.add( new Lead( Email = strEmailId, FirstName=firstName, LastName=lastName, City =city, Title=jobtitle , Company=companyName, Description=Notes, URL__c=String.valueOf(newlist))); insert newLead; System.debug('New Lead record: ' + newLead ); } catch (System.DmlException e) { System.debug('Incoming email duplicates existing Lead record(s): ' + leads ); } result.success = true; return result; } }
now its giving me output in this way..
First Name: vishu21
Last Name: Kashyap
Job Title: Developer
Company Name :TMC
City: Noida
Notes:testing data
url:http://www.unisteeltech.com/solutions/fasteners.html
http://www.unisteeltech.com/solutions/fasteners.html
But i want to see my output in this format.
Name
Carrie Santi DeLucchi
carriesanti@gmail.com<mailto:carriesanti@gmail.com>
Job Title
Web Developer
Company Name
Peak Interactive
City
Oakland
Notes
This is a test of the 3D printing form.
Attach your files here
* whats-happening-drop-down.jpg<http://3dprinting.uct.com/wp-content/uploads/gravity_forms/1-94a0761c56774dc9cb019cf78434661e/2015/09/whats-happening-drop-down.jpg>
Means it firstly search for 'Name' which is start position and Email which is anywhere in email body as end position like wise for all others..
Please help me to fix out this issue.
- neha pandey 25
- October 13, 2015
- Like
- 0
- Continue reading or reply
Trigger to fire on Before Delete
Hi All,
I am having below trigger which calls a method "sendNotification" when the account name is changed. I want this trigger to call the method when the account is deleted ie)on before delete operation. Please help me on how this can be done.
Abraham
I am having below trigger which calls a method "sendNotification" when the account name is changed. I want this trigger to call the method when the account is deleted ie)on before delete operation. Please help me on how this can be done.
trigger Contactcallout2 on Account(after update) { List<Contact> ListContact = new List<Contact>(); Set<ID> acctIds = new set<ID>(); for(Account acct : trigger.new) { if(Trigger.oldMap.get(acct.id).Name != acct.Name){ acctIds.add(acct.Id); } } if(acctIds.size() > 0){ for(Contact con : [SELECT id,Email,FirstName,LastName,phone,Title__c,Account.Name,status__c, AccountId FROM Contact WHERE AccountId IN : acctIds AND RecordTypeid = '012D6765454BaFA']){ WebServiceCallout.sendNotification(con.Id,con.Email,con.FirstName,con.LastName,con.phone,con.Title__c,con.Account.Name,con.status__c); } } }Many Thanks in advance
Abraham
- Abraham kumar
- October 13, 2015
- Like
- 0
- Continue reading or reply
changing class in production
I'm not a developer, but I inherited a class from a prior developer that needs a minor tweak to the production code. I've made the change in the sandbox code, but can't deploy to prod because of coverage issues that were apparently not worked out by the prior developer. Based on what I've read, it appears that the best approach is to refresh the sandbox, try to increase coverage and try to deploy again. Two questions:
1) What happens when a developer sandbox is refreshed - is data deleted or is the metadata changed to match the prod environment while data is maintained?
2) Is there a way to backup the sandbox before refreshing?
Any help would be appreciated.
Thanks.
1) What happens when a developer sandbox is refreshed - is data deleted or is the metadata changed to match the prod environment while data is maintained?
2) Is there a way to backup the sandbox before refreshing?
Any help would be appreciated.
Thanks.
- Air Foxx
- October 13, 2015
- Like
- 0
- Continue reading or reply
Apex Question: Variable not visible
Hi all. Learning Apex here. Refere to code and question below:
Code:
public class myClass {
static final Integer PRIVATE_INT_CONST;
static final Integer PRIVATE_INT_CONST2 = 200;
public static Integer calculate () {
return 2 + PRIVATE_INT_CONST2;
}
static {
PRIVATE_INT_CONST = calculate ();
}
}
Trying to get this code [ see code below] to (run in Execute Anonymous and ) return what I think should be '202'. At first I tried to run this code and added System.debug (PRIVATE_INT_CONST); and the error was that only top level class variables can be declared static. [ What is a top level class? Is this just an outer classs?] So I created the class as a new class. Now that the class is created, it seems that it is reconizing it. So I simply entered System.debug(myClass.PRIVATE_INT_CONST); in the Execute Anonymous window and the error is that the variable is not visible. Can anyone help me correct the code so that it will run? What am I doing wrong? Thanks!
Code:
public class myClass {
static final Integer PRIVATE_INT_CONST;
static final Integer PRIVATE_INT_CONST2 = 200;
public static Integer calculate () {
return 2 + PRIVATE_INT_CONST2;
}
static {
PRIVATE_INT_CONST = calculate ();
}
}
Trying to get this code [ see code below] to (run in Execute Anonymous and ) return what I think should be '202'. At first I tried to run this code and added System.debug (PRIVATE_INT_CONST); and the error was that only top level class variables can be declared static. [ What is a top level class? Is this just an outer classs?] So I created the class as a new class. Now that the class is created, it seems that it is reconizing it. So I simply entered System.debug(myClass.PRIVATE_INT_CONST); in the Execute Anonymous window and the error is that the variable is not visible. Can anyone help me correct the code so that it will run? What am I doing wrong? Thanks!
- Donnie Isaac
- October 10, 2015
- Like
- 0
- Continue reading or reply
Send email every day 4 PM
Hi All,
i want to send email every day 4 pm. for that i written some code.
Please check it below code once and let me know, what i have to do.
Please explain step by step.
I appriciate your response.
Thank you.
Rakesh.S
i want to send email every day 4 pm. for that i written some code.
Please check it below code once and let me know, what i have to do.
global class scheduledEmail implements Schedulable { public static String CRON_EXP = '0 20 16 * * * *'; global static String scheduleIt() { scheduledEmail sm = new scheduledEmail(); return System.schedule('Monthly Email', CRON_EXP, sm); } global void execute(SchedulableContext SC) { sendmail(); } public void sendmail() { Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); string [] toaddress= New string[]{'sircilla.rakesh7@gmail.com'}; email.setSubject('Testing Apex Scheduler-Subject'); email.setPlainTextBody('Testing Apex Scheduler-Body'); email.setToAddresses(toaddress); Messaging.sendEmail(New Messaging.SingleEmailMessage[]{email}); } }
Please explain step by step.
I appriciate your response.
Thank you.
Rakesh.S
- Rakesh S
- October 10, 2015
- Like
- 0
- Continue reading or reply
Using hidden fields in APEX query
Hi
I need to have a dynamic query to retrieve the fields in Campaign object (keeping aside the governace limit) but when i execute a sample query with all the fields in query editor I see an error "No such column 'hierarchyactualcost' on entity 'Campaign'."
when i set this field as visible for profile and then execute the query i do not see this error. Any ways on how to fix this so that i can perform the query without any errors?
the code to get the fields from the object is:
Map <String, Schema.SObjectField> objectFields = Campaign.getSobjectType().getDescribe().fields.getMap();
for (SObjectField fld : objectFields.values()) {
query += ' ' + fld + ', ';
}
is there a way to see if the field is set as not visible and if so then do not consider the field in the query?
I need to have a dynamic query to retrieve the fields in Campaign object (keeping aside the governace limit) but when i execute a sample query with all the fields in query editor I see an error "No such column 'hierarchyactualcost' on entity 'Campaign'."
when i set this field as visible for profile and then execute the query i do not see this error. Any ways on how to fix this so that i can perform the query without any errors?
the code to get the fields from the object is:
Map <String, Schema.SObjectField> objectFields = Campaign.getSobjectType().getDescribe().fields.getMap();
for (SObjectField fld : objectFields.values()) {
query += ' ' + fld + ', ';
}
is there a way to see if the field is set as not visible and if so then do not consider the field in the query?
- PS81
- October 07, 2015
- Like
- 0
- Continue reading or reply