-
ChatterFeed
-
1Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
20Replies
URGENT!! I'm deploying and my original test class isn't working!
@RestResource(urlMapping='/ZLead/*')
global class ZRestAPI {
@HttpPost
global static String createLead(Sender sender,Details details,String type,String id,String created, Recipient recipient, String price, Quote quote, Arm arm, Z z, Fees fees) {
RecordType rt = [select ID, name from RecordType where name='Z'];
Lead l =new Lead(LastName = sender.lastName,
FirstName = sender.FirstName,
Lead_Type1__c = Type,
Email = sender.emailAddress,
Phone = sender.phoneNumber,
Ref_Id__c = id,
RecordTypeId = rt.id,
Admin_Comments__c = details.message,
What_is_your_annual_income__c = details.annualincome,
Property_Zip_Code__c = details.zipCode,
Approximate_Value__c = details.propertyValue,
Loan_Amount__c = details.loanAmount,
Loan_Purpose__c = details.loanPurpose,
State = details.stateAbbreviation,
Property_State__c = details.stateAbbreviation,
Down_Payment__c = details.downPayment,
Property_Purpose__c = details.propertyUse
);
insert l;
if(details.propertyType == 'SingleFamilyHome'){
l.property_type__c = 'Single Family';}
if(details.propertyType == 'TownHouse'){
l.property_type__c = 'Town Home';}
if(details.propertyType == 'CondoFourOrFewerStories' || details.propertyType == 'CondoFiveOrMoreStories'){
l.property_type__c = 'Condominium';}
if(details.propertyType == 'Cooperative'){
l.property_type__c = 'Co-Op';}
if(details.propertyType == 'MobileOrManufactured'){
l.property_type__c = 'Manufactured/Mobile Home';}
if(details.propertyType == 'Modular'){
l.property_type__c = 'Modular';}
if(details.propertyType == 'Leasehold'){
l.property_type__c = 'Leasehold';}
if(details.creditScoreRange == 'R_720_739'){
l.Credit_Score__c = 'Excellent (720+)';}
if(details.creditScoreRange == 'R_680_699'){
l.Credit_Score__c = 'Good (680-719)';}
if(details.creditScoreRange == 'R_640-679'){
l.Credit_Score__c = 'Fair (640-679)';}
if(details.creditScoreRange == 'R_620_639'){
l.Credit_Score__c = 'Poor (639 or less)';}
if(details.closingTimelineDays == 90){
l.How_Soon_Are_You_Looking_to_Purchase__c = '0 to 3 months';}
if(details.closingTimelineDays == 180){
l.How_Soon_Are_You_Looking_to_Purchase__c = '3 to 6 months';}
if(details.closingTimelineDays == 365){
l.How_Soon_Are_You_Looking_to_Purchase__c = '6 to 12 months';}
if(details.closingTimelineDays == 366){
l.How_Soon_Are_You_Looking_to_Purchase__c = '12+ months';}
if(details.closingTimelineDays == 1){
l.How_Soon_Are_You_Looking_to_Purchase__c = 'Not sure, Im Just Getting Started';}
if(details.hasAgent == true){
l.Working_w_Realtor_or_Specialist__c = true;}
if(details.hasBankruptcy == true || details.hasForeclosure == true){
l.past_bankruptcy_foreclosure_short_sale__c = 'Yes';}
else
if(details.hasBankruptcy != true && details.hasForeclosure != true){
l.past_bankruptcy_foreclosure_short_sale__c = 'No';}
if(details.firstTimeBuyer == true){
l.First_Time_Home_Buyer__c = 'Yes';}
else
if(details.firstTimeBuyer == false){
l.First_Time_Home_Buyer__c = 'No';}
if(details.vaEligible == true){
l.Have_you_served_in_us_military__c = 'Yes';}
else
if(details.vaEligible == false){
l.Have_you_served_in_us_military__c = 'No';}
if(details.hasCoborrower == true){
l.Will_there_be_a_co_borrower__c = 'Yes';}
else
if(details.hasCoborrower == false){
l.Will_there_be_a_co_borrower__c = 'No';}
update l;
return 'Z Lead Created '+l.Id;
}// method
global class Sender {
global String lastName;
global String firstName;
global String phoneNumber;
global String emailAddress;
}
global class Recipient{
global string firstname;
global string lastname;
global string lenderId;
global string nmlsLicense;
global string phoneNumber;
global string emailAddress;
}
global class Details{
global List<string> desiredPrograms;
global String message;
global Decimal annualincome;
global String monthlyDebts;
global String creditScoreRange;
global boolean hasAgent;
global String zipCode;
global Decimal propertyValue;
global Boolean hasBankruptcy;
global Decimal loanAmount;
global String loanPurpose; //purchase
global Decimal loanToValuePercent;
global String propertyType; //single family home
global String stateAbbreviation;
global Boolean firstTimeBuyer;
global Decimal downPayment;
global Boolean vaEligible;
global Boolean hasForeclosure;
global String debtToIncomePercent;
global Boolean acceptPrepaymentPenalty; //
global Decimal totalAssets;
global string quoteId;
global string propertyUse; //primary
global boolean newConstruction;
global boolean selfEmployed;
global string preapprovalLetterId;
global string requestId;
global Boolean hasCoborrower;
global string creditReportId;
global Decimal creditReportScore;
global String loanRequest;
global String agentBusinessName;
global String agentEmailAddress;
global String agentFirstName;
global String agentId;
global String agentLastName;
global string agentPhoneNumber;
global Decimal cashOut;
global Decimal closingTimelineDays;
global string coborrowerFirstName;
global string coborrowerLastName;
global string currentBacker;
global decimal currentBalance;
global boolean fhaStreamlineEligible;
global boolean harpEligible;
global boolean hasSecondMortgage;
global string propertyAddress;
global boolean wantsCashOut;
global boolean vaFirstTimeUser;
global boolean vaHasDisability;
global string veteranType;
global string yearPurchased;
}
global class Contact{
global String type;
global String id;
global String created;
global String price;
}
global class quote{
global String lenderCredit;
global String termMonths;
global String dueInMonths;
global String rate;
global Decimal lockDays;
global Arm arm;
global List<fees> fees;
global Quote quote;
global Zillow zillow;
global Decimal apr;
global decimal interestOnlyMonths;
global boolean hasPrepaymentPenalty;
global boolean jumbo;
global boolean harp;
global boolean lenderPaidMortgageInsurance;
global decimal annualMortgageInsurancePremiumPercent;
global Fha fha;
global Va va;
global boolean currentBackerMustBeFannieMae;
global boolean currentBackerMustBeFreddieMac;
global decimal lenderCreditPercent;
global decimal maxAllowedLTV;
}
global class fees{
global Decimal amount;
global String name;
global Decimal hudLine;
global decimal percent;
}
global class arm{
global String index;
global String initialCap;
global String lifetimeCap;
global Decimal fixedRateMonths;
global Decimal adjustmentPeriodMonths;
global String margin;
global String periodicCap;
}
global class zillow{
global Decimal feesRolledIntoLoanAmount;
global Decimal monthlyMortgageInsurance;
global Decimal loanAmount;
global String created;
global Decimal apr;
global Decimal monthlyprincipalAndInterest;
global Decimal upfrontCost;
global Decimal points;
}
global class fha{
global decimal upfrontPremiumPercent;
global decimal annualPremiumPercent;
global boolean streamline;
}
global class va{
global decimal fundingFeePercent;
}
}// class
-
- AmandaSilber
- February 21, 2015
- Like
- 0
HELP VF 'Questionnaire' using <List>
I am creating a questionnaire that asks the same question "Do you support {!partner name}?" and would like to have a picklist field next to it with options yes/no. The partner name comes from the possible multiple records (max 10) related to the parent record.
Parent Record = Employee Onboarding
Child Records = Locations
Questionnaire Record (Also Child to Employee Onboarding) = Partnership Validation
I got all of the related {!partner name} questions on the page, via DataTable, but now I cannot have an individual yes/no for each question (without all yes/no's being the same field).
I need to figure out how to get this into a question/answer format with one question and one yes/no per line. HELP???
VF Page:
<!--**********Partners Validation Page**********-->
<apex:pageblocksection title="Partners Validation" rendered="{!Partnership_Validation__c.Space_Type__c == 'SRA'}" id="pagesection4">
<apex:datatable value="{!locspas}" var="ls" columns="1" width="100%" cellspacing="5px">
<apex:column >
<apex:pageblocksectionitem ><apex:outputlabel style="font-weight:bold" value="Do You Still Support"/><apex:outputtext value=" {!ls.Partnership_Account_Name__c}?" style="font-weight:bold"/></apex:pageblocksectionitem>
</apex:column>
</apex:datatable>
<apex:pageblocksectionitem ><apex:inputfield value="{!Partnership_Validation__c.Yes_No_partner__c}"/></apex:pageblocksectionitem>
<apex:pageblocksectionitem ><apex:inputfield value="{!Partnership_Validation__c.address_Yes_No__c}"/></apex:pageblocksectionitem>
Custom Controller:
public class pvalidationwizard {
String recordId;
Partnership_Validation__c pval;
List<Locations_Spaces__c> locspas;
public List<Locations_Spaces__c> getlocspas() {
locspas = [select Partnership_Account_Name__c from Locations_Spaces__c
where Employee__c = :ApexPages.currentPage().getParameters().get('Employee__c')];
return locspas;
}
}
any help or direction would be greatly appreciated!!
-
- AmandaSilber
- April 01, 2013
- Like
- 0
Test Class not working for Batch Apex
I have tried and tried to write and rewrite this test class and still cannot get more than 33% coverage! Please help!!!
Class:
global class MVbatch implements Database.Batchable<sObject>, Schedulable
{
date myDate = date.today();
global String Query = 'Select ID, MASA_Contract_Termination_Date__c, MASA_Contract_Effective_Date__c, A1_Amount_Payable__c, A1_Validation_Frequency__c, A2_Amount_Payable__c, A2_Validation_Frequency__c,A3_Amount_Payable__c,A3_Validation_Frequency__c, A4_Amount_Payable__c, A4_Validation_Frequency__c,A5_Amount_Payable__c,A5_Validation_Frequency__c,A6_Amount_Payable__c,A6_Validation_Frequency__c,Month_Year__c' + 'FROM Partnership_Account__c';
global Database.QueryLocator start(Database.BatchableContext bc){
return Database.getQueryLocator(Query);}
global void execute(Database.BatchableContext BC,List<sObject> scope){
List<Partnership_Account__c> lstpaccounts = new List<Partnership_Account__c>();
for(sObject s : scope){Partnership_Account__c paccount = (Partnership_Account__c)s;
if(paccount.MASA_Contract_Termination_Date__c>= myDate && paccount.MASA_Contract_Effective_Date__c <=myDate){
Marketing_Validations__c mv = new Marketing_Validations__c
(Name = paccount.Month_Year__c,
Partnership_Account__c = paccount.id,
X1_Validation_Cycle__c = paccount.C1_Validation_Frequency__c,
X2_Validation_Cycle__c = paccount.C2_Validation_Frequency__c,
X3_Validation_Cycle__c = paccount.C3_Validation_Frequency__c,
X4_Validation_Cycle__c = paccount.C4_Validation_Frequency__c,
X5_Validation_Cycle__c = paccount.C5_Validation_Frequency__c,
X6_Validation_Cycle__c = paccount.C6_Validation_Frequency__c,
X7_Validation_Cycle__c = paccount.C7_Validation_Frequency__c,
X8_Validation_Cycle__c = paccount.C8_Validation_Frequency__c,
X9_Validation_Cycle__c = paccount.C9_Validation_Frequency__c,
X10_Validation_Cycle__c =paccount.C10_Validation_Frequency__c,
X11_Validation_Cycle__c = paccount.A1_Validation_Frequency__c,
X12_Validation_Cycle__c = paccount.A2_Validation_Frequency__c,
X13_Validation_Cycle__c = paccount.A3_Validation_Frequency__c,
X14_Validation_Cycle__c = paccount.A4_Validation_Frequency__c,
X15_Validation_Cycle__c = paccount.A5_Validation_Frequency__c,
X16_Validation_Cycle__c = paccount.A6_Validation_Frequency__c,
X17_Validation_Cycle__c = paccount.A7_Validation_Frequency__c,
X18_Validation_Cycle__c = paccount.A8_Validation_Frequency__c,
X1_Amount_Payable__c= paccount.C1_Amount_Payable__c,
X2_Amount_Payable__c= paccount.C2_Amount_Payable__c,
X3_Amount_Payable__c= paccount.C3_Amount_Payable__c,
X4_Amount_Payable__c= paccount.C4_Amount_Payable__c ,
X5_Amount_Payable__c= paccount.C5_Amount_Payable__c ,
X6_Amount_Payable__c= paccount.C6_Amount_Payable__c ,
X7_Amount_Payable__c= paccount.C7_Amount_Payable__c ,
X8_Amount_Payable__c= paccount.C8_Amount_Payable__c ,
X9_Amount_Payable__c= paccount.C9_Amount_Payable__c ,
X10_Amount_Payable__c= paccount.C10_Amount_Payable__c ,
X11_Amount_Payable__c= paccount.A1_Amount_Payable__c ,
X12_Amount_Payable__c= paccount.A2_Amount_Payable__c ,
X13_Amount_Payable__c= paccount.A3_Amount_Payable__c ,
X14_Amount_Payable__c= paccount.A4_Amount_Payable__c ,
X15_Amount_Payable__c= paccount.A5_Amount_Payable__c ,
X16_Amount_Payable__c= paccount.A6_Amount_Payable__c ,
X17_Amount_Payable__c= paccount.A7_Amount_Payable__c ,
X18_Amount_Payable__c= paccount.A8_Amount_Payable__c ,
HLC_Responsible_for_MASA__c= paccount.HLC_Responsible_for_MASA__c,
HLM__c= paccount.HLM__c,
DM__c= paccount.DM__c,
BDM__c= paccount.BDM_Name__c);
insert mv;
system.debug('************' + mv.id);
}
}
}
global void finish(Database.BatchableContext BC)
{
}
global void execute(SchedulableContext sc)
{
}
}Test Class:
@isTest
private class testmvbatch{
static testmethod void test() {
String query = 'Select ID, MASA_Contract_Termination_Date__c, MASA_Contract_Effective_Date__c, A1_Amount_Payable__c, Month_Year__c' +
'FROM Partnership_Account__c' + 'WHERE MASA_Contract_Termination_Date__c <= today()';
Partnership_Account__c[] palist = new List<Partnership_Account__c>();
for (integer i=0; i<10;i++) {
Partnership_Account__c pa = new Partnership_Account__c (Name = 'testaccount' + i, MASA_Contract_Termination_Date__c = date.today(), MASA_Contract_Effective_Date__c = date.today(), A1_Amount_Payable__c = 123.45);
palist.add(pa);
}
insert palist;
test.startTest();
mvbatch mb=new mvbatch();
database.executebatch(mb,200);
test.stopTest();
}
}
Any help would be REALLY appreciated!! Thanks!!
-
- AmandaSilber
- March 04, 2013
- Like
- 0
Apex.Scheduler.Not.Working...I think it's my code.
Hello everyone and Happy FRIDAY!!
I have the task of creating a child record for a custom object automatically on a the first of the Month. This is probably something extremely simple - but I am only a pretend developer (I'm teaching myself as I go...) Any help will be greatly appreciated!!
Here's the layout:
Parent Object: Locations_Spaces__c
Child Object: Partnership_Validation__c
I need one validation record created on the first of every month for each Location/Space record.
Here is my class - along with this, I have the Apex Schedule for everyday (resetting the time every time I make what I think is a good tweak to my code in order to test).
global class pvalschedule implements Schedulable
{
global void execute(SchedulableContext ctx)
{
Locations_Spaces__c location =[Select ID,Employee__c from Locations_Spaces__c];
if(location <> Null){
Partnership_Validation__c pval = new Partnership_Validation__c
(Name = ('SRA Validation'+location.Month__c+location.Year__c),
Employee__c = location.Employee__c,
Locations_Spaces__c = location.ID,
RecordTypeID = '012Q0000000D6nc',
OwnerID= location.OwnerID);
insert pval;
}
}
}
-
- AmandaSilber
- January 18, 2013
- Like
- 0
Javascript custom button - I need help!
I'm basically just learning as I go here - so bear with me!
I have a custom button on a custom object detail page that when clicked, I would like for it to create a child record and then update the lookupfield with the newly created child record.id on the parent record.
Here is the code I have - the first part works fine - the record creates seamlessly. The second part updating the lookup field does not work - I've altered, googled, altered, studied, and altered again with absolutely nothing working.
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")} {!Partnership_Employees__c.Employee_Onboarding__c}
var copyonboarding = new sforce.SObject("Employee_Onboarding__c");
copyonboarding.Partnership_Employee__c = "{!Partnership_Employees__c.Id}";
copyonboarding.Name = "{!Partnership_Employees__c.Employee__c }";
copyonboardingID = copyonboarding.get("ID");
sforce.connection.create([copyonboarding]);
//update employee record
var employee = new sforce.SObject("Partnership_Employees__c")
employee.Employee_Onboarding__c = copyonboardingID;
sforce.connection.update([employee]);
window.alert("Employee Onboarding Created");
window.location.reload();
-
- AmandaSilber
- January 10, 2013
- Like
- 0
VF page not showing 'saved' values
I have two custom vf pages an edit page (to input fields) and a detail page (to view the record) I put a controller on the edit page that saves the record and then redirects to the detail page. When I click the save button, it redirects to the detail page, but there is none of the information in the page that I just input - but when I go back to the list view, the information had been saved. I think I need to add something in the controller to place the id, but I'm not sure how.
I am not at all a developer and this is my first shot at a custom visualforce page as a higher level admin. I'm sorry if it's horrid or messy I am self-teaching as I go! =(
Controller Extension:
public class NewPVal{
ApexPages.StandardController controller;
public NewPVal(ApexPages.StandardController con){
controller = con;
}
public PageReference save()
{ controller.save();
return page.EmployeeValidation;
}
public PageReference cancel()
{ controller.cancel();
return null;
}
}Edit page:
<apex:page standardController="Partnership_Validation__c" extensions="NewPVal" showHeader="true" title="Employee Validation Edit">
<apex:form id="PartnershipValidation">
<apex:pageBlock >
<apex:facet name="header"><h1>Partnership Account Edit</h1></apex:facet>
<br><h2><style> h2 {font-size:1.875em;}</style>{!Partnership_Validation__c.Name}</h2></br>
<apex:pageBlockButtons location="both" >
<br><apex:commandButton value="Submit Validation" action="{!Save}"/> <apex:commandButton value="Cancel" action="{!Cancel}" onclick="return confirmCancel()"/></br> </apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockSection title="Employee Information">
<apex:inputField value="{!Partnership_Validation__c.HLC_Name__c}"/>
<apex:inputField value="{!Partnership_Validation__c.HLC_Status__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partnership_Employee__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())= 1,true,false)}">
<apex:pageBlock id="block1">
<apex:pageBlockSection title="January Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block1"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!IF(CONTAINS(Partnership_Validation__c.Partner_provided_furniture_utilized__c, 'Other (indicate other below)'),true,false)}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())= 1,true,false)}">
<apex:pageBlock id="block2">
<apex:pageBlockSection title="February Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block3">
<apex:pageBlockSection title="March Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block3"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block4" >
<apex:pageBlockSection title="April Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block4"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!(Partnership_Validation__c.Partner_provided_furniture_utilized__c = "Other (indicate other below)")}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block5">
<apex:pageBlockSection title="May Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block6">
<apex:pageBlockSection title="June Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block6"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block7" >
<apex:pageBlockSection title="July Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block1"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!(Partnership_Validation__c.Partner_provided_furniture_utilized__c = "Other (indicate other below)")}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block8">
<apex:pageBlockSection title="August Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block9">
<apex:pageBlockSection title="September Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block9"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())= 1,true,false)}">
<apex:pageBlock id="block10" >
<apex:pageBlockSection title="October Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block10"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!(Partnership_Validation__c.Partner_provided_furniture_utilized__c = "Other (indicate other below)")}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())=1,true,false)}">
<apex:pageBlock id="block11">
<apex:pageBlockSection title="November Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block12">
<apex:pageBlockSection title="December Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block12"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion >
<apex:pageBlock >
<apex:pageBlockSection title="System Information">
<apex:inputField value="{!Partnership_Validation__c.Name}"/>
<apex:outputField value="{!Partnership_Validation__c.CreatedDate}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
</apex:form>
</apex:page>
Any help at all would be extremely appreciated!!! (and if you see something in all of that mess that I could do better in a different way, please feel free to point it out - I am trying to learn all of this from no experience at all in developing so any pointers would be helpful!)
Thanks!
-
- AmandaSilber
- January 02, 2013
- Like
- 0
Generate PDF Invoice & Create Invoice Tracking Record & Attach Generated PDF to New Record??
I have tried so many different things to try to get this accomplished and I just can't figure it out! It's driving me crazy, I've spent so many hours getting error after error.
So, any help would be greatly appreciated!!
I have a custom button on the parent record that 1. Creates a .pdf through a visualforce page using data within the parent record (Invoice) and 2. Creates a child record "Partnership Invoice Tracking".
I would like a third action to fire as well - attach the created .pdf to the newly created Partnership Invoice Tracking record. I've been so close so many times, but kept getting " Expected ';' " errors.
Here is the code I have that performs the two above referenced actions:
________________________________________________________________________________
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
var newRecords = [];
var PA = new sforce.SObject("Partnership_Account__c ");
var PAStatus__c = "{!Partnership_Account__c.Status__c }"
if(PAStatus__c == "Active")
{
window.open("{!URLFOR('apex/partnershipAccountpdf?id=' + Partnership_Account__c.Id )}");
}
else
{
alert('Only active Partnership Accounts will generate the Invoice. Please change the Status field value to Active in the Partnership Account record to generate the invoice.');
}
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
// purpose: onClick() event handler
// author: Amanda Silber
// dated: November 2, 2012
var createList = [];
var copyPartnershipInvoiceTracking = new sforce.SObject("Partnership_Invoice_Tracking__c");
copyPartnershipInvoiceTracking.Partnership_Account__c = "{!Partnership_Account__c.Id}";
var tDate = sforce.internal.dateTimeToString(new Date());
//set name on record
copyPartnershipInvoiceTracking.Name = "{!Partnership_Account__c.Invoice_Number__c}";
copyPartnershipInvoiceTracking.Contract_Addendum_Type__c = "SRA";
createList.push(copyPartnershipInvoiceTracking);
sforce.connection.create(createList);
window.alert("Partnership Invoice Tracking Record Created");
parent.window.location.reload();
___________________________________________________________________________
Thank you in advance!!
-
- AmandaSilber
- November 27, 2012
- Like
- 0
URGENT!! I'm deploying and my original test class isn't working!
@RestResource(urlMapping='/ZLead/*')
global class ZRestAPI {
@HttpPost
global static String createLead(Sender sender,Details details,String type,String id,String created, Recipient recipient, String price, Quote quote, Arm arm, Z z, Fees fees) {
RecordType rt = [select ID, name from RecordType where name='Z'];
Lead l =new Lead(LastName = sender.lastName,
FirstName = sender.FirstName,
Lead_Type1__c = Type,
Email = sender.emailAddress,
Phone = sender.phoneNumber,
Ref_Id__c = id,
RecordTypeId = rt.id,
Admin_Comments__c = details.message,
What_is_your_annual_income__c = details.annualincome,
Property_Zip_Code__c = details.zipCode,
Approximate_Value__c = details.propertyValue,
Loan_Amount__c = details.loanAmount,
Loan_Purpose__c = details.loanPurpose,
State = details.stateAbbreviation,
Property_State__c = details.stateAbbreviation,
Down_Payment__c = details.downPayment,
Property_Purpose__c = details.propertyUse
);
insert l;
if(details.propertyType == 'SingleFamilyHome'){
l.property_type__c = 'Single Family';}
if(details.propertyType == 'TownHouse'){
l.property_type__c = 'Town Home';}
if(details.propertyType == 'CondoFourOrFewerStories' || details.propertyType == 'CondoFiveOrMoreStories'){
l.property_type__c = 'Condominium';}
if(details.propertyType == 'Cooperative'){
l.property_type__c = 'Co-Op';}
if(details.propertyType == 'MobileOrManufactured'){
l.property_type__c = 'Manufactured/Mobile Home';}
if(details.propertyType == 'Modular'){
l.property_type__c = 'Modular';}
if(details.propertyType == 'Leasehold'){
l.property_type__c = 'Leasehold';}
if(details.creditScoreRange == 'R_720_739'){
l.Credit_Score__c = 'Excellent (720+)';}
if(details.creditScoreRange == 'R_680_699'){
l.Credit_Score__c = 'Good (680-719)';}
if(details.creditScoreRange == 'R_640-679'){
l.Credit_Score__c = 'Fair (640-679)';}
if(details.creditScoreRange == 'R_620_639'){
l.Credit_Score__c = 'Poor (639 or less)';}
if(details.closingTimelineDays == 90){
l.How_Soon_Are_You_Looking_to_Purchase__c = '0 to 3 months';}
if(details.closingTimelineDays == 180){
l.How_Soon_Are_You_Looking_to_Purchase__c = '3 to 6 months';}
if(details.closingTimelineDays == 365){
l.How_Soon_Are_You_Looking_to_Purchase__c = '6 to 12 months';}
if(details.closingTimelineDays == 366){
l.How_Soon_Are_You_Looking_to_Purchase__c = '12+ months';}
if(details.closingTimelineDays == 1){
l.How_Soon_Are_You_Looking_to_Purchase__c = 'Not sure, Im Just Getting Started';}
if(details.hasAgent == true){
l.Working_w_Realtor_or_Specialist__c = true;}
if(details.hasBankruptcy == true || details.hasForeclosure == true){
l.past_bankruptcy_foreclosure_short_sale__c = 'Yes';}
else
if(details.hasBankruptcy != true && details.hasForeclosure != true){
l.past_bankruptcy_foreclosure_short_sale__c = 'No';}
if(details.firstTimeBuyer == true){
l.First_Time_Home_Buyer__c = 'Yes';}
else
if(details.firstTimeBuyer == false){
l.First_Time_Home_Buyer__c = 'No';}
if(details.vaEligible == true){
l.Have_you_served_in_us_military__c = 'Yes';}
else
if(details.vaEligible == false){
l.Have_you_served_in_us_military__c = 'No';}
if(details.hasCoborrower == true){
l.Will_there_be_a_co_borrower__c = 'Yes';}
else
if(details.hasCoborrower == false){
l.Will_there_be_a_co_borrower__c = 'No';}
update l;
return 'Z Lead Created '+l.Id;
}// method
global class Sender {
global String lastName;
global String firstName;
global String phoneNumber;
global String emailAddress;
}
global class Recipient{
global string firstname;
global string lastname;
global string lenderId;
global string nmlsLicense;
global string phoneNumber;
global string emailAddress;
}
global class Details{
global List<string> desiredPrograms;
global String message;
global Decimal annualincome;
global String monthlyDebts;
global String creditScoreRange;
global boolean hasAgent;
global String zipCode;
global Decimal propertyValue;
global Boolean hasBankruptcy;
global Decimal loanAmount;
global String loanPurpose; //purchase
global Decimal loanToValuePercent;
global String propertyType; //single family home
global String stateAbbreviation;
global Boolean firstTimeBuyer;
global Decimal downPayment;
global Boolean vaEligible;
global Boolean hasForeclosure;
global String debtToIncomePercent;
global Boolean acceptPrepaymentPenalty; //
global Decimal totalAssets;
global string quoteId;
global string propertyUse; //primary
global boolean newConstruction;
global boolean selfEmployed;
global string preapprovalLetterId;
global string requestId;
global Boolean hasCoborrower;
global string creditReportId;
global Decimal creditReportScore;
global String loanRequest;
global String agentBusinessName;
global String agentEmailAddress;
global String agentFirstName;
global String agentId;
global String agentLastName;
global string agentPhoneNumber;
global Decimal cashOut;
global Decimal closingTimelineDays;
global string coborrowerFirstName;
global string coborrowerLastName;
global string currentBacker;
global decimal currentBalance;
global boolean fhaStreamlineEligible;
global boolean harpEligible;
global boolean hasSecondMortgage;
global string propertyAddress;
global boolean wantsCashOut;
global boolean vaFirstTimeUser;
global boolean vaHasDisability;
global string veteranType;
global string yearPurchased;
}
global class Contact{
global String type;
global String id;
global String created;
global String price;
}
global class quote{
global String lenderCredit;
global String termMonths;
global String dueInMonths;
global String rate;
global Decimal lockDays;
global Arm arm;
global List<fees> fees;
global Quote quote;
global Zillow zillow;
global Decimal apr;
global decimal interestOnlyMonths;
global boolean hasPrepaymentPenalty;
global boolean jumbo;
global boolean harp;
global boolean lenderPaidMortgageInsurance;
global decimal annualMortgageInsurancePremiumPercent;
global Fha fha;
global Va va;
global boolean currentBackerMustBeFannieMae;
global boolean currentBackerMustBeFreddieMac;
global decimal lenderCreditPercent;
global decimal maxAllowedLTV;
}
global class fees{
global Decimal amount;
global String name;
global Decimal hudLine;
global decimal percent;
}
global class arm{
global String index;
global String initialCap;
global String lifetimeCap;
global Decimal fixedRateMonths;
global Decimal adjustmentPeriodMonths;
global String margin;
global String periodicCap;
}
global class zillow{
global Decimal feesRolledIntoLoanAmount;
global Decimal monthlyMortgageInsurance;
global Decimal loanAmount;
global String created;
global Decimal apr;
global Decimal monthlyprincipalAndInterest;
global Decimal upfrontCost;
global Decimal points;
}
global class fha{
global decimal upfrontPremiumPercent;
global decimal annualPremiumPercent;
global boolean streamline;
}
global class va{
global decimal fundingFeePercent;
}
}// class

