-
ChatterFeed
-
4Best Answers
-
3Likes Received
-
0Likes Given
-
89Questions
-
117Replies
Sum of related list field value(Urgent)
I have a custom object Opportunity Service Line Item which has lookup relation to opportunity.
I have a field in Opportunity Service Line Item called 'TCV'.
Each Opportunity Line Item can have multiple Service Line Items.
I want to write a trigger to calculate the sum of TCV for all the Service Line Items and update in Opportunity Object.
Can anyone please provide a sample trigger for this.
Thanks,
Ipsita
- imishra
- April 25, 2014
- Like
- 0
- Continue reading or reply
Trigger to update a different custom object
trigger Trigger_Name on CustomObject__c (after insert) { List<CustomObject__c> emailList = [select id from CustomObject__c where ID in :trigger.newMap.keyset()]; List<OtherCustomObject__c> recordsToUpdate = new List<OtherCustomObject__c>{}; for(CustomObject__c e: emailList){ for(OtherCustomObject__c le : e.letter__r.id ){ le.emailed__c=true; le.date_emailed__c = datetime.now(); lettersToUpdate.add(le); } update lettersToUpdate; } }
Hello - I would like to update a field in one object based on the creation of a record in aother object.
I get this error when I try to save:
Save error: Loop must iterate over a collection type: Id
Help?
- Soozee
- March 29, 2012
- Like
- 0
- Continue reading or reply
Code Coverage for Test of Controller Extension
Hi all!
Relatively new to Apex but I have the controller extension below:
public class ControllerExt { ApexPages.StandardController stdCtrl; public ControllerExt(ApexPages.StandardController std) { stdCtrl=std; } public PageReference save() { stdCtrl.save(); return null; } }
And I have been, unsuccesfully, trying to write the test code for it. My current attempt is below (saves and runs with no errors), but the code coverage is 0...any suggestions?
@isTest public class ControllerExtTest { static testMethod void myPage_Test() { PageReference pageRef = Page.TypeA; Test.setCurrentPage(pageRef); Account acc1 = new Account (Name = 'Account 1', Type = 'Type A'); insert acc1; Opportunity opp1 = new Opportunity(Name = 'Opportunity1', AccountID = acc1.id, Probability = 20.00, CloseDate = Date.newInstance(System.now().year(),10,10), StageName = 'Prospect'); insert opp1; ApexPages.StandardController sc = new ApexPages.standardController(opp1); String nextPage = sc.save().getUrl(); String str1 = string.valueof (opp1.Id).substring (0, 15); System.assertEquals('/'+str1, nextPage); } }
- girbot56
- March 29, 2012
- Like
- 0
- Continue reading or reply
Lookup field value shows as ID Number instead of text
Hello,
I am using the below email template to send an email to the primary contact of an opportunity once the opportunity has reached a certain stage. I added a contact lookup field to the Opportunity object so that the contact could be shown. The trouble is that when the email is sent, it doesn't send the contacts name rather the id
<messaging:emailTemplate subject="Equipment Order Confirmation" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >
<html>
<body>
<STYLE type="text/css">
TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center }
TD {font-size: 11px; font-face: verdana }
TABLE {border: solid #CCCCCC; border-width: 1}
TR {border: solid #CCCCCC; border-width: 1}
</STYLE>
<font face="arial" size="2">
<p>Dear {! Relatedto.Contact__c},</p>
<p>The following is a confirmation of your equipment order:</p>
<p/>
<p>Pickup Date: {! RelatedTo.Pick_Up_Date__c}</p>
<p>Return Date: {! RelatedTo.Return_Date__c}</p>
<p/>
<p>Pickup Location: {! RelatedTo.Pick_Up_Location__c}</p>
<table border="0" >
<tr >
<th>Item</th><th>Quantity</th>
</tr>
<apex:repeat var="cx" value="{!relatedTo.OpportunityLineItems}">
<tr>
<td>{!cx.pricebookentry.Product2.name}</td>
<td>{!cx.Quantity}</td>
</tr>
</apex:repeat>
</table>
</font>
</body>
</html>
</messaging:htmlEmailBody>
Here is an example of what was sent:
Dear 003C000001IDKYcIAP,
The following is a confirmation of your equipment order:
Pickup Date: Fri Feb 24 00:00:00 GMT 2012
Return Date: Tue Feb 28 00:00:00 GMT 2012
Pickup Location:
Item | Quantity |
AED Trainer (Generic) | 1.0 |
Kyle Manikin | 5.0 |
Bandage & CPR Training Kit | 10.0 |
Adult Annie Manikin | 5.0 |
- Nick G.
- February 16, 2012
- Like
- 0
- Continue reading or reply
Question on Live Agent
- New_Developer
- May 20, 2016
- Like
- 0
- Continue reading or reply
Help with hover on an image on visualforce page
Here is my code
<apex:repeat value="{!dpgEnrollmentGuidelines}" var="dpGuideline" >
<tr>
<td class= "changecolor">
<apex:outputText value="{!dpGuideline.Required_for__c}"/>
</td>
<td onclick="navigateToElement('{!dpGuideline.Id}');">
<apex:outputText value="{!dpGuideline.Display_Name__c}"/>
<apex:repeat value="{!dpGuideline.Acceptable_Documents__r}" var="accdoc" >
<apex:outputText value = "{!accdoc.Acceptable_doc__Name__c}"
</apex:repeat>
</td>
</apex:repeat>
Thanks
- New_Developer
- April 01, 2016
- Like
- 0
- Continue reading or reply
Using document.getElementById
var code = document.getElementById('pageid:codeid:codeparent:1:codechild:0:codeinnerchild:2:thecode').value;
the part where it says codeparent:1, what does that :1 mean?? those values after colon are changing based on the fields diaplyed on the vf page .How can i get the value irrespective of the fields displayed on the vf page??
Thanks
- New_Developer
- March 21, 2016
- Like
- 0
- Continue reading or reply
Sending attachments to external system
Thanks for the help in advnace.
- New_Developer
- October 29, 2015
- Like
- 0
- Continue reading or reply
Email alert with Articles attached using Apex
Thanks
- New_Developer
- May 08, 2015
- Like
- 0
- Continue reading or reply
Cookie handling on the force.com site vf page
- New_Developer
- January 16, 2015
- Like
- 0
- Continue reading or reply
How to capture a hidden field on the webpage which is redirected to the force.com site
What iam trying to acheive here is the affiliated tracking. we have different affiliates and there is button on each of their websites which will redirect to a force.com site visualforce page of our company. They all have a input hidden filed which stores the affiliate code. I need to be able to capture that code when its redirected to the force.com site and store it on a field in salesforce. What is the best way to acheive it. Any help is greatly appreciated.
Thanks
- New_Developer
- January 12, 2015
- Like
- 0
- Continue reading or reply
Help with Apex Scheduler
Iam trying to schedule a apex job that runs for every 30 mins from 6PM to 11 PM. Here is the scheduler iam trying to use
ScheduledClass obj= new ScheduledClass();
String sch = '0 0,30 18,19,20,21,22,23 ? * MON-FRI';
System.schedule('My Job', sch, obj);
But iam getting the below error
System.StringException: Seconds and minutes must be specified as integers: 0 15,30,45 18,19,20,21,22,23 ? * MON-FRI
Is there any way we could scehdule a job which could run for every 30 mins starting from 6 PM and ending at 11.30 PM??
Thanks
- New_Developer
- September 29, 2014
- Like
- 0
- Continue reading or reply
Apex heap size too large:
I have a batch class which runs and attached like hundreds of text files to the Document object and i have a vf page and controller to get all the data in that documents into one big text file. The size of the file would be around 9MB. But iam getting the Apex heap sze too large error. Is it possible to generate a 9 MB text file from a vf page??
Here is my code
<apex:page standardController="Child__c" extensions="DocumentController" contentType="text/plain/#testfile" cache="false" >
<apex:repeat value="{!lstStringOutput}" var="str">
{!str}
</apex:repeat>
</apex:page>
Conrtoller:
public with sharing class DocumentController {
public List<String> lstStringOutput {get;set;}
Public Static String text;
public DocumentController(ApexPages.StandardController controller) {
lstStringOutput = new List<String>();
Folder folder = [select id from Folder where name='Test file' LIMIT 1];
for(Document doc : [Select id, Description , Body , folderId from Document where folderId = :folder.id ]){
text= doc.Body.toString();
lstStringOutput.add(text+'\r');
}
}
}
Thanks
- New_Developer
- May 20, 2014
- Like
- 1
- Continue reading or reply
Test coverage for a trigger
here is my trigger on Opportunity
Map<String, Integer> classificationTypePriorities = new Map<String, Integer>{
'Sustainer' => 1,
'Donor' => 2,
'Fundraiser' => 3,
'Buyer' => 4,
'Activist' => 5,
'Volunteer' => 6,
'Prospect' => 7,
'Lead' => 8
};
Map<String, Id> classificationTypes = new Map<String, Id>();
for (cv__Engagement_Channel__c c : [SELECT Id, Name FROM cv__Engagement_Channel__c WHERE Name IN :classificationTypePriorities.keySet()]) {
classificationTypes.put(c.Name, c.Id);
}
for(Opportunity opp : trigger.new){
if(opp.RecordTypeId == rd.Id && opp.cv__Contact__r.cv__Primary_Engagement_Channel__r.id ==classificationTypes.get('Prospect')&& (opp.Child_ID__c == null || opp.Child_ID__c == ''))
conids.add(opp.cv__Contact__c);
}
and the test clas is
static testMethod void testAssignmentType()
{
List<cv__Engagement_Channel__c> classificationTypesList = new List<cv__Engagement_Channel__c>{
new cv__Engagement_Channel__c(Name = 'Sustainer'),
new cv__Engagement_Channel__c(Name = 'Donor'),
new cv__Engagement_Channel__c(Name = 'Fundraiser'),
new cv__Engagement_Channel__c(Name = 'Buyer'),
new cv__Engagement_Channel__c(Name = 'Activist'),
new cv__Engagement_Channel__c(Name = 'Volunteer'),
new cv__Engagement_Channel__c(Name = 'Prospect'),
new cv__Engagement_Channel__c(Name = 'Lead')
};
insert classificationTypesList;
Map<String , Id> classificationTypes = new Map<String, Id>();
for (cv__Engagement_Channel__c ct : classificationTypesList) {
classificationTypes.put(ct.Name, ct.Id);
}
List<RecordType> rt = [Select Id From RecordType Where Name = 'Household' and SobjectType = 'Account'];
Account a = new Account();
a.recordtypeId = rt[0].Id;
a.Name = 'Test';
insert a;
Contact c = new Contact();
c.lastName='testing';
c.Client_Id__c = '42412';
c.AccountId = a.Id;
c.cv__Primary_Engagement_Channel__c = classificationTypes.get('Prospect');
c.cv__Addressee__c = 'Mr.xyz';
insert c;
RecordType rd = [SELECT Id FROM RecordType WHERE SObjectType = 'Opportunity' AND Name = 'Recurring Donation'];
Opportunity opp = new Opportunity();
opp.RecordTypeId = rd.Id;
opp.cv__Recurring_Gift__c = rg.id;
opp.Name = 'Test Opp';
opp.AccountId = a.id;
opp.cv__Contact__c = c.id;
opp.CampaignId = cn.id;
opp.Amount = 30;
opp.CloseDate = Date.today();
opp.StageName = 'Received';
opp.cv__Payment_Type__c = 'Check';
insert opp;
System.debug('primary classification'+opp.cv__Contact__r.cv__Primary_Engagement_Channel__c) ;
Not sure whats going on but the debug logs shows opp.cv__Contact__r.cv__Primary_Engagement_Channel__c as null . Any help is appreciated
- New_Developer
- May 02, 2014
- Like
- 0
- Continue reading or reply
Workaround for Webservices with Soap12 binding
I have to implement webservices(consuming ws) for a new requirement and the wsdl file which the webservice provider has given me has only soap12 binding and salesforce doesn't support it. Is there any workaround for this. Is there any other way of implementing this? I have been google seraching it form days and couldn't find anything . Any help is greatly appreciated.
Thanks
- New_Developer
- April 25, 2014
- Like
- 0
- Continue reading or reply
Error with POST request
Iam trying to implement webservices where i need to post the data from salesforce to external syatem and i wrote an apex class with POST request and i get the below error
The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree".
What does the error mean??
Thanks. Any help is appreciated.
- New_Developer
- April 14, 2014
- Like
- 0
- Continue reading or reply
Help with POST request
Iam trying to use http POST request to enter data from salesforce to external system. My WSDl file contans below soapAction
-<wsdl:operation name="AddCustomerData">
<soap12:operation style="document" soapAction="http://xxxx.org/WebServices/AddCustomerData"/>
Salesforce doesnot support SOAP 1.2 , so does that mean i cannot use the webservices for POSt operation too? The WSDL file i got only has SOAP12 operations. How can make it work so that i can use webservices to POST and GET data.
Thanks
- New_Developer
- April 07, 2014
- Like
- 0
- Continue reading or reply
Help with POST method in Webservices
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://testurl');
req.setMethod('POST');
String username = 'test';
String password = 'test';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
req.setTimeout(100000);
req.setHeader('Content-Type', 'application/soap+xml; charset=utf-8');
req.setCompressed(false);
req.setBody('Customer= 500269677900& Name=TestCallout');
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
}
Thanks
- New_Developer
- April 03, 2014
- Like
- 0
- Continue reading or reply
Using Webservices to send data to external system
I have a requirement where i need to send a data upon creation to an external hub using Webservices. I mean when a record in a custom object is created , the data in the fields should also get stored in the external system. Any ideas on how do this is really appreciated.
Thanks
- New_Developer
- March 24, 2014
- Like
- 0
- Continue reading or reply
Help with a button code
if the two fields are same like there is number field and a picklist field. For ex if there are three duplicate records with 1234 as number and picklist value as test dupes then i need to update a checkbox field as true on those three records.
Any help is appreciated.
Thanks
- New_Developer
- March 03, 2014
- Like
- 0
- Continue reading or reply
Displaying validation rule error message
Hi,
I have an after update trigger and iam getting the below error
System.DmlException: Update failed. First exception on row 0 with id a0zc0000001JnZLAA0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, You are above your limit to select "Pay All" Action: []: Trigger.updateAlertItems: line 47, column 1
How can i get only the red highlighted error message which is a validation rule error message instead of that whole trigger FIELD_CUSTOM_VALIDATION_EXCEPTION error
Below is the trigger
trigger updateAlertItems on Alerts__c (after update) {
Set<ID> ids = Trigger.newMap.keySet();
List<Alerts__c> updatedParents = [SELECT Id, Calculated_Balance__c ,
(SELECT Id, Action__c , Pay_Validation_Rule_Check_1__c , Pay_Validation_Rule_Check_2__c , Pay_Validation_Rule_Check_3__c
from Alert_Items__r ) FROM Alerts__c
WHERE Id in :ids];
List<Alert_Items__c> childrenToUpdate = new List<Alert_Items__c>();
for ( Alerts__c p : updatedParents)
{
if(trigger.oldMap.get(p.id).Action__c!= p.Action__c)
{
system.debug('Enter here 1');
for(Alert_Items__c kid : p.Alert_Items__r)
{
if(p.Action__c == 'Pay All')
{
System.debug('Enter here 2');
kid .Action__c= 'Pay';
}
if(p.Action__c == 'Return All')
{
kid .Action__c= 'Return';
}
childrenToUpdate.add(kid);
}
}
}
if( !childrenToUpdate.isEmpty())
{
System.debug('Enter here 3');
update childrenToUpdate;
}
}
Thanks
- New_Developer
- November 01, 2013
- Like
- 0
- Continue reading or reply
Error: Too many code statements: 200001
Hi All,
Iam getting the error of too many code statements for my below class. I know its because of the for loops which iterates 40 times and each statement is counted against code statement. But iam not sure of what the workaround would be to overcome this error.
global class OCrLine1 implements Schedulable{
global void execute(SchedulableContext SC) {
Set<Id> ids = new Set<Id>();
Map<Id , String> ocrMap = new Map<Id , String>();
Integer ifactor= 2;
Integer iResult;
Integer iSum = 0;
Integer i;
String total;
List<Contact> contacts = new List<Contact>();
List<Contact> cons = [Select id ,Total_Due__c, OCR_Check_Digit__c,OCR_ClientID__c,Billing_Cycle__c ,PayNotIfType__c from Contact where Billing_Cycle__c = '1' AND PayNotIfType__c = 'Statement' AND Number_Of_Sponsored_Children__c!=0];
List<cv__Recurring_Gift_Designation_Relationship__c> rdg = [Select id , cv__Recurring_Gift__r.cv__Contact__c ,cv__Recurring_Gift__r.cv__Recurring_Gift_Status__c, cv__Designation__r.Name from cv__Recurring_Gift_Designation_Relationship__c
where cv__Designation__r.Name != 'Child Sponsorship' AND cv__Recurring_Gift__r.cv__Recurring_Gift_Status__c = 'Active' ];
for(Contact c : cons)
{
ids.add(c.id);
}
for(cv__Recurring_Gift_Designation_Relationship__c rr : rdg)
{
ids.add(rr.cv__Recurring_Gift__r.cv__Contact__c);
}
Map<Id, Double> ChildBalance = new Map<Id,Double>();
for(AggregateResult groupedResults:[SELECT sum(Total_Amount_Due__c) Due , cv__Contact__c from cv__Recurring_Gift__c Where cv__Recurring_Gift_Status__c='Active'
AND cv__Payment_Type__c = 'Check'AND cv__Next_Payment_date__c <= THIS_MONTH AND cv__Contact__c IN :ids Group By cv__Contact__c ]){
ChildBalance.put((String)groupedResults.get('cv__Contact__c'),(Double)groupedResults.get('Due'));
}
for(Contact c : cons){
if(ChildBalance.get(c.id)!=null)
c.Total_Due__c = ChildBalance.get(c.id);
else
c.Total_Due__c = 0;
if(c.Total_Due__c==0)
total = '000000';
else
total = String.valueOf(c.Total_Due__c);
if(total.contains('.'))
total = total.remove('.');
if(total.length()==3)
total = '00'+total+'0';
if(total.Length()==4)
total = '0'+total+'0';
if(total.length()==5)
total = total+'0';
else
total = total;
ocrMap.put(c.id , c.OCR_ClientID__c+'01000000000000000000000000'+total);
for(i=0; i<=40 ; i++){
if(i<40)
iResult = Integer.valueOf(ocrMap.get(c.id).SubString(i,i+1))* iFactor;
if(i==40)
iResult = Integer.valueOf(ocrMap.get(c.id).right(1))* iFactor;
if(iResult>9){
iResult = Integer.valueOf(String.valueOf(iResult).SubString(1,2)) + Integer.valueOf(String.valueOf(iResult).right(1));
}
iSum = iSum+iResult;
if(iFactor == 1)
iFactor = 2;
else
iFactor = 1;
}
iResult = math.mod(iSum,10);
if(iResult == 0)
c.OCR_Check_Digit__c = '0';
else
c.OCR_Check_Digit__c = String.valueOf(10-iResult);
contacts.add(c);
}
if(contacts.size()>0)
update contacts;
}
}
Any help is greatly appreciated.
Thanks
- New_Developer
- July 19, 2013
- Like
- 0
- Continue reading or reply
Need help with simple class
Hi,
Iam trying to execute a simple code . Its supposed to show the output as 3 but its throwing error at the for loop. Not sure whats wrong. Here is the below code
Integer ifactor= 2;
Integer iResult;
Integer iSum = 0;
Integer i;
String OCR_Line = '0000000401000000000000000000000000002800';
Integer OCR_Check_Digit;
for(i=0; i<=40 ; i++){
iResult = Integer.valueOf(OCR_Line.SubString(i,1))* iFactor;
if(iResult>9){
iResult = Integer.valueOf(String.valueOf(iResult).SubString(1,1)) + Integer.valueOf(String.valueOf(iResult).SubString(2,1));
}
iSum = iSum+iResult;
if(iFactor == 1)
iFactor = 2;
else
iFactor = 1;
}
iResult = math.mod(iSum,10);
if(iResult == 0)
OCR_Check_Digit = 0;
else
OCR_Check_Digit = 10-iResult;
The OCR_Check_Digit should show the output as 3.
- New_Developer
- July 17, 2013
- Like
- 0
- Continue reading or reply
help with a Report
Is there any way in the Report we can get only the latest opportunity associated to an Account? and anothet report with largest opportunity Amount ?
Thanks
- New_Developer
- June 20, 2013
- Like
- 0
- Continue reading or reply
Apex heap size too large:
I have a batch class which runs and attached like hundreds of text files to the Document object and i have a vf page and controller to get all the data in that documents into one big text file. The size of the file would be around 9MB. But iam getting the Apex heap sze too large error. Is it possible to generate a 9 MB text file from a vf page??
Here is my code
<apex:page standardController="Child__c" extensions="DocumentController" contentType="text/plain/#testfile" cache="false" >
<apex:repeat value="{!lstStringOutput}" var="str">
{!str}
</apex:repeat>
</apex:page>
Conrtoller:
public with sharing class DocumentController {
public List<String> lstStringOutput {get;set;}
Public Static String text;
public DocumentController(ApexPages.StandardController controller) {
lstStringOutput = new List<String>();
Folder folder = [select id from Folder where name='Test file' LIMIT 1];
for(Document doc : [Select id, Description , Body , folderId from Document where folderId = :folder.id ]){
text= doc.Body.toString();
lstStringOutput.add(text+'\r');
}
}
}
Thanks
- New_Developer
- May 20, 2014
- Like
- 1
- Continue reading or reply
OCR(Optical Character Recognition)
Hi All,
Iam new to this OCR(Optical Character recognition). Right now we have a requirement to integrate OCR with Salesforce. Is there any APP out there which can do this?
Thanks
- New_Developer
- January 14, 2013
- Like
- 2
- Continue reading or reply
How to capture a hidden field on the webpage which is redirected to the force.com site
What iam trying to acheive here is the affiliated tracking. we have different affiliates and there is button on each of their websites which will redirect to a force.com site visualforce page of our company. They all have a input hidden filed which stores the affiliate code. I need to be able to capture that code when its redirected to the force.com site and store it on a field in salesforce. What is the best way to acheive it. Any help is greatly appreciated.
Thanks
- New_Developer
- January 12, 2015
- Like
- 0
- Continue reading or reply
Help with Apex Scheduler
Iam trying to schedule a apex job that runs for every 30 mins from 6PM to 11 PM. Here is the scheduler iam trying to use
ScheduledClass obj= new ScheduledClass();
String sch = '0 0,30 18,19,20,21,22,23 ? * MON-FRI';
System.schedule('My Job', sch, obj);
But iam getting the below error
System.StringException: Seconds and minutes must be specified as integers: 0 15,30,45 18,19,20,21,22,23 ? * MON-FRI
Is there any way we could scehdule a job which could run for every 30 mins starting from 6 PM and ending at 11.30 PM??
Thanks
- New_Developer
- September 29, 2014
- Like
- 0
- Continue reading or reply
Contains not working will only show on blank value
IF(ISPICKVAL( Site__r.Support_Package__c , "Support") && CONTAINS("Support", Product__r.Name), "Match",
IF(ISPICKVAL( Site__r.Support_Package__c , "Enhanced") && CONTAINS("Enhanced", Product__r.Name), "Match",
IF(ISPICKVAL( Site__r.Support_Package__c , "Premium") && CONTAINS("Premium", Product__r.Name), "Match", "Different")))
Thanks.....
- impalacrazy69
- May 22, 2014
- Like
- 0
- Continue reading or reply
Apex heap size too large:
I have a batch class which runs and attached like hundreds of text files to the Document object and i have a vf page and controller to get all the data in that documents into one big text file. The size of the file would be around 9MB. But iam getting the Apex heap sze too large error. Is it possible to generate a 9 MB text file from a vf page??
Here is my code
<apex:page standardController="Child__c" extensions="DocumentController" contentType="text/plain/#testfile" cache="false" >
<apex:repeat value="{!lstStringOutput}" var="str">
{!str}
</apex:repeat>
</apex:page>
Conrtoller:
public with sharing class DocumentController {
public List<String> lstStringOutput {get;set;}
Public Static String text;
public DocumentController(ApexPages.StandardController controller) {
lstStringOutput = new List<String>();
Folder folder = [select id from Folder where name='Test file' LIMIT 1];
for(Document doc : [Select id, Description , Body , folderId from Document where folderId = :folder.id ]){
text= doc.Body.toString();
lstStringOutput.add(text+'\r');
}
}
}
Thanks
- New_Developer
- May 20, 2014
- Like
- 1
- Continue reading or reply
Update Formula with condition needed .
Is it possible to create above working formula for updating my custom field?
Thank you for any help
- Lukasz Piziak
- April 28, 2014
- Like
- 0
- Continue reading or reply
Sum of related list field value(Urgent)
I have a custom object Opportunity Service Line Item which has lookup relation to opportunity.
I have a field in Opportunity Service Line Item called 'TCV'.
Each Opportunity Line Item can have multiple Service Line Items.
I want to write a trigger to calculate the sum of TCV for all the Service Line Items and update in Opportunity Object.
Can anyone please provide a sample trigger for this.
Thanks,
Ipsita
- imishra
- April 25, 2014
- Like
- 0
- Continue reading or reply
Apex Trigger on Parent update child
I am getting the below error
Error: Compile Error: Invalid field Status__c for SObject ADR__c at line 28 column 1
trigger ADRParentUpdateChild on ADR__c ( after update, after insert) {
List<ADR__c > ParentRecords= [Select id, Next_Step__c, (Select ADR__c, Status__c FROM ADRUser__r) from ADR__c WHERE id IN :Trigger.newMap.keySet()];
for(ADR__c parent: ParentRecords){
if(parent.Next_Step__c == 'Submit'){
parent.Status__c = 'Submit';
}
}
}
- Bryan Revelant 7
- April 25, 2014
- Like
- 0
- Continue reading or reply
Error with POST request
Iam trying to implement webservices where i need to post the data from salesforce to external syatem and i wrote an apex class with POST request and i get the below error
The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree".
What does the error mean??
Thanks. Any help is appreciated.
- New_Developer
- April 14, 2014
- Like
- 0
- Continue reading or reply
Sending multiple attachments using BULK API
I want to send multiple attachments to salesforce using Bulk API.
please tell me what should be the endpoint in this case,what should be my CSV format ,what all headers I'll be including and other stuff if you know which could help me
Thanks in advance!!
- govindb1.396432156444516E12
- April 14, 2014
- Like
- 0
- Continue reading or reply
Help with POST request
Iam trying to use http POST request to enter data from salesforce to external system. My WSDl file contans below soapAction
-<wsdl:operation name="AddCustomerData">
<soap12:operation style="document" soapAction="http://xxxx.org/WebServices/AddCustomerData"/>
Salesforce doesnot support SOAP 1.2 , so does that mean i cannot use the webservices for POSt operation too? The WSDL file i got only has SOAP12 operations. How can make it work so that i can use webservices to POST and GET data.
Thanks
- New_Developer
- April 07, 2014
- Like
- 0
- Continue reading or reply
Help with POST method in Webservices
HttpRequest req = new HttpRequest();
HttpResponse res = new HttpResponse();
Http http = new Http();
req.setEndpoint('https://testurl');
req.setMethod('POST');
String username = 'test';
String password = 'test';
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
req.setTimeout(100000);
req.setHeader('Content-Type', 'application/soap+xml; charset=utf-8');
req.setCompressed(false);
req.setBody('Customer= 500269677900& Name=TestCallout');
try {
res = http.send(req);
} catch(System.CalloutException e) {
System.debug('Callout error: '+ e);
}
Thanks
- New_Developer
- April 03, 2014
- Like
- 0
- Continue reading or reply
Using Webservices to send data to external system
I have a requirement where i need to send a data upon creation to an external hub using Webservices. I mean when a record in a custom object is created , the data in the fields should also get stored in the external system. Any ideas on how do this is really appreciated.
Thanks
- New_Developer
- March 24, 2014
- Like
- 0
- Continue reading or reply