-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
36Questions
-
27Replies
Test class for Apex class generated from WSDL.
Hi, I have a WSDL generated Apex class which i am using to perform apex callouts. I did not realize it requires a test class When i am trying to deploy my code to production my code percentage was screwed due to this WSDL Apex class which is huge. It has code which is out of my understanding as it is automatically generated by salesfroce. How would i able to write the test class, is there a way to by pass this. Any suggestions would be greatly appreciative. Thank you,
- Brad007
- January 12, 2012
- Like
- 0
Apex Scheduler test class
- Brad007
- December 28, 2011
- Like
- 0
System.DmlException: Upsert failed. First exception on row 0
Hi ,
System.DmlException: Upsert failed. First exception on row 0 with id a1WV00000001HBKMA2; first error: MISSING_ARGUMENT, External_ID__c not specified: []
I have my upsert opration failing. Can any one please suggest whats wrong in the below code and how help fix the code.
public with sharing class APImageUpdatesGlobal {
public void APFilesMissingGlobal()
{
string ServiceResult = '';
System.debug('Entered!');
// Create list for Available Aupairs
List<AP_Application__c> APFiles = [Select a.Photo4__c, a.Photo3__c, a.Photo2__c, a.Photo1__c, a.Id, a.External_ID_Photo4__c, a.External_ID_Photo3__c, a.External_ID_Photo2__c, a.External_ID_Photo1__c, a.Au_Pair__c From AP_Application__c a where a.Au_Pair__r.AP_Status__c ='Available' AND a.Au_Pair__r.Record_Type_Name__c= 'Au Pair'];
string XmlString = '<FilesData>';
for(AP_Application__c APFile: APFiles)
{
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo1__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo1__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo2__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo2__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo3__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo3__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo4__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo4__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
}
//Close root Xml
XmlString += '</FilesData>';
GAPOrg.AjaxSoap Servicestub = new GAPOrg.AjaxSoap();
ServiceResult = Servicestub.GAPAPFilesGlobalRun(XmlString);
Dom.Document docx = new Dom.Document();
docx.load(ServiceResult);
Dom.Xmlnode root = docx.getRootElement();
List<Files__c> upsertfiles = new List<Files__c>();
for(Dom.Xmlnode child : root.getChildElements()) {
Files__c file = null;
for(Dom.Xmlnode node : child.getChildElements()) {
if(node.getName() == 'External_ID') {
string str = node.getText();
if( str != ''){
file = new Files__c(); file = [Select f.Path__c, f.Inactive_Date__c, f.Id, f.External_ID__c, f.Contact__c, f.AP_Application__c From Files__c f where f.External_ID__c =: node.gettext() limit 1 ];
}
}
else if(node.getName() == 'Inactive_Dt')
{
if(file != null) {
if(node.getText() != ' ')
{
String[] stringDate = node.gettext().split('/');
Integer m = Integer.valueOf(stringDate[0]);
Integer d = Integer.valueOf(stringDate[1]);
Integer y = Integer.valueOf(stringDate[2]);
file.Inactive_Date__c = date.newinstance(y,m,d);
}
}
}
}
if (file == null) {
for(Dom.Xmlnode node : child.getChildElements())
{
string str = node.getName();
file = new Files__c();
if(str == 'ApplicationId')
{ file.AP_Application__c = node.gettext(); }
else if(str == 'APID')
{ file.Contact__c = node.gettext(); }
else if(str == 'Path')
{ file.Path__c = node.gettext(); }
else if(str == 'Inactive_Dt')
{
if(str != ' ')
{
String[] stringDate = node.gettext().split('/');
Integer m = Integer.valueOf(stringDate[0]);
Integer d = Integer.valueOf(stringDate[1]);
Integer y = Integer.valueOf(stringDate[2]);
file.Inactive_Date__c = date.newinstance(y,m,d);
}
}
}
}
upsertfiles.add(file);
file =null;
}
try { upsert upsertfiles External_ID__c; }
catch (DmlException e) {
System.debug(e.getMessage());
}
}
}
- Brad007
- November 21, 2011
- Like
- 0
Upsert Operation
Hi I am doing a Apex callout and i need to get the Xml string data Map it and Upsert my Object. But i am confused here as with the Xml string data i have. this is what i would get after my call out.
<APFilesData><APFiles1><ApplicationId>a0B40000000vBJrEAM</ApplicationId><APID>0034000000SiXLtAAN</APID><Photo1>//Bait/Applications/AP Applications/AP0802720.Song/Photos/Photo1.jpg</Photo1><External_ID_Photo1>Test</External_ID_Photo1><InactivePhoto1_Dt>11/08/2011</InactivePhoto1_Dt></APFiles1><APFiles2><ApplicationId>a0B40000000vBJrEAM</ApplicationId><APID>0034000000SiXLtAAN</APID><Photo2>//Bait/Applications/AP Applications/AP0802720.Song/Photos/Photo2.jpg</Photo2><External_ID_Photo2>null</External_ID_Photo2><InactivePhoto2_Dt></InactivePhoto2_Dt></APFiles2><APFiles3><ApplicationId>a0B40000000vBJrEAM</ApplicationId><APID>0034000000SiXLtAAN</APID><Photo3>//Bait/Applications/AP Applications/AP0802720.Song/Photos/Photo3.jpg</Photo3><External_ID_Photo3>null</External_ID_Photo3><InactivePhoto3_Dt></InactivePhoto3_Dt></APFiles3><APFiles4><ApplicationId>a0B40000000vBJrEAM</ApplicationId><APID>0034000000SiXLtAAN</APID><Photo4>//Bait/Applications/AP Applications/AP0802720.Song/Photos/Photo4.jpg</Photo4><External_ID_Photo4>null</External_ID_Photo4><InactivePhoto4_Dt></InactivePhoto4_Dt></APFiles4><APFilesData>
So now i have a files object which has a External_Id__c field which should be mapped to the above external Ids. and then if i have a Inactive date populated in my xml i update or i insert new row into files with 4 values.
Dom.Document docx = new Dom.Document();
docx.load(ServiceResult);
Dom.Xmlnode xroot = docx.getRootElement();
Dom.Xmlnode [] xrec = xroot.getChildElements();
Files__c[] upsertfiles = new Files__c[]{};
List<AP_Application__c> upsertApplications = new List<AP_Application__c>();
for(Dom.Xmlnode child : xrec)
{
Files__c file = new Files__c();
for(Dom.Xmlnode node : child.getchildren())
{// What should go here to have my upsert }
upsertfiles.add(file);
system.debug('Result:' +upsertfiles);
try {
upsert upsertfiles External_ID__c; }
catch (DmlException e)
{ System.debug(e.getMessage()); } }
For each photo file, create one row to be inserted into Files__c in SFDC. Need the following columns: | |
Files__c | From |
Contact__c | AP_Application__c.Au_Pair__c |
AP_Application__c | AP_Application__c |
Path__c | AP_Application__c.Photo1__c |
External_ID__c | AP_Application__c. ExernalIdPhoto1 |
Inactive_Date__c | New column you create |
UPSERT Files Use External Id to match Files__c. ExternalId Files__c. AP_Application__c = Application id Files__c.Contact__c = Contact id Files__c.Path__c = Path Files__c.Inactive_Dt__c |
- Brad007
- November 09, 2011
- Like
- 0
Upsert Operation for XMl string
Hi, I am performing a Apex callout and am retreving data as a xml string. Now i would want to have my data used for Upsert Operation on Files__c Object.Below is how my xml
<APFilesData>
<APFiles>
<ApplicationId>a0B40000000vBJrEAM</ApplicationId>
<APID>0034000000SiXLtAAN</APID> <Photo1>//Bait/Applications/APApplications/AP0802720.Song/Photos/Photo1.jpg</Photo1>
<Photo2>//Bait/Applications/APApplications/AP0802720.Song/Photos/Photo2.jpg</Photo2>
<External_ID_Photo1>null</External_ID_Photo1>
<External_ID_Photo2>null</External_ID_Photo2>
<InactivePhoto1_Dt>11/10/2011 </InactivePhoto1_Dt>
<InactivePhoto2_Dt></InactivePhoto2_Dt>
</APFiles>
</APFilesData>
Below is how am retriving values
System.debug('BharathXML:' +XmlString);
GAPOrg.AjaxSoap Servicestub = new GAPOrg.AjaxSoap();
ServiceResult = Servicestub.GAPAPFilesGlobalRun(XmlString);
System.debug('XmlResult:' +ServiceResult);
Files__c upsertfiles = new Files__c();
Dom.Document docx = new Dom.Document();
docx.load(ServiceResult);
Dom.Xmlnode xroot = docx.getRootElement();
Dom.Xmlnode [] xrec = xroot.getChildElements();
And the values that need to upserted for FIles__c are
For each photo file, create one row to be inserted into Files__c in SFDC. Need the following columns:
Contact id (from AP_Application__c.Au_Pair__c)
Application Id (from AP_Application__c.Id)
Path (AP_Application__c.Photo1__c)
External Id (AP_Application__c. ExernalIdPhoto1)
Inactive Dt (new column, will map to Files__c.Inactive_Dt__c)
Files__c.Inactive_Dt__c
UPSERT Files
Use External Id to match Files__c. ExternalId
Files__c. AP_Application__c = Application id
Files__c.Contact__c = Contact id
Files__c.Path__c = Path
- Brad007
- November 02, 2011
- Like
- 0
System.ListException: Duplicate id in list
Hi
I am having the above error and i understand that its beacuse i am updating my object over and over . As the if contion is true i am updating again and again. Can anyone please suggest a work around as how i can have updates even after if conditions.
trigger APFileUpdates on Files__c (after insert) { Thank you. |
- Brad007
- October 20, 2011
- Like
- 0
XmlStreamReader to parse a Xml string
Hi, My Xml string which is returned from a webservice has the following few and the xml looks like this. I have been using XmlStream reader class to parse and i am unsuccessful . I need to get theese values updated to a custom object fields. Any help would be greatly appreciated.
Xmlstring = '<APFilesData>
<APFiles>
<Id>a0B40000001xxxxxxx</Id>
<APID>0034000000Uxxxxxx</APID>
<Filepath>//Bait/Applications/AP Applications/AP0902905.Botia_Diaz/Photos/Photo1.jpg</Filepath></APFiles>
<APFiles>
<Id>a0B400000xxxxxxxx</Id>
<APID>0034000000xxxx</APID>
<Filepath>//Bait/Applications/AP Applications/AP0902905.Botia_Diaz/Photos/Photo2.jpg</Filepath></APFiles>
<APFiles>
<Id>a0B40000001xxxxx</Id>
<APID>0034000000Ulxxx</APID>
<Filepath>//Bait/Applications/AP Applications/AP0902905.Botia_Diaz/Photos/Photo3.jpg</Filepath></APFiles>
<APFiles>
<Id>a0B40000xxxxxx</Id>
<APID>0034000000Uxxx</APID>
<Filepath>//Bait/Applications/AP Applications/AP0902905.Botia_Diaz/Photos/Photo4.jpg</Filepath> </APFiles>
</APFilesData>';
Thank you,
- Brad007
- October 18, 2011
- Like
- 0
System.CalloutException: IO Exception: java.security.cert.CertificateException:
Hi, I am trying to make a Apex callout but facing various errors in it. one of them below is
System.CalloutException: IO Exception: java.security.cert.CertificateException: No subject alternative names matching IP address xx.xx.xx.xxx found
Any suggestion or help would be greatly appreciated.
Thank you,
- Brad007
- October 17, 2011
- Like
- 0
Apex callout and XmlStreamReader class
Hi,
I have been trying to perform the Apex callout . And i am stuck converting the Xml string back to a Object. And also i am receiving soem error trying to making the callout not sure if that was successful
I need to get the Values of string Xml in Apex and update to a object named Files.
Please suggest thanks in Advance.
public class APImageUpdates {
public void APFilesMissing()
{
string ServiceResult = '';
System.debug('Entered!');
// Create list for Available Aupairs
List<AP_Application__c> APFiles = [Select a.Id ,a.Au_Pair__c,a.AP_Folder_Name__c, a.Photo4__c, a.Photo3__c, a.Photo2__c, a.Photo1__c, a.IsExist_Photo4__c, a.IsExist_Photo3__c, a.IsExist_Photo2__c, a.IsExist_Photo1__c,a.Au_Pair__r.Id,a.Au_Pair__r.AP_Status__c,a.Au_Pair__r.Record_Type_Name__c From AP_Application__c a where a.Au_Pair__r.AP_Status__c ='Available' AND a.Au_Pair__r.Record_Type_Name__c= 'Au Pair'];
// Root of the Xml list
string XmlString = '<APFilesData>';
for(AP_Application__c APAppObj: APFiles)
{
if(APAppObj.IsExist_Photo1__c == false)
{
XmlString += '<APFiles>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<Filepath>';
XmlString += APAppObj.Photo1__c;
XmlString += '</Filepath>';
XmlString += '</APFiles>';
}
if(APAppObj.IsExist_Photo2__c == false )
{
XmlString += '<APFiles>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<Filepath>';
XmlString += APAppObj.Photo2__c;
XmlString += '</Filepath>';
XmlString += '</APFiles>';
}
if(APAppObj.IsExist_Photo3__c == false )
{
XmlString += '<APFiles>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<Filepath>';
XmlString += APAppObj.Photo3__c;
XmlString += '</Filepath>';
XmlString += '</APFiles>';
}
if(APAppObj.IsExist_Photo4__c == false )
{
XmlString += '<APFiles>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<Filepath>';
XmlString += APAppObj.Photo4__c;
XmlString += '</Filepath>';
XmlString += '</APFiles>';
}
}
//Close root Xml
XmlString += '</APFilesData>';
System.debug('XML:' +XmlString);
System.debug('Entered1');
HttpRequest req = new HttpRequest();
req.setEndpoint('http://Ip Address/Ajax.asmx');
req.setMethod('POST');
req.setHeader('Content-Type', 'text/xml; charset=utf-8');
req.setHeader('SOAPAction', 'http://http://IP Address/GAPAPFiles');
string b = '<?xml version="1.0" encoding="utf-8"?>';
b += '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
b += '<soap:Body>';
b += '<GAPAPFiles xmlns="http://IP Address">';
b += '<xmlfiles>' + XmlString + '</xmlfiles>';
b += '</GAPAPFiles>';
b += '</soap:Body>';
b += '</soap:Envelope>';
req.setBody(b);
Http http = new Http();
HTTPResponse res = http.send(req);
XmlStreamReader reader = new XmlStreamReader(res.getBody());
while(reader.hasNext())
{
if (reader.getEventType() == XmlTag.START_ELEMENT)
{
string FieldName = reader.getLocalName();
reader.next();
if (reader.getEventType() == XmlTag.CHARACTERS)
{
// how do i get the three values in to a list or some thing so that i can update them into a different object.
}
}
reader.next();
}
}
- Brad007
- October 17, 2011
- Like
- 0
Convert XMl string to List Object
Hi ,
I have created a Xml string type and passed it to a Apex call out method. The result of this method is a string too. Now i would want to convert the Result Xml string into a List object. please suggest.
public class APImageUpdates {
public void APFilesMissing()
{
// Create list for Available Aupairs
List<Contact> APContacts = [Select Id,AP_Status__c,RecordTypeId from Contact where AP_Status__c ='Available' AND contact.RecordTypeId ='012300000000AHhAAM' ];
// Root of the Xml list
string XmlString = '<APFilesData>';
for(Contact contact: APContacts)
{
for(AP_Application__c APAppObj: [Select Id,Au_Pair__c,AP_Folder_Name__c,Photo1__c,Photo2__c,Photo3__c,Photo4__c From AP_Application__c where Au_Pair__c =: contact.Id])
{
if(APAppObj.IsExist_Photo1__c == false)
{
XmlString += '<APFiles>';
XmlString += '<Apfoldername>';
XmlString += APAppObj.AP_Folder_Name__c;
XmlString += '</Apfoldername>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<FileUrl>';
XmlString += APAppObj.Photo1__c;
XmlString += '</FileUrl>';
XmlString += '</APFiles>';
}
if(APAppObj.IsExist_Photo2__c == false )
{
XmlString += '<APFiles>';
XmlString += '<Apfoldername>';
XmlString += APAppObj.AP_Folder_Name__c;
XmlString += '</Apfoldername>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<FileUrl>';
XmlString += APAppObj.Photo2__c;
XmlString += '</FileUrl>';
XmlString += '</APFiles>';
}
if(APAppObj.IsExist_Photo3__c == false )
{
XmlString += '<APFiles>';
XmlString += '<Apfoldername>';
XmlString += APAppObj.AP_Folder_Name__c;
XmlString += '</Apfoldername>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<FileUrl>';
XmlString += APAppObj.Photo3__c;
XmlString += '</FileUrl>';
XmlString += '</APFiles>';
}
if(APAppObj.IsExist_Photo4__c == false )
{
XmlString += '<APFiles>';
XmlString += '<Apfoldername>';
XmlString += APAppObj.AP_Folder_Name__c;
XmlString += '</Apfoldername>';
XmlString += '<Id>';
XmlString += APAppObj.Id;
XmlString += '</Id>';
XmlString += '<APID>';
XmlString += APAppObj.Au_Pair__c;
XmlString += '</APID>';
XmlString += '<FileUrl>';
XmlString += APAppObj.Photo4__c;
XmlString += '</FileUrl>';
XmlString += '</APFiles>';
}
}
}
//Close root Xml
XmlString += '</APFilesData>';
ServiceMethod(XmlString);
}
//Service Method
public static void ServiceMethod(string xml)
{
string ServiceResult = '';
WebServiceOrg.AjaxSoap Service = new WebServiceOrg.AjaxSoap();
ServiceResult = Service.GAPNetworkImages(xml);
Checkboxupdate(ServiceResult);
}
public static void Checkboxupdate(string xml)
{
List<AP_Application__c> APAppObj = new List<AP_Application__c>();
}
I need to convert the resulting Xml and populate the results to List<AP_Application__c>. can someone please suggest
Thank you.
- Brad007
- October 10, 2011
- Like
- 0
Can a List<Object> be converted to a XML string?
Hi,
Can the List<AP_Application__c> APImagefiles object be converted to a XML string to pass it to a .Net webservice.
I am trying to use the XmlStreamWriter class to build the Xml can anyone please suggest how to build the Xml with the list object. And also for each record in the List i would want to add the string value p for each record.
Thanks in Adavnce..
public class APImageUpdates {
string Test;
public void APImagesMissing()
{
string Photo1 = 'P1';
string Photo2 = 'P2';
string Photo3 = 'P3';
string Photo4 = 'P4';
List<Contact> APContacts = new List<Contact>();
List<AP_Application__c> APImagefiles = new List<AP_Application__c>();
//Loop through Contacts for Available AuPairs
for(Contact contact: APContacts)
{
system.debug('Entered the List');
if(contact.AP_Status__c =='Available' && contact.RecordTypeId =='012300000000AHhAAM')
{
for(AP_Application__c APAppObj: [Select Id,Au_Pair__c,AP_Folder_Name__c From AP_Application__c where Au_Pair__c =: contact.Id])
{
if(APAppObj.IsExist_Photo1__c == false || APAppObj.IsExist_Photo2__c == false || APAppObj.IsExist_Photo3__c == false || APAppObj.IsExist_Photo4__c == false)
{
APImagefiles.add(APAppObj);
}
update APImagefiles;
}
}
}
}
public String getXml()
{
Xmlstreamwriter w = new Xmlstreamwriter();
w.writeStartDocument(null, '1.0');
w.writeProcessingInstruction('target', 'data');
return 'Test';
}
//Create the Stub
AJAXOrg.AjaxSoap service = new AJAXOrg.AjaxSoap();
// Make the Web service call
String output = service.GAPNetworkImages(Test);
- Brad007
- October 03, 2011
- Like
- 0
How to pass this string and also records
Hi,
Here below i have APImagefiles with records. Say 3 records have false for either of the photo and my list now has 3 records which i need to pass to web service callout. But if each of the record is missing a different photo number i need to pass the string value P1/P2/P3/P4. And also i need to pass total of 3 fields for each record ID,AP_Fodername__c, (string P1/P2/P3/P4)
Can you please suggest how i can pass these records
Cyrrently i am using a .net web service Method and it takes string types.
}
public class APImageUpdates {
public void APImagesMissing()
{
string Photo1 = 'P1';
string Photo2 = 'P2';
string Photo3 = 'P3';
string Photo4 = 'P4';
List<Contact> APContacts = new List<Contact>();
List<AP_Application__c> APImagefiles = new List<AP_Application__c>();
Map<String,String> APMissImgvalues = new Map<String,String>();
//Loop through Contacts for Available AuPairs
for(Contact contact: APContacts)
{
system.debug('Entered the List');
if(contact.AP_Status__c =='Available' && contact.RecordTypeId =='012300000000AHhAAM')
{
for(AP_Application__c APAppObj: [Select Id,Au_Pair__c,AP_Folder_Name__c From AP_Application__c where Au_Pair__c =: contact.Id])
{
if(APAppObj.IsExist_Photo1__c == false || APAppObj.IsExist_Photo2__c == false || APAppObj.IsExist_Photo3__c == false || APAppObj.IsExist_Photo4__c == false)
{
APImagefiles.add(APAppObj);
APMissImgvalues.put(APAppObj.Id,APAppObj.AP_Folder_Name__c);
}
update APImagefiles;
}
}
}
System.debug('List of APs missing images:' +APImagefiles);
//Create the Stub
AJAXOrg.AjaxSoap service = new AJAXOrg.AjaxSoap();
// Make the Web service call
String output = service.GAPNetworkImages();
}
- Brad007
- September 30, 2011
- Like
- 0
Can lists be passed to a web service method.
Hi,
Can lists be passed to a webservice methods. Or should they be passed as strings. If they should only be passed string whats the alternative to convert a list to a string.
please suggest.
Thank you
- Brad007
- September 28, 2011
- Like
- 0
Apex callout to .Net Webservice.
Hi,
I added the .net WSDL file to my Apex project and also added the endpoint URL in Salesforce remote settings.
So now in the following class below i have a list of objects APImageslist.
So the WSDL2Apex calss is called as AJAXOrg and has a method GAPNetworkInages().
This is the method i need to calla and pass the APImageslist to check for the images.
Can any one suggest what to be done after and how would i be able to connect the Wsdl2apex class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | public class APImageUpdates {
|
- Brad007
- September 23, 2011
- Like
- 0
Salesforce Apex code integartion with .Net Web Service.
I am trying to integrate my Apex code with a .Net webservice method.
My Apex class should query for a list of records and pass them to the .Net Webservice method.(How can i pass the list of records retrived).
And the list is performed with a certain operation it should be passed back to Apex method for certain updates.
Can any one please provide me with an example for this integration with .Net web service.
Than you.
- Brad007
- September 20, 2011
- Like
- 0
Implementing Apex callouts
Hi,
I am trying to implement a Apex callout to a websrvice. For this i have so far performed the following procedure.
Generating the WSDL class and setting up Endpoint URL in the remote settings. So now i am stuck with how to call the service method from Apex and test if the connection is made.
URL: www.gapcentral.com/Ajax.asmx
Service method: GAPNetworkImages()
Thanks in Advance.
- Brad007
- September 14, 2011
- Like
- 0
Call to our Server
Hi,
I need to develop a class in which i should be able to verify, if certain files or folder does exist in our network server from SFDC apex code.
so its like Apex code --> Files on our server(checking if they exisit)--> and update exisiting value in SFDC.
how do i connect to the server.
Any help would be greatly appreciated.
Thank you.
- Brad007
- August 23, 2011
- Like
- 0
Help Increase test class code coverage from 68%
I have marked in red the lines of code where it sayd 0% coverage. please suggest.
public class HFSendSurveyClass { public void SendSurvey() { //String hfsurvey; Date hfsurvey; //Get the most recently created config object. Config_Object__c config = [Select HFSurveyCode__c, SurveyDate__C, SOQL_Query__C from Config_Object__C where Name ='HostFamily_Survey' limit 1 ]; List<Opportunity> oppList = Database.query(config.SOQL_Query__c); //System.debug('Bharath:' +opplist); List<Account> accList = new List<Account>(); //System.debug('Bharath:' +accList); try { for(Opportunity opp:oppList) { if(opp.AccountId!= null) { Account acc = opp.Account; if(opp.Survey_Opp_Id_Match__c== 'No') { System.debug('Bharath date: '+config.SurveyDate__c); if(String.valueOf(config.SurveyDate__c) != Null) { if(String.valueOf(config.SurveyDate__c).contains('+')) { string s = String.valueOf(config.SurveyDate__c); string intvalue = adddaystostringvalue(s); hfsurvey = Date.today().addDays(integer.valueOf(intvalue)); } else { hfsurvey = Date.Today(); } } string oppcode= opp.Id; acc.Survey_Code__c = String.valueOf(config.HFSurveyCode__c); acc.Survey_Dt__c = hfsurvey; acc.Survey_Opp_Id__c = oppcode.subString(0,15); System.debug('Bharath account123: '+acc.Survey_Code__c+' '+String.valueOf(config.HFSurveyCode__c)); } else if(acc.Survey_Code__c != String.valueOf(config.HFSurveyCode__c)) { System.debug('Bharath date2: '+config.SurveyDate__c); if(String.valueOf(config.SurveyDate__c) != Null) { if(String.valueOf(config.SurveyDate__c).contains('+')) { string s = String.valueOf(config.SurveyDate__c); string intvalue = adddaystostringvalue(s); hfsurvey = Date.today().addDays(integer.valueOf(intvalue)); } else { hfsurvey = Date.Today(); } } string oppcode= opp.Id; acc.Survey_Code__c = String.valueOf(config.HFSurveyCode__c); acc.Survey_Dt__c = hfsurvey; acc.Survey_Opp_Id__c = oppcode.subString(0,15); } accList.add(acc); } } update accList; } catch (Exception e) { System.debug(e.getMessage()); } } private String adddaystostringvalue (string surveydays) { if(surveydays != null) surveydays = surveydays.substring(surveydays.indexOf('+')+ 1).trim(); return surveydays; }
TEst Class @istest private class HFSendSurveyTestClass { static testMethod void testSendSurvey(){ String query = 'Select o.Id,o.Survey_Opp_Id_Match__c ,o.Account.Name From Opportunity o where o.StageName=&#Active&# AND o.Placmnt_Start_Date_Arrive__c < Last_N_days :30 AND o.Placmnt_Start_Date_Arrive__c = Last_N_days :60 AND o.Survey_Opp_Id_Match__c=&#No&# limit 1'; Config_Object__c config = new Config_Object__c(); config.HFSurveyCode__c ='HF1MoArv'; config.SurveyDate__c = 'Today'; config.SOQL_Query__c = query; config.Name = 'HostFamily_Survey'; Opportunity opp = new Opportunity(); Account acc = new Account(); acc.Name = 'TestSurvey'; acc.Survey_Code__c='HFReferal'; acc.Survey_Dt__c = Date.today(); acc.Survey_Opp_Id__c = opp.Id; System.debug('Bharath acc:' +acc); Insert acc; opp.Name = acc.Name; opp.AccountId = acc.Id; opp.StageName = 'Active'; Date placedate = Date.newInstance(2011,03,01); opp.Placmnt_Start_Date_Arrive__c = placedate; opp.CloseDate = Date.today(); //opp.Account = acc; //opp.Survey_Opp_Id_Match__c = 'Yes'; //opp.Survey_Opp_Id_Match__c == 'No'; System.debug('Bharath opp:' +opp); Insert opp; // List<Opportunity> o = [Select Name,AccountId,StageName,Placmnt_Start_Date_Arrive__c FROM Opportunity where Name = 'TestSurvey']; //List<Account> a = [Select Name,Survey_Code__c,Survey_Opp_Id__c,Survey_Dt__c FROM Account where Name = 'TestSurvey']; HFSendSurveyClass sv = new HFSendSurveyClass(); sv.SendSurvey(); } //public static testMethod void testadddaystostringvalue() //{ // string x = string.valueOf('Today+2'); // HFSendSurveyClass s = new HFSendSurveyClass(); // s.adddaystostringvalue(x); //adddaystostringvalue(x); //} }
- Brad007
- April 06, 2011
- Like
- 0
Test class code coverage to 75% please Help.
If i run my test class individually i am just able to see 22% as code coverage. And my original class does not have any code coverage.
Class
Can some one please susggest to increase my code coverage.
Thanks in Advance.
- Brad007
- March 31, 2011
- Like
- 0
Illegal format string to date .
Config Object Detail |
public class HFSendSurveyClass {
The marked field is where i should be update the value frim the custome object. The surveydate in custom object is string type and the Survey_Dt__c field is a date field. and should be able to add days or change the date so i want to pass the line of code for date as a string and pick it up in my class to update it with that date.
Please suggest thanks in advance.
|
|
- Brad007
- March 28, 2011
- Like
- 0
Apex Scheduler test class
- Brad007
- December 28, 2011
- Like
- 0
System.DmlException: Upsert failed. First exception on row 0
Hi ,
System.DmlException: Upsert failed. First exception on row 0 with id a1WV00000001HBKMA2; first error: MISSING_ARGUMENT, External_ID__c not specified: []
I have my upsert opration failing. Can any one please suggest whats wrong in the below code and how help fix the code.
public with sharing class APImageUpdatesGlobal {
public void APFilesMissingGlobal()
{
string ServiceResult = '';
System.debug('Entered!');
// Create list for Available Aupairs
List<AP_Application__c> APFiles = [Select a.Photo4__c, a.Photo3__c, a.Photo2__c, a.Photo1__c, a.Id, a.External_ID_Photo4__c, a.External_ID_Photo3__c, a.External_ID_Photo2__c, a.External_ID_Photo1__c, a.Au_Pair__c From AP_Application__c a where a.Au_Pair__r.AP_Status__c ='Available' AND a.Au_Pair__r.Record_Type_Name__c= 'Au Pair'];
string XmlString = '<FilesData>';
for(AP_Application__c APFile: APFiles)
{
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo1__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo1__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo2__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo2__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo3__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo3__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
XmlString += '<APFiles>';
XmlString += '<ApplicationId>'+APFile.Id+'</ApplicationId>';
XmlString += '<APID>'+APFile.Au_Pair__c+'</APID>';
XmlString += '<Path>'+APFile.Photo4__c+'</Path>';
XmlString += '<External_ID>'+APFile.External_ID_Photo4__c+'</External_ID>';
XmlString += '<Inactive_Dt></Inactive_Dt>';
XmlString += '</APFiles>';
}
//Close root Xml
XmlString += '</FilesData>';
GAPOrg.AjaxSoap Servicestub = new GAPOrg.AjaxSoap();
ServiceResult = Servicestub.GAPAPFilesGlobalRun(XmlString);
Dom.Document docx = new Dom.Document();
docx.load(ServiceResult);
Dom.Xmlnode root = docx.getRootElement();
List<Files__c> upsertfiles = new List<Files__c>();
for(Dom.Xmlnode child : root.getChildElements()) {
Files__c file = null;
for(Dom.Xmlnode node : child.getChildElements()) {
if(node.getName() == 'External_ID') {
string str = node.getText();
if( str != ''){
file = new Files__c(); file = [Select f.Path__c, f.Inactive_Date__c, f.Id, f.External_ID__c, f.Contact__c, f.AP_Application__c From Files__c f where f.External_ID__c =: node.gettext() limit 1 ];
}
}
else if(node.getName() == 'Inactive_Dt')
{
if(file != null) {
if(node.getText() != ' ')
{
String[] stringDate = node.gettext().split('/');
Integer m = Integer.valueOf(stringDate[0]);
Integer d = Integer.valueOf(stringDate[1]);
Integer y = Integer.valueOf(stringDate[2]);
file.Inactive_Date__c = date.newinstance(y,m,d);
}
}
}
}
if (file == null) {
for(Dom.Xmlnode node : child.getChildElements())
{
string str = node.getName();
file = new Files__c();
if(str == 'ApplicationId')
{ file.AP_Application__c = node.gettext(); }
else if(str == 'APID')
{ file.Contact__c = node.gettext(); }
else if(str == 'Path')
{ file.Path__c = node.gettext(); }
else if(str == 'Inactive_Dt')
{
if(str != ' ')
{
String[] stringDate = node.gettext().split('/');
Integer m = Integer.valueOf(stringDate[0]);
Integer d = Integer.valueOf(stringDate[1]);
Integer y = Integer.valueOf(stringDate[2]);
file.Inactive_Date__c = date.newinstance(y,m,d);
}
}
}
}
upsertfiles.add(file);
file =null;
}
try { upsert upsertfiles External_ID__c; }
catch (DmlException e) {
System.debug(e.getMessage());
}
}
}
- Brad007
- November 21, 2011
- Like
- 0
System.ListException: Duplicate id in list
Hi
I am having the above error and i understand that its beacuse i am updating my object over and over . As the if contion is true i am updating again and again. Can anyone please suggest a work around as how i can have updates even after if conditions.
trigger APFileUpdates on Files__c (after insert) { Thank you. |
- Brad007
- October 20, 2011
- Like
- 0
APEX CallOut Error, System.CalloutException: IO Exception: Read timed out
Hi,
When i make a call to an external web service from an apex class, i got the following error:
System.CalloutException: IO Exception: Read timed out
The call works fine with the test environnement where the web service is exposed. However wiht their production environment, the error above is thrown. Is it a problem of mass data or security (proxy) ?
Could you help please ?
All the best,
Anzar.
- AnzarCRM
- October 18, 2011
- Like
- 0
System.CalloutException: IO Exception: java.security.cert.CertificateException:
Hi, I am trying to make a Apex callout but facing various errors in it. one of them below is
System.CalloutException: IO Exception: java.security.cert.CertificateException: No subject alternative names matching IP address xx.xx.xx.xxx found
Any suggestion or help would be greatly appreciated.
Thank you,
- Brad007
- October 17, 2011
- Like
- 0
Can lists be passed to a web service method.
Hi,
Can lists be passed to a webservice methods. Or should they be passed as strings. If they should only be passed string whats the alternative to convert a list to a string.
please suggest.
Thank you
- Brad007
- September 28, 2011
- Like
- 0
Apex callout to .Net Webservice.
Hi,
I added the .net WSDL file to my Apex project and also added the endpoint URL in Salesforce remote settings.
So now in the following class below i have a list of objects APImageslist.
So the WSDL2Apex calss is called as AJAXOrg and has a method GAPNetworkInages().
This is the method i need to calla and pass the APImageslist to check for the images.
Can any one suggest what to be done after and how would i be able to connect the Wsdl2apex class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | public class APImageUpdates {
|
- Brad007
- September 23, 2011
- Like
- 0
Implementing Apex callouts
Hi,
I am trying to implement a Apex callout to a websrvice. For this i have so far performed the following procedure.
Generating the WSDL class and setting up Endpoint URL in the remote settings. So now i am stuck with how to call the service method from Apex and test if the connection is made.
URL: www.gapcentral.com/Ajax.asmx
Service method: GAPNetworkImages()
Thanks in Advance.
- Brad007
- September 14, 2011
- Like
- 0
Help Increase test class code coverage from 68%
I have marked in red the lines of code where it sayd 0% coverage. please suggest.
public class HFSendSurveyClass { public void SendSurvey() { //String hfsurvey; Date hfsurvey; //Get the most recently created config object. Config_Object__c config = [Select HFSurveyCode__c, SurveyDate__C, SOQL_Query__C from Config_Object__C where Name ='HostFamily_Survey' limit 1 ]; List<Opportunity> oppList = Database.query(config.SOQL_Query__c); //System.debug('Bharath:' +opplist); List<Account> accList = new List<Account>(); //System.debug('Bharath:' +accList); try { for(Opportunity opp:oppList) { if(opp.AccountId!= null) { Account acc = opp.Account; if(opp.Survey_Opp_Id_Match__c== 'No') { System.debug('Bharath date: '+config.SurveyDate__c); if(String.valueOf(config.SurveyDate__c) != Null) { if(String.valueOf(config.SurveyDate__c).contains('+')) { string s = String.valueOf(config.SurveyDate__c); string intvalue = adddaystostringvalue(s); hfsurvey = Date.today().addDays(integer.valueOf(intvalue)); } else { hfsurvey = Date.Today(); } } string oppcode= opp.Id; acc.Survey_Code__c = String.valueOf(config.HFSurveyCode__c); acc.Survey_Dt__c = hfsurvey; acc.Survey_Opp_Id__c = oppcode.subString(0,15); System.debug('Bharath account123: '+acc.Survey_Code__c+' '+String.valueOf(config.HFSurveyCode__c)); } else if(acc.Survey_Code__c != String.valueOf(config.HFSurveyCode__c)) { System.debug('Bharath date2: '+config.SurveyDate__c); if(String.valueOf(config.SurveyDate__c) != Null) { if(String.valueOf(config.SurveyDate__c).contains('+')) { string s = String.valueOf(config.SurveyDate__c); string intvalue = adddaystostringvalue(s); hfsurvey = Date.today().addDays(integer.valueOf(intvalue)); } else { hfsurvey = Date.Today(); } } string oppcode= opp.Id; acc.Survey_Code__c = String.valueOf(config.HFSurveyCode__c); acc.Survey_Dt__c = hfsurvey; acc.Survey_Opp_Id__c = oppcode.subString(0,15); } accList.add(acc); } } update accList; } catch (Exception e) { System.debug(e.getMessage()); } } private String adddaystostringvalue (string surveydays) { if(surveydays != null) surveydays = surveydays.substring(surveydays.indexOf('+')+ 1).trim(); return surveydays; }
TEst Class @istest private class HFSendSurveyTestClass { static testMethod void testSendSurvey(){ String query = 'Select o.Id,o.Survey_Opp_Id_Match__c ,o.Account.Name From Opportunity o where o.StageName=&#Active&# AND o.Placmnt_Start_Date_Arrive__c < Last_N_days :30 AND o.Placmnt_Start_Date_Arrive__c = Last_N_days :60 AND o.Survey_Opp_Id_Match__c=&#No&# limit 1'; Config_Object__c config = new Config_Object__c(); config.HFSurveyCode__c ='HF1MoArv'; config.SurveyDate__c = 'Today'; config.SOQL_Query__c = query; config.Name = 'HostFamily_Survey'; Opportunity opp = new Opportunity(); Account acc = new Account(); acc.Name = 'TestSurvey'; acc.Survey_Code__c='HFReferal'; acc.Survey_Dt__c = Date.today(); acc.Survey_Opp_Id__c = opp.Id; System.debug('Bharath acc:' +acc); Insert acc; opp.Name = acc.Name; opp.AccountId = acc.Id; opp.StageName = 'Active'; Date placedate = Date.newInstance(2011,03,01); opp.Placmnt_Start_Date_Arrive__c = placedate; opp.CloseDate = Date.today(); //opp.Account = acc; //opp.Survey_Opp_Id_Match__c = 'Yes'; //opp.Survey_Opp_Id_Match__c == 'No'; System.debug('Bharath opp:' +opp); Insert opp; // List<Opportunity> o = [Select Name,AccountId,StageName,Placmnt_Start_Date_Arrive__c FROM Opportunity where Name = 'TestSurvey']; //List<Account> a = [Select Name,Survey_Code__c,Survey_Opp_Id__c,Survey_Dt__c FROM Account where Name = 'TestSurvey']; HFSendSurveyClass sv = new HFSendSurveyClass(); sv.SendSurvey(); } //public static testMethod void testadddaystostringvalue() //{ // string x = string.valueOf('Today+2'); // HFSendSurveyClass s = new HFSendSurveyClass(); // s.adddaystostringvalue(x); //adddaystostringvalue(x); //} }
- Brad007
- April 06, 2011
- Like
- 0
Test class code coverage to 75% please Help.
If i run my test class individually i am just able to see 22% as code coverage. And my original class does not have any code coverage.
Class
Can some one please susggest to increase my code coverage.
Thanks in Advance.
- Brad007
- March 31, 2011
- Like
- 0
Code coverage for the test class.
Hi,
I have a test class written for my apex class. But i am not sure if correct. In the sandbox if RUN TEST for the class itself it says the following
Test Class | HFSendSurveyTestClass |
Tests Run | 1 |
Test Failures | 1 |
Code Coverage Total % | 100 |
Total Time (ms) | 269.0 |
Test Failures |
HFSendSurveyTestClass.SendSurvey | 269.0 | System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name] | Class.HFSendSurveyTestClass.SendSurvey: line 19, column 10 External entry point |
static testMethod void SendSurvey()
{
// Get the most recently created config object.
Config_Object__c config = new Config_Object__c();
config.Name = 'HostFamily_Survey';
config.HFSurveyCode__c = 'HF1MoArv';
config.Survey_Date__c = Date.today();
config.SOQL_query__c = string.ValueOf('Select o.Id, o.Account.Id, o.AccountId, o.Account.Survey_Opp_Id__c, o.Account.Survey_Dt__c, o.Account.Survey_Code__c, o.Account.Name From Opportunity o where o.StageName= &#Active&# AND o.Placmnt_Start_Date_Arrive__c < Last_N_days :30 AND o.Placmnt_Start_Date_Arrive__c = Last_N_days :60');
insert config;
Account acc = new Account();
//acc.Name = 'TestSurvey';
acc.Survey_Code__c = 'HF1MoArv';
acc.Survey_Dt__c= Date.today();
//acc.Survey_Opp_Id__c=opp.id;
insert acc;
Opportunity opp= new Opportunity();
opp.AccountId = acc.Id;
opp.StageName='Active';
opp.Placmnt_Start_Date_Arrive__c = Date.ValueOf('2/15/2011');
insert opp;
HFSendSurveyClass hfsend = new HFSendSurveyClass();
hfsend.SendSurvey();
config = [Select HFSurveyCode__c, Survey_Date__C, SOQL_Query__C from Config_Object__C where Name =:config.Name];
acc = [Select Survey_Code__c,Survey_Dt__c,Survey_Opp_Id__c from Account where id =:opp.AccountId ];
System.assertEquals(config.HFSurveyCode__c,acc.Survey_Code__c);
System.assertEquals(config.Survey_Date__C,acc.Survey_Dt__c);
//System.assertEquals(opp.Id,acc.Survey_Opp_Id__c);
}
}
public void SendSurvey()
{
// Get the most recently created config object.
Config_Object__c config = [Select HFSurveyCode__c, Survey_Date__C, SOQL_Query__C from Config_Object__C
where Name ='HostFamily_Survey' Order by CreatedDate desc Limit 1];
List<Opportunity> oppList = Database.query(config.SOQL_Query__c);
List<Account> accList = new List<Account>();
for(Opportunity opp:oppList)
{
if(opp.AccountId!= null)
{
Account acc = opp.Account;
if(acc.Survey_Code__c != String.valueOf(config.HFSurveyCode__c) || acc.Survey_Opp_Id__c != opp.Id)
{
string oppcode= opp.Id;
acc.Survey_Code__c = String.valueOf(config.HFSurveyCode__c);
acc.Survey_Dt__c = config.Survey_Date__c;
acc.Survey_Opp_Id__c = oppcode.subString(0,15);
}
accList.add(acc);
}
}
update accList;
}
}
- Brad007
- March 22, 2011
- Like
- 0
Help writing a test class for Scheduler Class
Hi I am new to Apex code development. I am really unsure about how to write test class here. Can any one please help .
Here is the scheduler class it works fine
But to the test class i have written the code coverage says it covered 0 lines .And how do i deply it to production. Please help. Here is the test class i have written
@isTest
private class test_Config_Survey {
static testMethod void myUnitTest() {
// TO DO: implement unit test
//Test.startTest();
Config_Object__c config = [Select HFSurveyCode__c, Survey_Date__C, SOQL_Query__C from Config_Object__C
where Name ='HostFamily_Survey' limit 1];
for(Opportunity oppList: [Select o.Id, o.Account.Id, o.AccountId, o.Account.Survey_Opp_Id__c, o.Account.Survey_Dt__c, o.Account.Survey_Code__c, o.Account.Name
From Opportunity o
where o.StageName='Active'
AND o.Placmnt_Start_Date_Arrive__c < Last_N_days :30
AND o.Placmnt_Start_Date_Arrive__c = Last_N_days :60 limit 1])
Account acclist = new Account();
acclist = oppList.Account;
if(acclist.Survey_Code__c !=config.HFSurveyCode__c || acclist.Survey_Opp_Id__c != '0064000000CsXem')
{
acclist.Survey_Code__c=config.HFSurveyCode__c ;
acclist.Survey_Opp_Id__c = '0064000000CsXem';
acclist.Survey_Dt__c=Date.today();
}
update acclist;
//Test.stopTest();
}
}
- Brad007
- March 14, 2011
- Like
- 0
Help with apex code reference
I have a custome object built names Config_Object__c from which i need to access the values to my scheduler class.
Here is the code. please suggest if you have any ideas.
My Config_Object__C has fields
1.HFSurveyCode__c="HF1Mrov'
2.Survey_Date__c
3.SOQL_query="Select o.Id, o.Account.Id, o.AccountId, o.Account.Survey_Opp_Id__c, o.Account.Survey_Dt__c, o.Account.Survey_Code__c, o.Account.Name
From Opportunity o
where o.StageName='Active'
AND o.Placmnt_Start_Date_Arrive__c < Last_N_days :30
AND o.Placmnt_Start_Date_Arrive__c = Last_N_days :60"
Please suggest what should be done.
- Brad007
- March 10, 2011
- Like
- 0
Update Account object from Opportunity(With Lookup Field Account)
Hi,
I need to develop a Scheduler class to generate a report. And my class should update the custom fields in Account Object relating to Opportunity (with look up field as Account in it).
Here is the code.
- Brad007
- January 04, 2011
- Like
- 0
Help with Logic to Update Account Custom Feild
Hi,
I need to Update my custom fields in Account Object on Reports.
I have the query retrieving my data. After i check the condition i need to update my fields.
for one of the custom field it should be updated with the Opportunity ID.
How should i retrieve it from the query and update the field.
And also it should Update as a 15 character ID.
Please Help.
Thank you.
- Brad007
- January 04, 2011
- Like
- 0
Trigger to change the user
- Darb
- March 02, 2010
- Like
- 0