- AmandaSilber
- February 21, 2015
- Like
- 0
Testing Salesforce RestApi : INVALID_SESSION_ID
I am facing an issue while testing a RestApi service using cURL. I am getting "INVALID_SESSION_ID" error everytime.
Here are the steps I followed:
1. Create a rest apex class.
@RestResource(urlMapping ='/Cases/*')
global class getCases
{
@HttpPost
global static List<Case> fetchCase(String limits,Date startDate, Date endDate)
{
List<Case> lstCase;
try
{
RestRequest req = RestContext.request;
Integer intLimit = Integer.valueOf(req.params.get('limits'));
DateTime strtDate = DateTime.valueOfGmt((req.params.get('startDate')).replaceAll('/','-'));
DateTime enDate = DateTime.valueOfGmt((req.params.get('endDate')).replaceAll('/','-'));
lstCase = [Select Id,OwnerId,CaseNumber from Case where createdDate>=: strtDate and createdDate<=:enDate limit :intLimit];
return lstCase;
}
catch(Exception e)
{
system.debug('Exception'+e);
}
return lstCase;
}
}
2. Create a connected app with Callback URL as "https://ap1.salesforce.com/services/oauth2/token"
3. Call the web service using cURL:
curl --form client_id=XXXXXXX.000XXXXXX --form client_secret=000999999--form grant_type=password --form username=gupta.pathikrit@domain.com --form password=*********** -k https://ap1.salesforce.com/services/oauth2/token
This call gave the access_token which I used to make a HTTP Post call:
curl https://ap1.salesforce.com/services/apexrest/Cases/ -H "Authorization: OAuth 00XXXXXPPP" -H "Content-Type:application/json" -d @C:\input.json -k
This is resulting in the following error:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
Can anyone help me here?
Regards,
Pathikrit

