-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
13Questions
-
9Replies
Disabling TLS 1.0 and old php version for soap client
1.Windows Server 2008 R2
2.PHP 5.3.10
3.OpenSSL/0.9.8t
4.Salesforce disabling TLS 1.0
5.Legacy app which I did not write.
We are only using php to use Soapclient to connect to Salesforce and to process some csv files. It does not run on any server. This app is started by windows scheduler after csv files are uploaded to that machine. I need at least OpenSSL 1.0.1 or higher for TLS1.1.
What are my fastest options? Can I link OpenSSL/1.0.1 to PHP 5:3:10, and how to do it?
Or, should I start moving that app to latest PHP version ?
- vlr
- July 31, 2017
- Like
- 0
How to remove reference link (__r field) between objects ?
We have an object of Academic_Institution__c and Previous_Academic_Institution__c. If "CEEB_Code__c" exist Academic Institurion is created, and Previous Academic Institution is created with reference assigned to Academic Institution.
If we get a feed whith the same Previous_Academic_Institution__c, but the CEEB_Code__c empty, I want to remove the reference between Previous_Academic_Institution__c and Academic_Institution__c. I thought it is just a matter of assigning NULL to Academic_Institution__r, but it does not work:
Previous_Academic_Institution__c prevAcadInst = new Previous_Academic_Institution__c( Name = collegeName, PAC_ID__c = getField(rows.get(i), headerMap, 'custom_field_usc_id').replace('-', '') + ':' + collegeName, Application__r = new Opportunity(Application_Client_Id__c = appId), CEEB_Code__c = ceebCode, Academic_Institution__r = String.isNotEmpty(ceebCode) ? new Academic_Institution__c(CEEB_Code__c = ceebCode):null );
Here are the logs. I can see that when I am assigning NULL to __r field, then it does not get included for the upsert. How should I remove that link?
- vlr
- November 23, 2016
- Like
- 0
How to filter out LF (break lines) and CR from values in the cells of CSV file
When I use this regex in Notepad++ to clean the the CSV file and then send it to the email service then the processing works fine and all lines from csv file are processed. The notepad++ regex is this:
(,"[a-zA-Z 0-9,.:']*)([\n\r]+)([a-zA-Z 0-9,.':]*")
Then I tried to use this regex in the apex code, in the Execute Autonomous Window, but I cannot get it match the text which I could match in Notepad++. And I cannot find out what kind of regex Apex is using. This what I tried so far:
String res ='1000000522,Lesly175,,Lastname523,10242016,,1234568411,,email_78@yahoo.com,123 Street Address,,West Hills,CA,California,US,United States,91304,,422 permanent street address,,West Hills,CA,California,US,United States,91304,Female,No,,,,U.S. Citizen,11/9/1992,United States,Yes,,,,,Yes,Spain (Castilian),,,,,,,,,,,,,,,,,,,,,,,,,Yes,,Not a member of the military,"My cumulative GPA at UCSB was a 2.98 and was not as high as it could have been, due to struggling with domestic abuse, a shoulder surgery, and neck surgery. I received over a 3.2 GPA during my last two years, and a 3.69 GPA during my last year, with a 3.89 my last quarter. This was after the surgeries and during the abuse. I continued to persevere despite those situations. They have made me a more disciplined and strong willed person, more determined than ever to succeed in USC\'s MSW program.",Yes,Yes,"I received a GPA lower than a 2.0 during my first quarter at UCSB in Fall of 2010. I was put on academic probation for Winter of 2010 and was required to pull my cumulative GPA to above a 2.0 by the end of the quarter. I met this requirement and was taken off probation. I was not able to perform to the best of my ability my first quarter, due to struggling with the end of severe depression and coming to terms with my sexuality. This showed me that I needed to keep moving forward and not give up.",,,,,,,,,,,,,,,,UNIVERSITY OF CALIFORNIA - SANTA BARBARA,SANTA BARBARA CITY COLLEGE,,,,,,,,,,,,,,reffirstname520,reffirstname523,,,,,,,,,,,,,,referencelastname523,referencelastname523,,,,,,,,,,,,,,Professor,Children\'s Service Administrator,,,,,,,,,,,,,,Yes,Yes,Yes,,,,,,,,,,,,,"Oct 19, 2016 at 8:00 PM","Oct 16, 2016 at 8:00 PM","Oct 23, 2016 at 8:00 PM",,,,,,,,,,,,,100000522,,,,,,,Native,,,,,,,,,,,,,,,English,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,UCSB,15-Jun,No,,,Yes,"CYF Children, Youth, and Families",No,Yes,"University of California, Los Angeles\r\n'+ 'California State University, Northridge",No,,No,Not Applicable,,,,,,,,,,,,,,,Graduate and Professional School Fair,Other,,,,,,,,,,,,,,"Graduate Fair at the University of California, Santa Barbara \r\n'+ 'Santa Barbara, 2013",Social Work,,Social Work,,I am not eligible for military benefits,No,No,No,LGBTQ,Mental Health,Child and Family Services,2 Year,3 Year,Los Angeles,,No,No,No,No,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,\r\n'+ '1000000523,Lesly176,Middlename2,Lastname524,10182016,,1234568412,,email.e79@gmail.com,,,Amherst,NY,New York,US,United States,14228,,423 permanent street address,,East Meadow,NY,New York,US,United States,11554,Female,No,,,,U.S. Citizen,7/12/1995,United States,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Not a member of the military,,No,No,,,,,,,,,,,,,,,,,UNIVERSITY AT BUFFALO,,,,,,,,,,,,,,,reffirstname521,reffirstname524,,,,,,,,,,,,,,referencelastname524,referencelastname524,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100000523,,,,,,,Native,,,,,,,,,,,,,,,English,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'+ '1000000524,Jacqueline175,Middlename3,Lastname525,9222016,,1234568413,,email155@umbc.edu,134 Street Address,,Pikesville,MD,Maryland,US,United States,21208,,424 permanent street address,,Pikesville,MD,Maryland,US,United States,21208,Female,No,,,,U.S. Citizen,3/29/1989,United States,,,,,,,,,,,,,,,,,,,,,,,Yes,,,,,,,,,,,,,No,No,,,,,,,,,,,,,,,,,UNIVERSITY OF MARYLAND - BALTIMORE COUNTY,,,,,,,,,,,,,,,reffirstname522,reffirstname525,,,,,,,,,,,,,,referencelastname525,referencelastname525,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100000524,,,,,,,Native,,,,,,,,,,,,,,,English,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'; Pattern p = Pattern.compile('(,"\\[a-zA-Z 0-9,.:\'\\]*)(\\[\r\n\\]*)(\\[a-zA-Z 0-9,.\':\\]*")'); Matcher m = p.matcher( res ); System.debug(LoggingLevel.ERROR,'DEBUG before while loop m.matches = ' + m.matches()); while (m.find()) { res = res.replace(m.group(), m.group(1) + ' ' + m.group(3)); System.debug(LoggingLevel.ERROR,'DEBUG group()=' + m.group()); System.debug(LoggingLevel.ERROR, 'DEBUG group(1)=' + m.group(1)); System.debug(LoggingLevel.ERROR, 'DEBUG group(2)=' + m.group(2)); System.debug(LoggingLevel.ERROR, 'DEBUG group(3)=' + m.group(3)); } System.debug(LoggingLevel.ERROR, 'DEBUG: ApplicationImportProcessor.cleanLfInCellCsvData res=' + res); CsvReader reader = new CsvReader(res, ',');
- vlr
- November 18, 2016
- Like
- 0
Estimate salesforce project (custom object, controller, sites)
Project:
Final product description:
Name: Dynamic table of events.
The table should include the following fields: "Event", "Location", "Week Day", "Date", "Time". The table should be updated every time there is new event added in Salesforce, or if old event is turned to inactive, then this event should be removed. The web page with the table of events should be dynamic: if there are more events than one window can contain, then the webpage should be dynamically scrolling the table back and forth. The website should be publically accessible.
Implementation components:
1. Salesforce Custom Object with the following fields: Event name, Event Type (student, staff, faculty and all), Location Campus, Location Building and room, Display Location (what campuses this should be displayed: it will probably require different web pages), WeekDay, Date,Time,PublicView (checkbox indicates if event visible to public). The object will be used in Controller to present data in Visualforce page. Records will be updated and entered directly through Salesforce.
2. Controller object to operate and provide data for Sites. Records are sorted by dates in ascending order.
Visualforce page with dynamic back and forth scrolling when there are more events than one screen can display. The page should have public access. Visualforce
3. Sites for three different display locations: 3 campuses. Each campus will use its own Site to display events related to that campus.
VF page:
- vlr
- September 05, 2016
- Like
- 0
What is the best way to migrate code from external consultant?
Is it the only way?
- vlr
- September 03, 2016
- Like
- 0
Monitor email service with data feed
I am surprised I do not find find any examples of best practices on this matter. So, I have feeling maybe I am doing something wrong.
We have email service which is receiving emails with CSV file attached. The service is supposed to process this file and produce new records. Ideally, I'd like to receive a report on a process of the data feed :
1. If it is successful: email with data received, data created and logs.
2. If it is unsuccessful: email with data received, and logs.
What are the best practices on this ?
- vlr
- June 03, 2014
- Like
- 0
SOQL query produces results in Execute Anonymous, but returns zero records when running a test
Here is my method:
// return the list of all current students public List<Account> getAllCurrentStudents() { //get the applicant record type Id applicantRecordType = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Applicant').getRecordTypeId(); Id enrolledStudentRecordType = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Enrolled Student').getRecordTypeId(); System.debug('DEBUG, getAllCurrentStudents, applicantRecordType: ' + applicantRecordType); System.debug('DEBUG, getAllCurrentStudents, enrolledStudentRecordType : ' + enrolledStudentRecordType); List<Account> students = [Select c.FirstName, c.LastName, c.RecordTypeId , c.USC_ID__c From Account c where c.RecordTypeId IN (:applicantRecordType, :enrolledStudentRecordType)]; System.debug('DEBUG, getAllCurrentStudents, expected students: ' + students); System.debug('DEBUG, getAllCurrentStudents, expected students size : ' + students.size()); return students; }
When I run in Execute Anonymous, it pro duces thousands of records:
Anonymous execution was successful. 27.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO Execute Anonymous: Execute Anonymous: Execute Anonymous: //get the applicant record type Execute Anonymous: Id applicantRecordType = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Applicant').getRecordTypeId(); Execute Anonymous: Id enrolledStudentRecordType = Account.sObjectType.getDescribe().getRecordTypeInfosByName().get('Enrolled Student').getRecordTypeId(); Execute Anonymous: Execute Anonymous: System.debug('DEBUG, getAllCurrentStudents, applicantRecordType: ' + applicantRecordType); Execute Anonymous: System.debug('DEBUG, getAllCurrentStudents, enrolledStudentRecordType : ' + enrolledStudentRecordType); Execute Anonymous: Execute Anonymous: List<Account> students = [Select c.FirstName, c.LastName, c.RecordTypeId , c.USC_ID__c Execute Anonymous: From Account c Execute Anonymous: where c.RecordTypeId IN (:applicantRecordType, :enrolledStudentRecordType)]; Execute Anonymous: Execute Anonymous: System.debug('DEBUG, getAllCurrentStudents, expected students: ' + students); Execute Anonymous: System.debug('DEBUG, getAllCurrentStudents, expected students size : ' + students.size()); 15:46:43.056 (56964179)|EXECUTION_STARTED 15:46:43.056 (56973541)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 15:46:43.064 (64060425)|USER_DEBUG|[7]|DEBUG|DEBUG, getAllCurrentStudents, applicantRecordType: 01230000001VKvTAAW 15:46:43.064 (64123109)|USER_DEBUG|[8]|DEBUG|DEBUG, getAllCurrentStudents, enrolledStudentRecordType : 012300000015e8sAAA 15:46:43.064 (64828823)|SOQL_EXECUTE_BEGIN|[10]|Aggregations:0|select c.FirstName, c.LastName, c.RecordTypeId, c.USC_ID__c from Account c where c.RecordTypeId IN (:tmpVar1, :tmpVar2) 15:46:43.189 (189254531)|SOQL_EXECUTE_END|[10]|Rows:3667 15:46:43.197 (197056929)|USER_DEBUG|[14]|DEBUG|DEBUG, getAllCurrentStudents, expected students: (Account:{RecordTypeId=012300000015e8sAAA, FirstName=Test, Id=001c000000WAUEtAAP, LastName=Student}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Colin, Id=001c000000YTf0YAAT, LastName=Student}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Caitlin, Id=001c000000ZP7CsAAL, LastName=Pfaff, USC_ID__c=2147081986}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Jane, Id=001c000000ZP7CtAAL, LastName=Lin, USC_ID__c=1942919830}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Jasmin, Id=001c000000ZP7CuAAL, LastName=Amarillas, USC_ID__c=4974660115}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Krystal, Id=001c000000ZP7CvAAL, LastName=Gamez, USC_ID__c=7850585793}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Bridget, Id=001c000000ZP7CwAAL, LastName=Barni, USC_ID__c=3640986562}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Jodi, Id=001c000000ZP7CxAAL, LastName=Lavoie, USC_ID__c=2538841530}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=Brittani, Id=001c000000ZP7CyAAL, LastName=Linder, USC_ID__c=2743497234}, Account:{RecordTypeId=012300000015e8sAAA, FirstName=April, Id=001c000000ZP7CzAAL, LastName=Kim, USC_ID__c=7449945743}, ...) 15:46:43.197 (197211578)|USER_DEBUG|[15]|DEBUG|DEBUG, getAllCurrentStudents, expected students size : 3667 15:46:43.959 (197277889)|CUMULATIVE_LIMIT_USAGE 15:46:43.959|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 100 Number of query rows: 3667 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of fields describes: 0 out of 100 Number of record type describes: 2 out of 100 Number of child relationships describes: 0 out of 100 Number of picklist describes: 0 out of 100 Number of future calls: 0 out of 10 15:46:43.959|CUMULATIVE_LIMIT_USAGE_END
However, this code produces zero records during the test run:
15:50:00.692 (3692911643)|USER_DEBUG|[100]|DEBUG|DEBUG, getAllCurrentStudents, applicantRecordType: 01230000001VKvTAAW 15:50:00.692 (3692969908)|USER_DEBUG|[101]|DEBUG|DEBUG, getAllCurrentStudents, enrolledStudentRecordType : 012300000015e8sAAA 15:50:00.731 (3731254595)|USER_DEBUG|[107]|DEBUG|DEBUG, getAllCurrentStudents, expected students: () 15:50:00.731 (3731387603)|USER_DEBUG|[108]|DEBUG|DEBUG, getAllCurrentStudents, expected students size : 0 15:50:00.731 (3731403872)|METHOD_EXIT|[109]|01pc00000006rPw|GenericCSVFileProcessor.getAllCurrentStudents() 15:50:00.731 (3731458148)|USER_DEBUG|[112]|DEBUG|DEBUG, insertNewUniqueDataToOrg, allStudents()
Please, help.
- vlr
- May 13, 2014
- Like
- 0
Custom Related List with Custom Object
I am quite new to Salesforce and have not yet any thing like the following.
We have a Paper object which is looking up for authors in Contact object. We want to create to have custom related list of all papers for each of the authors. In other words, when an author is viewed from Contact tab, we want to have a list of his publications in the custom related list. Each paper can have up to 10 authors. If it has 10 authors, the paper should appear in each author's page in custom related list.
Is there any way to create without apex/trigger coding ? (if I need to code, how to create related list from apex? )
Thanks.
- vlr
- November 05, 2013
- Like
- 0
Schema.getGlobalDescribe and "Invalid field LastReferencedDate for Account"
I am using this code to print out Account fields to PDF file . Programm fails when it tries to retrieve "LastReferencedDate" from the instance of account object. It fails with "System.SObjectException: Invalid field LastReferencedDate". When I run simillar code in Execute Anonymous there is no LastReferencedDate field on the Map. I do not understand why when I debug apex class it tries to retrieve "LastReferencedDate" field and fails, but it does not have LastReferencedDate field when I run it in Execute Anonymous. And why Schema.getGlobalDescribe() returns field which Account does not have.
Can anyone explain me what is going on here? Thanks.
My Apex class:
public with sharing class AccountPDFGenerator { public static final String FORM_HTML_START = '<HTML><BODY>'; public static final String FORM_HTML_END = '</BODY></HTML>'; public static void generateAccountPDF(Account account) { System.debug('Account Name=' + account.Name); String pdfContent = '' + FORM_HTML_START; try { pdfContent = '' + FORM_HTML_START; pdfContent = pdfContent + '<H2>Account Information in PDF</H2>'; //Dynamically grab all the fields to store in the PDF Map<String, Schema.SObjectType> sobjectSchemaMap = Schema.getGlobalDescribe(); Schema.DescribeSObjectResult objDescribe = sobjectSchemaMap.get('Account').getDescribe(); Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap(); //Append each Field to the PDF for(Schema.SObjectField fieldDef : fieldMap.values()) { System.debug('fieldDescResult =' + fieldDef.getDescribe()); Schema.Describefieldresult fieldDescResult = fieldDef.getDescribe(); System.debug('field name =' + fieldDescResult.getName()); String name = fieldDescResult.getName(); System.debug('account.get(name) =' + account.get(name)); pdfContent = pdfContent + '<P>' + name + ': ' + account.get(name.trim()) + '</P>'; } pdfContent = pdfContent + FORM_HTML_END; }catch(Exception e) { System.debug('Error = ' + e.getMessage() ); System.debug('Account fields = ' + account ); pdfContent = '' + FORM_HTML_START; pdfContent = pdfContent + '<P>THERE WAS AN ERROR GENERATING PDF: ' + e.getMessage() + '</P>'; pdfContent = pdfContent + FORM_HTML_END; } attachPDF(account,pdfContent); } public static void attachPDF(Account account, String pdfContent) { try { Attachment attachmentPDF = new Attachment(); attachmentPDF.parentId = account.Id; attachmentPDF.Name = account.Name + '.pdf'; attachmentPDF.body = Blob.toPDF(pdfContent); //This creates the PDF content insert attachmentPDF; }catch(Exception e) { account.addError(e.getMessage()); } } }
Snippet of ebug log:
11:07:54.111 (1111596000)|USER_DEBUG|[24]|DEBUG|fieldDescResult =Schema.DescribeFieldResult[getByteLength=0;getCalculatedFormula=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getInlineHelpText=null;getLabel=Last Referenced Date;getLength=0;getLocalName=LastReferencedDate;getName=LastReferencedDate;getPrecision=0;getRelationshipName=null;getRelationshipOrder=null;getScale=0;getSoapType=DATETIME;getSobjectField=LastReferencedDate;getType=DATETIME;isAccessible=true;isAutoNumber=false;isCalculated=false;isCascadeDelete=false;isCaseSensitive=false;isCreateable=false;isCustom=false;isDefaultedOnCreate=false;isDependentPicklist=false;isDeprecatedAndHidden=false;isDisplayLocationInDecimal=false;isExternalId=false;isFilterable=true;isGroupable=false;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isPermissionable=false;isRestrictedDelete=false;isSortable=true;isUnique=false;isUpdateable=false;isWriteRequiresMasterRead=false;] 11:07:54.111 (1111606000)|SYSTEM_METHOD_EXIT|[24]|System.debug(ANY) 11:07:54.111 (1111614000)|SYSTEM_METHOD_ENTRY|[25]|Schema.SObjectField.getDescribe() 11:07:54.111 (1111631000)|SYSTEM_METHOD_EXIT|[25]|Schema.SObjectField.getDescribe() 11:07:54.111 (1111644000)|SYSTEM_METHOD_ENTRY|[27]|System.debug(ANY) 11:07:54.111 (1111649000)|USER_DEBUG|[27]|DEBUG|field name =LastReferencedDate 11:07:54.111 (1111654000)|SYSTEM_METHOD_EXIT|[27]|System.debug(ANY) 11:07:54.111 (1111665000)|SYSTEM_METHOD_ENTRY|[30]|SObject.get(String) 11:07:54.111 (1111742000)|EXCEPTION_THROWN|[30]|System.SObjectException: Invalid field LastReferencedDate for Account 11:07:54.111 (1111852000)|SYSTEM_METHOD_EXIT|[30]|SObject.get(String) 11:07:54.111 (1111894000)|SYSTEM_METHOD_ENTRY|[36]|System.SObjectException.getMessage() 11:07:54.111 (1111928000)|SYSTEM_METHOD_EXIT|[36]|System.SObjectException.getMessage() 11:07:54.111 (1111939000)|SYSTEM_METHOD_ENTRY|[36]|System.debug(ANY) 11:07:54.111 (1111945000)|USER_DEBUG|[36]|DEBUG|Error = Invalid field LastReferencedDate for Account 11:07:54.111 (1111950000)|SYSTEM_METHOD_EXIT|[36]|System.debug(ANY) 11:07:54.111 (1111966000)|SYSTEM_METHOD_ENTRY|[37]|String.valueOf(Object) 11:07:54.114 (1114349000)|SYSTEM_METHOD_EXIT|[37]|String.valueOf(Object) 11:07:54.114 (1114376000)|SYSTEM_METHOD_ENTRY|[37]|System.debug(ANY) 11:07:54.114 (1114383000)|USER_DEBUG|[37]|DEBUG|Account fields = Account:{Sub_conc_Academic_Advisor__c=null, Areas_of_Skill_or_Interest__pc=null, TickerSymbol=null, Concentration_Field_Coordinator__c=null, Foundation_Student_Level__c=null, Expected_Graduation_Term__c=null, Personal_Email__c=null, GPA__c=null, Original_City__c=null, Calswec_PCW__c=false, BillingStreet=null, Original_Zip__c=null, PersonAssistantName=null, Awards_Workstudy__c=false, Degree_Title__c=null, Prior_Supervisory_Experience__pc=null, ShippingLongitude=null, Rating=null, Previous__c=null, Program_of_Interest__c=null, Vehical_Required_Lead_Form__c=false, AccountSource=null, Anticipated_Return_Cohort__c=null, Access_to_Vehicle_During_Placement__c=false, Conc_Field_Liaison__c=null, SystemModstamp=2013-09-18 18:07:53, Vehicle_Required_During_Placement__c=null, Cohort_Accepted__c=null, PersonMailingLatitude=null, PersonLastCURequestDate=null, of_FT_Field_Instructors__c=null, Number_of_Health_Medical__c=0, Age__pc=null, Country_of_Citizenship__c=null, Number_of_Mental_Health_MVS__c=0, Foundation_Field_Liaison__c=null, Alternate_Placement_Days_Available__c=null, Imported_Ethnicity__c=null, Percent_Caucasian_Served__c=0, Middle_Name_Alias__c=null, Number_of_Work_and_Life_MVS__c=0, Foundation_Academic_Advisor__c=null, Other_Populations_Served__c=null, PersonDoNotCall=false, Agency_Requirements__c=null, RecordTypeId=012300000015e8sAAA, Percent_Asian_Served__c=0, Special_Schedule__c=false, Is_Active_Employee__pc=false, Number_of_Foundation_Students_Updated__c=null, Residency__c=null, Registered_Units__c=null, General_Focus_of_Services__c=null, Mental_Health_Rank__c=null, University_Title__pc=null, ADA_Compliance_Explanation__c=null, Active__pc=false, Accept_Foundation_Students__c=false, Concentration_Interest__c=null, AccountNumber=null, Consideration_Foundation_Populations_Exc__c=null, Awards_Stipends__c=false, Disability_Type__c=null, USC_Email__c=kross@usc.edu, PersonMailingStreet=null, Field_Status__c=null, Last_Enrollment_Term__c=null, of_PT_Field_Instructors__c=null, Number_of_Health_Medical_Updated__c=null, Phone=null, PersonMobilePhone=null, Sub_Concentration_Coordinator__c=null, BillingLatitude=null, PersonOtherLongitude=null, Prior_Experience_with_Interns__c=false, Primary_Demographic_Group_Served__c=null, LastActivityDate=2013-07-08 00:00:00, PersonMailingCountry=null, Auto_Insurance__c=false, University_Name__pc=null, PersonMailingState=null, Applied_for_Financial_Aid__c=false, Concentrations_Accepted__c=null, Length_of_Service__pc=null, Micro_Practice_Modalities__c=null, Home_Address__pc=null, Ownership=null, ParentId=null, Field_Instructor_Training_Date__pc=null, Languages__pc=null, Number_of_Mental_Health_SCH_PPS_Updated__c=null, Accept_Concentration_Students__c=false, LastModifiedDate=2013-09-18 18:07:53, Sub_conc_Field_Liaison__c=null, SIS_Local_Address_Last_Updated__c=null, Surrogate_Foundation_Liaison__c=null, Number_of_Family_and_Children_SCH_PPS__c=0, Intern_EBP_Training__c=false, PersonHasOptedOutOfFax=false, Primary_Populations_Served__c=null, Cohort_Current__c=null, First_Enrolled_Term__c=null, PersonTitle=null, Resume__pc=null, Resume_Received__pc=false, Agency_Auspice__c=null, Number_of_Mental_Health__c=0, Language__c=null, BillingCity=null, IsDeleted=false, LCSW__pc=false, Concentration_Field_Liaison__c=null, Number_of_Family_and_Children_Updated__c=null, Number_of_Mental_Health_SCH_PPS__c=0, Primary_Email__c=null, Modified_Schedule__c=false, AnnualRevenue=null, Is_LCSW__pc=false, Number_of_Mental_Health_MVS_Updated__c=null, BillingPostalCode=null, PersonEmailBouncedDate=null, GPA_Units__c=null, FirstName=Alba, Placements_Provided__c=null, PersonLeadSource=null, Intern_Workstation__c=null, PersonMailingPostalCode=null, ShippingStreet=null, Unit__pc=null, Ethnicity__c=Native American, MOU_Current__c=false, Disability__c=false, Is_SOWK_Graduate__pc=false, MasterRecordId=null, Placement_Consideration__c=null, Units_Attempted__c=null, PersonHomePhone=null, Percent_Native_American_Served__c=0, Number_of_Concentration_Students__c=0, Agency_Description__c=null, Primary_Contact_Type__c=null, Last_LOA_Semester__c=null, Last_Name_Alias__c=null, International_Phone_2__c=null, PersonLastCUUpdateDate=null, SicDesc=null, Macro_Practice_Modalities__c=null, Preferred_Greeting__pc=null, ADA_Compliant__c=false, Awards_Worstudy_Data_From_Lead__c=null, Conc_Academic_Advisor__c=null, LCSW_Year__pc=null, SIS_First_Enrolled_Term__c=null, Limitations_Personal_Qualities__pc=null, Personal_Email__pc=null, Secondary_Email__c=null, PersonMailingCity=null, Last_Semester_GPA__c=null, BillingLongitude=null, Tertiary_Populations_Served__c=null, BillingCountry=null, Reason_for_Enrollment_Exception__c=null, Number_Family_Children_SCH_PPS_Updated__c=null, PersonMailingLongitude=null, On_SAP_List__c=true, Id=001e000000AHXqMAAX, Date_of_Interview__pc=null, PersonEmailBouncedReason=null, Type=null, Site_Change__c=null, Number_of_Mental_Health_Updated__c=null, Accept_Concentration_Students_Updated__c=null, Faculty_Id__pc=null, Receive_Holiday_Card__pc=false, Placement_Consideration_Exception__c=null, Special_Student__c=false, Why_Current_Interest__c=null, Fax=null, Lead_Academic_Center_Interest__c=null, Level__pc=null, Intern_Activity_Description__c=null, Cleaned__c=false, Can_Provide_Services_in_Non_English_Lang__c=false, IUC__c=false, Evidence_Based_Practice__c=false, COPA_Rank__c=null, Consideration_Foundation_Populations__c=null, Sub_Pop_Code__c=null, Placement_Status__c=null, Has_Multiple_Locations__c=false, Number_of_Work_and_Life_MVS_Updated__c=null, Areas_of_Skill_or_Experience__pc=null, MSW_School__pc=null, Objective__c=null, Secondary_Populations_Served__c=null, Valid_Driver_s_Licence__c=false, Anticipated_Return_Semester_Year__c=null, Southern_California_County__c=null, Field_Personal_Statement__c=null, CreatedById=005a0000007rRD2AAM, Calswec_MH__c=false, Degree_Name__c=null, PersonAssistantPhone=null, OwnerId=005a0000007rRD2AAM, Number_of_Foundation_Students__c=null, BillingState=null, Reviewed_USC_Field_Requirements__pc=false, Number_of_COPA_MVS_Updated__c=null, of_Contract_Field_Instructors__c=null, First_Name_Alias__c=null, Language_2_Fluency__c=null, Waiver_Exam__c=false, CreatedDate=2013-06-28 21:01:45, JigsawCompanyId=null, Sic=null, Work_and_Life_Rank__c=null, Major__c=null, Field_Instructor_Training_Location__pc=null, Number_of_MSW_Employees__c=null, PersonHasOptedOutOfEmail=false, Placement_Clearance_Issue_Details__c=null, MSW_Degree_Year__pc=null, Notes_from_Agency_Lead__c=null, Concentration_Academic_Advisor__c=null, Site=null, Hours_of_Operation__c=null, Concentrations_Accepted_Last_Updated__c=null, Academic_Review_Completed__c=false, Sub_conc_Field_Coordinator__c=null, PR_Number__pc=null, Other_Language_1__c=null, Transfer_Student__c=false, Number_of_Work_and_Life_Updated__c=null, Conc_Field_Coordinator__c=null, IsPersonAccount=true, Industry=null, SalesforceCustomer=null, PersonContactId=003e00000070iW3AAI, Other_Language_2__c=null, Language_1_Fluency__c=null, Number_of_COPA__c=0, Date_Clean_Completed__c=null, Awards_Workstudy_Agency__c=false, Prior_Teaching_Experience__pc=null, Secondary_Reports_To__pc=null, Sub_Concentration__c=null, Description=null, Online_2Tor_Agency__c=false, Admissions_Term__c=null, LastModifiedById=005a0000007rRD2AAM, Faculty_USC_ID__pc=null, Location__pc=null, International_Student__c=false, Program_Change__c=null, Home_Visits_Required__c=null, Health_Rank__c=null, Latitude__c=null, Seminar_Instructor__c=null, PersonEmail=null, Number_of_Work_and_Life__c=0, Geographic_Area__c=null, LastName=Caldera, PersonDepartment=null, Gender__c=Female, NumberOfEmployees=null, Primary_Language__c=null, Tertiary_Demographic_Group_Served__c=null, ShippingCity=null, Degree__pc=null, Accept_Foundation_Students_Updated__c=null, Jigsaw=null, ShippingCountry=null, Units_Earned__c=null, Salutation=null, Number_of_Family_and_Children__c=0, USC_ID__c=67895789, AssistantEmail__pc=null, PersonOtherStreet=null, Longitude__c=null, PersonOtherPostalCode=null, Home_Visits_Required_From_Lead__c=false, Enrollment_Status__c=Full Time, Provides_Reimbursement_For__c=null, Academic_Condition__c=false, Post_Code__c=null, SIS_Permanent_Address_Last_Updated__c=null, Number_of_Health_Medical_MVS__c=0, PersonOtherPhone=null, Mezzo_Practice_Modalities__c=null, Grade_Points__c=null, Stipends_Available_To__c=null, Bilingual_Ability__c=null, Citizenship_Status__c=null, Memorandum_of_Agreement_Expiration_Date__c=null, Degree_Conferred_Date__c=null, of_Foundation_Placements__c=null, Completed_Field_Instructor_Training__pc=false, International_Phone_1__c=null, Percent_Latino_Served__c=0, Position__pc=null, County__c=null, Percent_African_American_Served__c=0, of_Concentration_Placements__c=null, Number_of_Family_and_Children_MVS__c=0, Faculty_Type__pc=null, Enrollment_Exception__c=null, Awarded_Work_Study__c=false, Number_of_Health_Medical_MVS_Updated__c=null, Prior_Teaching_or_Supervisory_Experience__pc=null, Paper_Opt_Out__c=false, PersonOtherState=null, ShippingLatitude=null, Status_of_Enrollment_Exception_Request__c=null, Preferred_Last_Name__c=null, Status_of_Site_Change__c=null, Why_Interested__pc=null, Site_Change_Effective_Semester__c=null, Program_Change_Effective_Semester__c=null, Limitations__pc=null, Additional_Comments__c=null, Status_Notes__pc=null, Number_of_COPA_Updated__c=null, Number_of_Family_Children_MVS_Updated__c=null, Campus__c=a0Be0000000X44mEAC, Placement_Consideration_Details__c=null, Fluency__c=null, ShippingPostalCode=null, PersonOtherCity=null, Status__c=null, Number_of_COPA_MVS__c=0, Concentration__c=null, ShippingState=null, PersonOtherCountry=null, Academic_Probation__c=false, Preferred_First_Name__c=null, Enrollment_Exception_Effective_Semester__c=null, Hire_Date__pc=null, Secondary_Demographic_Group_Served__c=null, Has_Field_Instructor__c=false, Status_of_Program_Change__c=null, Placement_Clearance_Issue__c=false, Families_and_Children_Rank__c=null, Stipend_Amount__c=null, Website=null, PersonBirthdate=null, PersonOtherLatitude=null}
Thanks
- vlr
- September 18, 2013
- Like
- 0
Zend client for Salesforce webservice api
I am new to Salesforce and Zend. I succeeded to implement a regular php client, but I am struggling to do the same in Zend framework. Does anyone know how to do it? Code example (especialy php code location in zend project) will be greatly appreciated.
Thanks, Viktor
- vlr
- August 30, 2013
- Like
- 0
One php form two Salesforce orgs
I need to create a PHP form that will simultaneously send data to two Salesforce orgs, and update Accounts, Contacts, and some custom objects. Is it possible? What will be the approach to implement this? ( if it webservice, how can I use two stubs/wsdls from two different orgs for the same php form? )
Thanks.
- vlr
- August 12, 2013
- Like
- 0
Reuse Visualforce page and controller for a second site
We have a Saleforce Site setup which is called ContactDirectory. I received a requirement to split this page to two pages: one for faculty, and another for staff. I tried two approaches trying to avoid the third approach.
My first thought was that I can simply choose Faculty Record Type for Contact object in a profile of the first site, and Staff Record Type for the second site. It turned out I misunderstand the purpose of selecting record types in profile of the site. I am still not clear on it, but it did not work.
My second way was to retrieve URL in a controller and then alternate SOQL query conditioned to this URL. URL which contains faculty will only select records for Faculty Record Type etc. Here I am not sure if it is good idea to build logic around URL. The main reason I am stack with idea is I do not know how to fix test cases that use PageReference to trigger controller. Specifically, I do not know how to set/pass URL when triggering VF page.
The third option would be just to copy everything for the second Site.
What would the best approach here? Should I try to reuse VF page and controller for similar sites?
Thanks.
- vlr
- July 26, 2013
- Like
- 0
Alternating multiple colors for dataTable rows based on record value
Hi,
We have a requirement for rows to have different colors based on the record value. There are many online example how to achieve zebra style colors (odd,even), and we are using it now. However, I have not found a solution for multiple colors. (and also my css file does not affect table when i put "odd" and "even" styles into css file. It only works when it is embedded into VF page. ). Here is the VF page:
<apex:page controller="ContactController" showHeader="false" sidebar="false" standardStylesheets="false"> <style> .odd {background-color: #FCF7F7;} .even {background-color: #E3DCDB;} </style> <apex:stylesheet value="{!URLFOR($Resource.contactCss)}"/> <apex:messages /> <apex:outputText style="font: normal normal 14px/30px Verdana, Arial, Georgia, serif;" rendered="{!NOT(ISNULL(contacts)) && contacts.size > 0}" value="School of Social Work Directory" /> <BR /> <apex:outputText style="font: normal normal 12px/30px Verdana, Arial, Georgia, serif;" rendered="{!NOT(ISNULL(contacts)) && contacts.size > 0}" value="Generated: {!NOW()}" /> <BR /> <BR /> <apex:pageBlock rendered="{!NOT(ISNULL(contacts)) && contacts.size > 0}" > <apex:dataTable value="{!contacts}" var="c" border="2" cellpadding="2" id="theTable" rowClasses="odd,even"> <apex:column value="{!c.Name}" headerValue="Name" styleClass="cell" /> <apex:column value="{!c.Phone}" headerValue="Phone" styleClass="cell" width="200px"/> <apex:column value="{!c.Location__c}" headerValue="Location" styleClass="cell"/> <apex:column value="{!c.Email}" headerValue="Email" styleClass="cell"/> <apex:column value="{!c.Title}" headerValue="Title" styleClass="cell"/> </apex:dataTable> </apex:pageBlock> </apex:page>
Here is static resource file:
.odd {background-color: #FCF7F7;} .even {background-color: #E3DCDB;} .table { border-collapse:collapse; width:100%; border:1px solid black; padding:2px; } th { border:1px solid black; padding:2px; font: normal bold 11px/30px Verdana, Arial, Georgia, serif; } .cell { border:1px solid black; padding:2px; font: normal normal 11px/30px Verdana, Arial, Georgia, serif; }
Thanks.
- vlr
- July 25, 2013
- Like
- 0
Schema.getGlobalDescribe and "Invalid field LastReferencedDate for Account"
I am using this code to print out Account fields to PDF file . Programm fails when it tries to retrieve "LastReferencedDate" from the instance of account object. It fails with "System.SObjectException: Invalid field LastReferencedDate". When I run simillar code in Execute Anonymous there is no LastReferencedDate field on the Map. I do not understand why when I debug apex class it tries to retrieve "LastReferencedDate" field and fails, but it does not have LastReferencedDate field when I run it in Execute Anonymous. And why Schema.getGlobalDescribe() returns field which Account does not have.
Can anyone explain me what is going on here? Thanks.
My Apex class:
public with sharing class AccountPDFGenerator { public static final String FORM_HTML_START = '<HTML><BODY>'; public static final String FORM_HTML_END = '</BODY></HTML>'; public static void generateAccountPDF(Account account) { System.debug('Account Name=' + account.Name); String pdfContent = '' + FORM_HTML_START; try { pdfContent = '' + FORM_HTML_START; pdfContent = pdfContent + '<H2>Account Information in PDF</H2>'; //Dynamically grab all the fields to store in the PDF Map<String, Schema.SObjectType> sobjectSchemaMap = Schema.getGlobalDescribe(); Schema.DescribeSObjectResult objDescribe = sobjectSchemaMap.get('Account').getDescribe(); Map<String, Schema.SObjectField> fieldMap = objDescribe.fields.getMap(); //Append each Field to the PDF for(Schema.SObjectField fieldDef : fieldMap.values()) { System.debug('fieldDescResult =' + fieldDef.getDescribe()); Schema.Describefieldresult fieldDescResult = fieldDef.getDescribe(); System.debug('field name =' + fieldDescResult.getName()); String name = fieldDescResult.getName(); System.debug('account.get(name) =' + account.get(name)); pdfContent = pdfContent + '<P>' + name + ': ' + account.get(name.trim()) + '</P>'; } pdfContent = pdfContent + FORM_HTML_END; }catch(Exception e) { System.debug('Error = ' + e.getMessage() ); System.debug('Account fields = ' + account ); pdfContent = '' + FORM_HTML_START; pdfContent = pdfContent + '<P>THERE WAS AN ERROR GENERATING PDF: ' + e.getMessage() + '</P>'; pdfContent = pdfContent + FORM_HTML_END; } attachPDF(account,pdfContent); } public static void attachPDF(Account account, String pdfContent) { try { Attachment attachmentPDF = new Attachment(); attachmentPDF.parentId = account.Id; attachmentPDF.Name = account.Name + '.pdf'; attachmentPDF.body = Blob.toPDF(pdfContent); //This creates the PDF content insert attachmentPDF; }catch(Exception e) { account.addError(e.getMessage()); } } }
Snippet of ebug log:
11:07:54.111 (1111596000)|USER_DEBUG|[24]|DEBUG|fieldDescResult =Schema.DescribeFieldResult[getByteLength=0;getCalculatedFormula=null;getController=null;getDefaultValue=null;getDefaultValueFormula=null;getDigits=0;getInlineHelpText=null;getLabel=Last Referenced Date;getLength=0;getLocalName=LastReferencedDate;getName=LastReferencedDate;getPrecision=0;getRelationshipName=null;getRelationshipOrder=null;getScale=0;getSoapType=DATETIME;getSobjectField=LastReferencedDate;getType=DATETIME;isAccessible=true;isAutoNumber=false;isCalculated=false;isCascadeDelete=false;isCaseSensitive=false;isCreateable=false;isCustom=false;isDefaultedOnCreate=false;isDependentPicklist=false;isDeprecatedAndHidden=false;isDisplayLocationInDecimal=false;isExternalId=false;isFilterable=true;isGroupable=false;isHtmlFormatted=false;isIdLookup=false;isNameField=false;isNamePointing=false;isNillable=true;isPermissionable=false;isRestrictedDelete=false;isSortable=true;isUnique=false;isUpdateable=false;isWriteRequiresMasterRead=false;] 11:07:54.111 (1111606000)|SYSTEM_METHOD_EXIT|[24]|System.debug(ANY) 11:07:54.111 (1111614000)|SYSTEM_METHOD_ENTRY|[25]|Schema.SObjectField.getDescribe() 11:07:54.111 (1111631000)|SYSTEM_METHOD_EXIT|[25]|Schema.SObjectField.getDescribe() 11:07:54.111 (1111644000)|SYSTEM_METHOD_ENTRY|[27]|System.debug(ANY) 11:07:54.111 (1111649000)|USER_DEBUG|[27]|DEBUG|field name =LastReferencedDate 11:07:54.111 (1111654000)|SYSTEM_METHOD_EXIT|[27]|System.debug(ANY) 11:07:54.111 (1111665000)|SYSTEM_METHOD_ENTRY|[30]|SObject.get(String) 11:07:54.111 (1111742000)|EXCEPTION_THROWN|[30]|System.SObjectException: Invalid field LastReferencedDate for Account 11:07:54.111 (1111852000)|SYSTEM_METHOD_EXIT|[30]|SObject.get(String) 11:07:54.111 (1111894000)|SYSTEM_METHOD_ENTRY|[36]|System.SObjectException.getMessage() 11:07:54.111 (1111928000)|SYSTEM_METHOD_EXIT|[36]|System.SObjectException.getMessage() 11:07:54.111 (1111939000)|SYSTEM_METHOD_ENTRY|[36]|System.debug(ANY) 11:07:54.111 (1111945000)|USER_DEBUG|[36]|DEBUG|Error = Invalid field LastReferencedDate for Account 11:07:54.111 (1111950000)|SYSTEM_METHOD_EXIT|[36]|System.debug(ANY) 11:07:54.111 (1111966000)|SYSTEM_METHOD_ENTRY|[37]|String.valueOf(Object) 11:07:54.114 (1114349000)|SYSTEM_METHOD_EXIT|[37]|String.valueOf(Object) 11:07:54.114 (1114376000)|SYSTEM_METHOD_ENTRY|[37]|System.debug(ANY) 11:07:54.114 (1114383000)|USER_DEBUG|[37]|DEBUG|Account fields = Account:{Sub_conc_Academic_Advisor__c=null, Areas_of_Skill_or_Interest__pc=null, TickerSymbol=null, Concentration_Field_Coordinator__c=null, Foundation_Student_Level__c=null, Expected_Graduation_Term__c=null, Personal_Email__c=null, GPA__c=null, Original_City__c=null, Calswec_PCW__c=false, BillingStreet=null, Original_Zip__c=null, PersonAssistantName=null, Awards_Workstudy__c=false, Degree_Title__c=null, Prior_Supervisory_Experience__pc=null, ShippingLongitude=null, Rating=null, Previous__c=null, Program_of_Interest__c=null, Vehical_Required_Lead_Form__c=false, AccountSource=null, Anticipated_Return_Cohort__c=null, Access_to_Vehicle_During_Placement__c=false, Conc_Field_Liaison__c=null, SystemModstamp=2013-09-18 18:07:53, Vehicle_Required_During_Placement__c=null, Cohort_Accepted__c=null, PersonMailingLatitude=null, PersonLastCURequestDate=null, of_FT_Field_Instructors__c=null, Number_of_Health_Medical__c=0, Age__pc=null, Country_of_Citizenship__c=null, Number_of_Mental_Health_MVS__c=0, Foundation_Field_Liaison__c=null, Alternate_Placement_Days_Available__c=null, Imported_Ethnicity__c=null, Percent_Caucasian_Served__c=0, Middle_Name_Alias__c=null, Number_of_Work_and_Life_MVS__c=0, Foundation_Academic_Advisor__c=null, Other_Populations_Served__c=null, PersonDoNotCall=false, Agency_Requirements__c=null, RecordTypeId=012300000015e8sAAA, Percent_Asian_Served__c=0, Special_Schedule__c=false, Is_Active_Employee__pc=false, Number_of_Foundation_Students_Updated__c=null, Residency__c=null, Registered_Units__c=null, General_Focus_of_Services__c=null, Mental_Health_Rank__c=null, University_Title__pc=null, ADA_Compliance_Explanation__c=null, Active__pc=false, Accept_Foundation_Students__c=false, Concentration_Interest__c=null, AccountNumber=null, Consideration_Foundation_Populations_Exc__c=null, Awards_Stipends__c=false, Disability_Type__c=null, USC_Email__c=kross@usc.edu, PersonMailingStreet=null, Field_Status__c=null, Last_Enrollment_Term__c=null, of_PT_Field_Instructors__c=null, Number_of_Health_Medical_Updated__c=null, Phone=null, PersonMobilePhone=null, Sub_Concentration_Coordinator__c=null, BillingLatitude=null, PersonOtherLongitude=null, Prior_Experience_with_Interns__c=false, Primary_Demographic_Group_Served__c=null, LastActivityDate=2013-07-08 00:00:00, PersonMailingCountry=null, Auto_Insurance__c=false, University_Name__pc=null, PersonMailingState=null, Applied_for_Financial_Aid__c=false, Concentrations_Accepted__c=null, Length_of_Service__pc=null, Micro_Practice_Modalities__c=null, Home_Address__pc=null, Ownership=null, ParentId=null, Field_Instructor_Training_Date__pc=null, Languages__pc=null, Number_of_Mental_Health_SCH_PPS_Updated__c=null, Accept_Concentration_Students__c=false, LastModifiedDate=2013-09-18 18:07:53, Sub_conc_Field_Liaison__c=null, SIS_Local_Address_Last_Updated__c=null, Surrogate_Foundation_Liaison__c=null, Number_of_Family_and_Children_SCH_PPS__c=0, Intern_EBP_Training__c=false, PersonHasOptedOutOfFax=false, Primary_Populations_Served__c=null, Cohort_Current__c=null, First_Enrolled_Term__c=null, PersonTitle=null, Resume__pc=null, Resume_Received__pc=false, Agency_Auspice__c=null, Number_of_Mental_Health__c=0, Language__c=null, BillingCity=null, IsDeleted=false, LCSW__pc=false, Concentration_Field_Liaison__c=null, Number_of_Family_and_Children_Updated__c=null, Number_of_Mental_Health_SCH_PPS__c=0, Primary_Email__c=null, Modified_Schedule__c=false, AnnualRevenue=null, Is_LCSW__pc=false, Number_of_Mental_Health_MVS_Updated__c=null, BillingPostalCode=null, PersonEmailBouncedDate=null, GPA_Units__c=null, FirstName=Alba, Placements_Provided__c=null, PersonLeadSource=null, Intern_Workstation__c=null, PersonMailingPostalCode=null, ShippingStreet=null, Unit__pc=null, Ethnicity__c=Native American, MOU_Current__c=false, Disability__c=false, Is_SOWK_Graduate__pc=false, MasterRecordId=null, Placement_Consideration__c=null, Units_Attempted__c=null, PersonHomePhone=null, Percent_Native_American_Served__c=0, Number_of_Concentration_Students__c=0, Agency_Description__c=null, Primary_Contact_Type__c=null, Last_LOA_Semester__c=null, Last_Name_Alias__c=null, International_Phone_2__c=null, PersonLastCUUpdateDate=null, SicDesc=null, Macro_Practice_Modalities__c=null, Preferred_Greeting__pc=null, ADA_Compliant__c=false, Awards_Worstudy_Data_From_Lead__c=null, Conc_Academic_Advisor__c=null, LCSW_Year__pc=null, SIS_First_Enrolled_Term__c=null, Limitations_Personal_Qualities__pc=null, Personal_Email__pc=null, Secondary_Email__c=null, PersonMailingCity=null, Last_Semester_GPA__c=null, BillingLongitude=null, Tertiary_Populations_Served__c=null, BillingCountry=null, Reason_for_Enrollment_Exception__c=null, Number_Family_Children_SCH_PPS_Updated__c=null, PersonMailingLongitude=null, On_SAP_List__c=true, Id=001e000000AHXqMAAX, Date_of_Interview__pc=null, PersonEmailBouncedReason=null, Type=null, Site_Change__c=null, Number_of_Mental_Health_Updated__c=null, Accept_Concentration_Students_Updated__c=null, Faculty_Id__pc=null, Receive_Holiday_Card__pc=false, Placement_Consideration_Exception__c=null, Special_Student__c=false, Why_Current_Interest__c=null, Fax=null, Lead_Academic_Center_Interest__c=null, Level__pc=null, Intern_Activity_Description__c=null, Cleaned__c=false, Can_Provide_Services_in_Non_English_Lang__c=false, IUC__c=false, Evidence_Based_Practice__c=false, COPA_Rank__c=null, Consideration_Foundation_Populations__c=null, Sub_Pop_Code__c=null, Placement_Status__c=null, Has_Multiple_Locations__c=false, Number_of_Work_and_Life_MVS_Updated__c=null, Areas_of_Skill_or_Experience__pc=null, MSW_School__pc=null, Objective__c=null, Secondary_Populations_Served__c=null, Valid_Driver_s_Licence__c=false, Anticipated_Return_Semester_Year__c=null, Southern_California_County__c=null, Field_Personal_Statement__c=null, CreatedById=005a0000007rRD2AAM, Calswec_MH__c=false, Degree_Name__c=null, PersonAssistantPhone=null, OwnerId=005a0000007rRD2AAM, Number_of_Foundation_Students__c=null, BillingState=null, Reviewed_USC_Field_Requirements__pc=false, Number_of_COPA_MVS_Updated__c=null, of_Contract_Field_Instructors__c=null, First_Name_Alias__c=null, Language_2_Fluency__c=null, Waiver_Exam__c=false, CreatedDate=2013-06-28 21:01:45, JigsawCompanyId=null, Sic=null, Work_and_Life_Rank__c=null, Major__c=null, Field_Instructor_Training_Location__pc=null, Number_of_MSW_Employees__c=null, PersonHasOptedOutOfEmail=false, Placement_Clearance_Issue_Details__c=null, MSW_Degree_Year__pc=null, Notes_from_Agency_Lead__c=null, Concentration_Academic_Advisor__c=null, Site=null, Hours_of_Operation__c=null, Concentrations_Accepted_Last_Updated__c=null, Academic_Review_Completed__c=false, Sub_conc_Field_Coordinator__c=null, PR_Number__pc=null, Other_Language_1__c=null, Transfer_Student__c=false, Number_of_Work_and_Life_Updated__c=null, Conc_Field_Coordinator__c=null, IsPersonAccount=true, Industry=null, SalesforceCustomer=null, PersonContactId=003e00000070iW3AAI, Other_Language_2__c=null, Language_1_Fluency__c=null, Number_of_COPA__c=0, Date_Clean_Completed__c=null, Awards_Workstudy_Agency__c=false, Prior_Teaching_Experience__pc=null, Secondary_Reports_To__pc=null, Sub_Concentration__c=null, Description=null, Online_2Tor_Agency__c=false, Admissions_Term__c=null, LastModifiedById=005a0000007rRD2AAM, Faculty_USC_ID__pc=null, Location__pc=null, International_Student__c=false, Program_Change__c=null, Home_Visits_Required__c=null, Health_Rank__c=null, Latitude__c=null, Seminar_Instructor__c=null, PersonEmail=null, Number_of_Work_and_Life__c=0, Geographic_Area__c=null, LastName=Caldera, PersonDepartment=null, Gender__c=Female, NumberOfEmployees=null, Primary_Language__c=null, Tertiary_Demographic_Group_Served__c=null, ShippingCity=null, Degree__pc=null, Accept_Foundation_Students_Updated__c=null, Jigsaw=null, ShippingCountry=null, Units_Earned__c=null, Salutation=null, Number_of_Family_and_Children__c=0, USC_ID__c=67895789, AssistantEmail__pc=null, PersonOtherStreet=null, Longitude__c=null, PersonOtherPostalCode=null, Home_Visits_Required_From_Lead__c=false, Enrollment_Status__c=Full Time, Provides_Reimbursement_For__c=null, Academic_Condition__c=false, Post_Code__c=null, SIS_Permanent_Address_Last_Updated__c=null, Number_of_Health_Medical_MVS__c=0, PersonOtherPhone=null, Mezzo_Practice_Modalities__c=null, Grade_Points__c=null, Stipends_Available_To__c=null, Bilingual_Ability__c=null, Citizenship_Status__c=null, Memorandum_of_Agreement_Expiration_Date__c=null, Degree_Conferred_Date__c=null, of_Foundation_Placements__c=null, Completed_Field_Instructor_Training__pc=false, International_Phone_1__c=null, Percent_Latino_Served__c=0, Position__pc=null, County__c=null, Percent_African_American_Served__c=0, of_Concentration_Placements__c=null, Number_of_Family_and_Children_MVS__c=0, Faculty_Type__pc=null, Enrollment_Exception__c=null, Awarded_Work_Study__c=false, Number_of_Health_Medical_MVS_Updated__c=null, Prior_Teaching_or_Supervisory_Experience__pc=null, Paper_Opt_Out__c=false, PersonOtherState=null, ShippingLatitude=null, Status_of_Enrollment_Exception_Request__c=null, Preferred_Last_Name__c=null, Status_of_Site_Change__c=null, Why_Interested__pc=null, Site_Change_Effective_Semester__c=null, Program_Change_Effective_Semester__c=null, Limitations__pc=null, Additional_Comments__c=null, Status_Notes__pc=null, Number_of_COPA_Updated__c=null, Number_of_Family_Children_MVS_Updated__c=null, Campus__c=a0Be0000000X44mEAC, Placement_Consideration_Details__c=null, Fluency__c=null, ShippingPostalCode=null, PersonOtherCity=null, Status__c=null, Number_of_COPA_MVS__c=0, Concentration__c=null, ShippingState=null, PersonOtherCountry=null, Academic_Probation__c=false, Preferred_First_Name__c=null, Enrollment_Exception_Effective_Semester__c=null, Hire_Date__pc=null, Secondary_Demographic_Group_Served__c=null, Has_Field_Instructor__c=false, Status_of_Program_Change__c=null, Placement_Clearance_Issue__c=false, Families_and_Children_Rank__c=null, Stipend_Amount__c=null, Website=null, PersonBirthdate=null, PersonOtherLatitude=null}
Thanks
- vlr
- September 18, 2013
- Like
- 0
Reuse Visualforce page and controller for a second site
We have a Saleforce Site setup which is called ContactDirectory. I received a requirement to split this page to two pages: one for faculty, and another for staff. I tried two approaches trying to avoid the third approach.
My first thought was that I can simply choose Faculty Record Type for Contact object in a profile of the first site, and Staff Record Type for the second site. It turned out I misunderstand the purpose of selecting record types in profile of the site. I am still not clear on it, but it did not work.
My second way was to retrieve URL in a controller and then alternate SOQL query conditioned to this URL. URL which contains faculty will only select records for Faculty Record Type etc. Here I am not sure if it is good idea to build logic around URL. The main reason I am stack with idea is I do not know how to fix test cases that use PageReference to trigger controller. Specifically, I do not know how to set/pass URL when triggering VF page.
The third option would be just to copy everything for the second Site.
What would the best approach here? Should I try to reuse VF page and controller for similar sites?
Thanks.
- vlr
- July 26, 2013
- Like
- 0
Alternating multiple colors for dataTable rows based on record value
Hi,
We have a requirement for rows to have different colors based on the record value. There are many online example how to achieve zebra style colors (odd,even), and we are using it now. However, I have not found a solution for multiple colors. (and also my css file does not affect table when i put "odd" and "even" styles into css file. It only works when it is embedded into VF page. ). Here is the VF page:
<apex:page controller="ContactController" showHeader="false" sidebar="false" standardStylesheets="false"> <style> .odd {background-color: #FCF7F7;} .even {background-color: #E3DCDB;} </style> <apex:stylesheet value="{!URLFOR($Resource.contactCss)}"/> <apex:messages /> <apex:outputText style="font: normal normal 14px/30px Verdana, Arial, Georgia, serif;" rendered="{!NOT(ISNULL(contacts)) && contacts.size > 0}" value="School of Social Work Directory" /> <BR /> <apex:outputText style="font: normal normal 12px/30px Verdana, Arial, Georgia, serif;" rendered="{!NOT(ISNULL(contacts)) && contacts.size > 0}" value="Generated: {!NOW()}" /> <BR /> <BR /> <apex:pageBlock rendered="{!NOT(ISNULL(contacts)) && contacts.size > 0}" > <apex:dataTable value="{!contacts}" var="c" border="2" cellpadding="2" id="theTable" rowClasses="odd,even"> <apex:column value="{!c.Name}" headerValue="Name" styleClass="cell" /> <apex:column value="{!c.Phone}" headerValue="Phone" styleClass="cell" width="200px"/> <apex:column value="{!c.Location__c}" headerValue="Location" styleClass="cell"/> <apex:column value="{!c.Email}" headerValue="Email" styleClass="cell"/> <apex:column value="{!c.Title}" headerValue="Title" styleClass="cell"/> </apex:dataTable> </apex:pageBlock> </apex:page>
Here is static resource file:
.odd {background-color: #FCF7F7;} .even {background-color: #E3DCDB;} .table { border-collapse:collapse; width:100%; border:1px solid black; padding:2px; } th { border:1px solid black; padding:2px; font: normal bold 11px/30px Verdana, Arial, Georgia, serif; } .cell { border:1px solid black; padding:2px; font: normal normal 11px/30px Verdana, Arial, Georgia, serif; }
Thanks.
- vlr
- July 25, 2013
- Like
- 0
Dynamic search with visualforce page
Hai.............
I had one problem regarding Dynamic search....
I Had one custom object (Candidate) and input fields First Name ,LastName , City, Education etc.....
On my visual force page, without typing any value in the input text field the values are displaying automatically and when i enter any value in the input field ERROR msg is displaying even the record is present
MY visualforce code :
<apex:page controller="CandidateSearchController" sidebar="false"> <script type="text/javascript"> function doSearch() { searchServer( document.getElementById("First_Name__c").value, document.getElementById("Last_Name__c").value, document.getElementById("City__c").value, document.getElementById("Education__c").options[document.getElementById("Education__c").selectedIndex].value ); } </script> <apex:form > <apex:pageMessages id="errors" /> <apex:pageBlock title="Find Me A Candidate!" mode="edit"> <table width="100%" border="0"> <tr> <td width="200" valign="top"> <apex:pageBlock title="Parameters" mode="edit" id="criteria"> <apex:actionFunction name="searchServer" action="{!runSearch}" rerender="results,debug,errors"> <apex:param name="First_Name__c" value="" /> <apex:param name="Last_Name__c" value="" /> <apex:param name="City__c" value="" /> <apex:param name="Education__c" value="" /> </apex:actionFunction> <table cellpadding="2" cellspacing="2"> <tr> <td style="font-weight:bold;">First Name<br/> <input type="text" id="First_Name__c" onkeyup="doSearch();"/> </td> </tr> <tr> <td style="font-weight:bold;">Last Name<br/> <input type="text" id="Last_Name__c" onkeyup="doSearch();"/> </td> </tr> <tr> <td style="font-weight:bold;">City<br/> <input type="text" id="City__c" onkeyup="doSearch();"/> </td> </tr> <tr> <td style="font-weight:bold;">Education<br/> <select id="Education__c" onchange="doSearch();"> <option value=""></option> <apex:repeat value="{!Education }" var="edc"> <option value="{!edc}"> {!edc}</option> </apex:repeat> </select> </td> </tr> </table> </apex:pageBlock> </td> <td valign="top"> <apex:pageBlock mode="edit" id="results"> <apex:pageBlockTable value="{!candidates}" var="candidate"> <apex:column > <apex:facet name="header"> <apex:commandLink value="First Name" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="first_name__c" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!Candidate.First_Name__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Last Name" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="last_Name__c" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!candidate.Last_Name__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="City" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="City__c" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!candidate.City__c}"/> </apex:column> <apex:column > <apex:facet name="header"> <apex:commandLink value="Education" action="{!toggleSort}" rerender="results,debug"> <apex:param name="sortField" value="Education__c" assignTo="{!sortField}"/> </apex:commandLink> </apex:facet> <apex:outputField value="{!candidate.Education__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </td> </tr> </table> <apex:pageBlock title="Debug - SOQL" id="debug"> <apex:outputText value="{!debugSoql}" /> </apex:pageBlock> </apex:pageBlock> </apex:form> </apex:page>
here is my Controller code;
public with sharing class CandidateSearchController {
private String soql {get;set;}
// the collection of contacts to display
Public List<Candidate__c> candidates {get;set;}
// the current sort direction. deaults to asc
public String sortDir{
get { if (sortDir == null) { sortDir = 'asc'; }
return sortDir;
}
set;
}
// the current field to sort by. defaults to last name
public String sortField {
get {
if ( sortField == null) {
sortField = 'Last_Name__c'; } return sortField; }
set;
}
// format the soql for display on the visualforce page
public String debugSoql {
get { return soql + ' order by ' + sortField + ' ' + sortDir + 'limit 20 '; }
set;
}
// init the contrller and display some sample data when the page loads
public CandidatesearchController() {
soql='select First_name__c,Last_name__c,City__c,Education__c from Candidate__c where Candidate__c.First_name__c != null';
runQuery();
}
// toggles the sorting of query from asc<-->desc
public void toggleSort() {
//simply toggle the direction
sortDir = sortDir.equals('asc') ? 'desc' : 'asc' ;
// run the query again
runQuery();
}
//runs the actualquery
public void runQuery() {
try {
candidates = Database.query(soql + ' order by ' + sortField + ' ' + sortDir + ' limit 20 ');
}
catch (Exception e) {
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, ' OOOps! ') );
}
}
// runs the search with parameters passed via JavaScript
public PageReference runSearch(){
String FirstName = Apexpages.currentPage().getParameters().get('First_Name__c');
String LastName = Apexpages.currentPage().getParameters().get('Last_Name__c');
String City = Apexpages.currentPage().getParameters().get('City__c');
String Education = Apexpages.currentPage().getParameters().get('Education__c');
soql='select First_name__c,Last_name__c,City__c,Education__c from Candidate__c where Candiadate__c.First_Name__c != null';
if (!FirstName.equals(''))
soql += ' and First_Name__c LIKE \' '+String.escapeSingleQuotes(FirstName)+'%\'';
if (!LastName.equals(''))
soql += ' and Last_Name__c LIKE \''+String.escapeSingleQuotes(LastName)+'%\'';
if (!City.equals(''))
soql += ' and City__c LIKE \''+String.escapeSingleQuotes(city)+'%\'';
if (!Education.equals(''))
soql += ' and Education__c LIKE (\''+Education+'\')';
// run the query again
runQuery();
return null;
}
// use apex describe to build the picklist values
public List<String> Education {
get {
if (Education == null) {
Education = new List<String>();
Schema.DescribeFieldResult field = Candidate__c.Education__c.getDescribe();
for (Schema.PicklistEntry f : field.getPicklistValues())
Education.add(f.getLabel());
}
return Education;
}
set;
}
}
- phani_m
- March 02, 2013
- Like
- 0
Custom Button - Pre-Populate Name (text) Field of a Custom Object
I have the following Button below that opens a page to add a new record for "Drugs__c". It pre-populates the Account field on the page, but I also want to auto populate the DrugsName (Name (text)) field with the following text, "default". I dont want our users to worry about filling in this field since it will be overrided with a naming convention using Workflow/FieldUpdate once the record is saved.
Highlighed in red is the id of the field name, "Drugs Name" in the custom object "Drugs__c". The code is not working properly and not populating the Drug Name field. Suggestions how to correct this.
/a0J/e?CF00NZ0000000etH2={!Account.Name} & CF00NZ0000000etH2_lkid={!Account.Id}&retURL=%2F{!Account.Id}&01IZ00000008qBS="default"
- jpben
- December 02, 2012
- Like
- 0
Alternating row colors in datatable
Hello. Does anyone know the code needed to alternate background color rows in a datatable? In other words, I want odd rows to have a white background and even rows should have a gray background. I am trying to use.p:nth-child(even)/p:nth-child(odd)...but that code does not seem to be working.
Thanks in advance.
- bozotheclown
- November 15, 2012
- Like
- 0
token failed with status 0!!!
Hi,
I try this code:
http://developer.force.com/cookbook/recipe/interact-with-the-forcecom-rest-api-from-php
And when I execute, get a Salesforce.com Login, I put my login and when back to my computer (a localhost), get this error:
https://login.salesforce.com/services/oauth2/token failed with status 0
Anyone can explain whats append?!!!
Best Regards,
LB
- LBDD
- December 22, 2010
- Like
- 0