- Pathikrit
- February 22, 2014
- Like
- 0
Test Class not working for Batch Apex
I have tried and tried to write and rewrite this test class and still cannot get more than 33% coverage! Please help!!!
Class:
global class MVbatch implements Database.Batchable<sObject>, Schedulable
{
date myDate = date.today();
global String Query = 'Select ID, MASA_Contract_Termination_Date__c, MASA_Contract_Effective_Date__c, A1_Amount_Payable__c, A1_Validation_Frequency__c, A2_Amount_Payable__c, A2_Validation_Frequency__c,A3_Amount_Payable__c,A3_Validation_Frequency__c, A4_Amount_Payable__c, A4_Validation_Frequency__c,A5_Amount_Payable__c,A5_Validation_Frequency__c,A6_Amount_Payable__c,A6_Validation_Frequency__c,Month_Year__c' + 'FROM Partnership_Account__c';
global Database.QueryLocator start(Database.BatchableContext bc){
return Database.getQueryLocator(Query);}
global void execute(Database.BatchableContext BC,List<sObject> scope){
List<Partnership_Account__c> lstpaccounts = new List<Partnership_Account__c>();
for(sObject s : scope){Partnership_Account__c paccount = (Partnership_Account__c)s;
if(paccount.MASA_Contract_Termination_Date__c>= myDate && paccount.MASA_Contract_Effective_Date__c <=myDate){
Marketing_Validations__c mv = new Marketing_Validations__c
(Name = paccount.Month_Year__c,
Partnership_Account__c = paccount.id,
X1_Validation_Cycle__c = paccount.C1_Validation_Frequency__c,
X2_Validation_Cycle__c = paccount.C2_Validation_Frequency__c,
X3_Validation_Cycle__c = paccount.C3_Validation_Frequency__c,
X4_Validation_Cycle__c = paccount.C4_Validation_Frequency__c,
X5_Validation_Cycle__c = paccount.C5_Validation_Frequency__c,
X6_Validation_Cycle__c = paccount.C6_Validation_Frequency__c,
X7_Validation_Cycle__c = paccount.C7_Validation_Frequency__c,
X8_Validation_Cycle__c = paccount.C8_Validation_Frequency__c,
X9_Validation_Cycle__c = paccount.C9_Validation_Frequency__c,
X10_Validation_Cycle__c =paccount.C10_Validation_Frequency__c,
X11_Validation_Cycle__c = paccount.A1_Validation_Frequency__c,
X12_Validation_Cycle__c = paccount.A2_Validation_Frequency__c,
X13_Validation_Cycle__c = paccount.A3_Validation_Frequency__c,
X14_Validation_Cycle__c = paccount.A4_Validation_Frequency__c,
X15_Validation_Cycle__c = paccount.A5_Validation_Frequency__c,
X16_Validation_Cycle__c = paccount.A6_Validation_Frequency__c,
X17_Validation_Cycle__c = paccount.A7_Validation_Frequency__c,
X18_Validation_Cycle__c = paccount.A8_Validation_Frequency__c,
X1_Amount_Payable__c= paccount.C1_Amount_Payable__c,
X2_Amount_Payable__c= paccount.C2_Amount_Payable__c,
X3_Amount_Payable__c= paccount.C3_Amount_Payable__c,
X4_Amount_Payable__c= paccount.C4_Amount_Payable__c ,
X5_Amount_Payable__c= paccount.C5_Amount_Payable__c ,
X6_Amount_Payable__c= paccount.C6_Amount_Payable__c ,
X7_Amount_Payable__c= paccount.C7_Amount_Payable__c ,
X8_Amount_Payable__c= paccount.C8_Amount_Payable__c ,
X9_Amount_Payable__c= paccount.C9_Amount_Payable__c ,
X10_Amount_Payable__c= paccount.C10_Amount_Payable__c ,
X11_Amount_Payable__c= paccount.A1_Amount_Payable__c ,
X12_Amount_Payable__c= paccount.A2_Amount_Payable__c ,
X13_Amount_Payable__c= paccount.A3_Amount_Payable__c ,
X14_Amount_Payable__c= paccount.A4_Amount_Payable__c ,
X15_Amount_Payable__c= paccount.A5_Amount_Payable__c ,
X16_Amount_Payable__c= paccount.A6_Amount_Payable__c ,
X17_Amount_Payable__c= paccount.A7_Amount_Payable__c ,
X18_Amount_Payable__c= paccount.A8_Amount_Payable__c ,
HLC_Responsible_for_MASA__c= paccount.HLC_Responsible_for_MASA__c,
HLM__c= paccount.HLM__c,
DM__c= paccount.DM__c,
BDM__c= paccount.BDM_Name__c);
insert mv;
system.debug('************' + mv.id);
}
}
}
global void finish(Database.BatchableContext BC)
{
}
global void execute(SchedulableContext sc)
{
}
}Test Class:
@isTest
private class testmvbatch{
static testmethod void test() {
String query = 'Select ID, MASA_Contract_Termination_Date__c, MASA_Contract_Effective_Date__c, A1_Amount_Payable__c, Month_Year__c' +
'FROM Partnership_Account__c' + 'WHERE MASA_Contract_Termination_Date__c <= today()';
Partnership_Account__c[] palist = new List<Partnership_Account__c>();
for (integer i=0; i<10;i++) {
Partnership_Account__c pa = new Partnership_Account__c (Name = 'testaccount' + i, MASA_Contract_Termination_Date__c = date.today(), MASA_Contract_Effective_Date__c = date.today(), A1_Amount_Payable__c = 123.45);
palist.add(pa);
}
insert palist;
test.startTest();
mvbatch mb=new mvbatch();
database.executebatch(mb,200);
test.stopTest();
}
}
Any help would be REALLY appreciated!! Thanks!!

- AmandaSilber
- March 04, 2013
- Like
- 0
Apex.Scheduler.Not.Working...I think it's my code.
Hello everyone and Happy FRIDAY!!
I have the task of creating a child record for a custom object automatically on a the first of the Month. This is probably something extremely simple - but I am only a pretend developer (I'm teaching myself as I go...) Any help will be greatly appreciated!!
Here's the layout:
Parent Object: Locations_Spaces__c
Child Object: Partnership_Validation__c
I need one validation record created on the first of every month for each Location/Space record.
Here is my class - along with this, I have the Apex Schedule for everyday (resetting the time every time I make what I think is a good tweak to my code in order to test).
global class pvalschedule implements Schedulable
{
global void execute(SchedulableContext ctx)
{
Locations_Spaces__c location =[Select ID,Employee__c from Locations_Spaces__c];
if(location <> Null){
Partnership_Validation__c pval = new Partnership_Validation__c
(Name = ('SRA Validation'+location.Month__c+location.Year__c),
Employee__c = location.Employee__c,
Locations_Spaces__c = location.ID,
RecordTypeID = '012Q0000000D6nc',
OwnerID= location.OwnerID);
insert pval;
}
}
}

- AmandaSilber
- January 18, 2013
- Like
- 0
VF page not showing 'saved' values
I have two custom vf pages an edit page (to input fields) and a detail page (to view the record) I put a controller on the edit page that saves the record and then redirects to the detail page. When I click the save button, it redirects to the detail page, but there is none of the information in the page that I just input - but when I go back to the list view, the information had been saved. I think I need to add something in the controller to place the id, but I'm not sure how.
I am not at all a developer and this is my first shot at a custom visualforce page as a higher level admin. I'm sorry if it's horrid or messy I am self-teaching as I go! =(
Controller Extension:
public class NewPVal{
ApexPages.StandardController controller;
public NewPVal(ApexPages.StandardController con){
controller = con;
}
public PageReference save()
{ controller.save();
return page.EmployeeValidation;
}
public PageReference cancel()
{ controller.cancel();
return null;
}
}Edit page:
<apex:page standardController="Partnership_Validation__c" extensions="NewPVal" showHeader="true" title="Employee Validation Edit">
<apex:form id="PartnershipValidation">
<apex:pageBlock >
<apex:facet name="header"><h1>Partnership Account Edit</h1></apex:facet>
<br><h2><style> h2 {font-size:1.875em;}</style>{!Partnership_Validation__c.Name}</h2></br>
<apex:pageBlockButtons location="both" >
<br><apex:commandButton value="Submit Validation" action="{!Save}"/> <apex:commandButton value="Cancel" action="{!Cancel}" onclick="return confirmCancel()"/></br> </apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockSection title="Employee Information">
<apex:inputField value="{!Partnership_Validation__c.HLC_Name__c}"/>
<apex:inputField value="{!Partnership_Validation__c.HLC_Status__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partnership_Employee__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())= 1,true,false)}">
<apex:pageBlock id="block1">
<apex:pageBlockSection title="January Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block1"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!IF(CONTAINS(Partnership_Validation__c.Partner_provided_furniture_utilized__c, 'Other (indicate other below)'),true,false)}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())= 1,true,false)}">
<apex:pageBlock id="block2">
<apex:pageBlockSection title="February Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block3">
<apex:pageBlockSection title="March Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block3"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block4" >
<apex:pageBlockSection title="April Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block4"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!(Partnership_Validation__c.Partner_provided_furniture_utilized__c = "Other (indicate other below)")}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block5">
<apex:pageBlockSection title="May Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block6">
<apex:pageBlockSection title="June Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block6"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block7" >
<apex:pageBlockSection title="July Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block1"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!(Partnership_Validation__c.Partner_provided_furniture_utilized__c = "Other (indicate other below)")}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block8">
<apex:pageBlockSection title="August Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block9">
<apex:pageBlockSection title="September Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block9"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())= 1,true,false)}">
<apex:pageBlock id="block10" >
<apex:pageBlockSection title="October Validation">
<apex:inputField value="{!Partnership_Validation__c.Days_per_month_you_reside_at_SRA__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Partner_provided_furniture_utilized__c}">
<apex:actionSupport event="onchange" rerender="block10"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Type_of_space_you_occupy__c}"/>
<apex:inputField value="{!Partnership_Validation__c.Other_Furniture__c}" rendered="{!(Partnership_Validation__c.Partner_provided_furniture_utilized__c = "Other (indicate other below)")}"/>
<apex:inputField value="{!Partnership_Validation__c.Size_of_the_space_you_occupy_sqft__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY())=1,true,false)}">
<apex:pageBlock id="block11">
<apex:pageBlockSection title="November Validation">
<apex:inputField value="{!Partnership_Validation__c.Citi_Issued_Equiptment__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion rendered="{!IF(MONTH(TODAY()) = 1,true,false)}">
<apex:pageBlock id="block12">
<apex:pageBlockSection title="December Validation">
<apex:inputField value="{!Partnership_Validation__c.Choose_customer_disclosures_displayed__c}">
<apex:actionSupport event="onchange" rerender="block12"/>
</apex:inputField>
<apex:inputField value="{!Partnership_Validation__c.Specify_Other_Disclosures__c}" rendered="{!(Partnership_Validation__c.Choose_customer_disclosures_displayed__c = "Other")}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
<apex:actionRegion >
<apex:pageBlock >
<apex:pageBlockSection title="System Information">
<apex:inputField value="{!Partnership_Validation__c.Name}"/>
<apex:outputField value="{!Partnership_Validation__c.CreatedDate}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:actionRegion>
</apex:form>
</apex:page>
Any help at all would be extremely appreciated!!! (and if you see something in all of that mess that I could do better in a different way, please feel free to point it out - I am trying to learn all of this from no experience at all in developing so any pointers would be helpful!)
Thanks!

- AmandaSilber
- January 02, 2013
- Like
- 0
Generate PDF Invoice & Create Invoice Tracking Record & Attach Generated PDF to New Record??
I have tried so many different things to try to get this accomplished and I just can't figure it out! It's driving me crazy, I've spent so many hours getting error after error.
So, any help would be greatly appreciated!!
I have a custom button on the parent record that 1. Creates a .pdf through a visualforce page using data within the parent record (Invoice) and 2. Creates a child record "Partnership Invoice Tracking".
I would like a third action to fire as well - attach the created .pdf to the newly created Partnership Invoice Tracking record. I've been so close so many times, but kept getting " Expected ';' " errors.
Here is the code I have that performs the two above referenced actions:
________________________________________________________________________________
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/14.0/apex.js")}
var newRecords = [];
var PA = new sforce.SObject("Partnership_Account__c ");
var PAStatus__c = "{!Partnership_Account__c.Status__c }"
if(PAStatus__c == "Active")
{
window.open("{!URLFOR('apex/partnershipAccountpdf?id=' + Partnership_Account__c.Id )}");
}
else
{
alert('Only active Partnership Accounts will generate the Invoice. Please change the Status field value to Active in the Partnership Account record to generate the invoice.');
}
{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")}
// purpose: onClick() event handler
// author: Amanda Silber
// dated: November 2, 2012
var createList = [];
var copyPartnershipInvoiceTracking = new sforce.SObject("Partnership_Invoice_Tracking__c");
copyPartnershipInvoiceTracking.Partnership_Account__c = "{!Partnership_Account__c.Id}";
var tDate = sforce.internal.dateTimeToString(new Date());
//set name on record
copyPartnershipInvoiceTracking.Name = "{!Partnership_Account__c.Invoice_Number__c}";
copyPartnershipInvoiceTracking.Contract_Addendum_Type__c = "SRA";
createList.push(copyPartnershipInvoiceTracking);
sforce.connection.create(createList);
window.alert("Partnership Invoice Tracking Record Created");
parent.window.location.reload();
___________________________________________________________________________
Thank you in advance!!

- AmandaSilber
- November 27, 2012
- Like
- 0
sObject List to string conversion
hi,
i have a List<sObject>, by looping this list, i wanna compare the values from this list to another string list, for doing this, i have to convert the values from this list to string, so how can i achieve this functionality...?
How to convert the sObject values to string???
Thanks,
abivenkat,
SFDC Learner

- abivenkat
- January 10, 2012
- Like
- 0