• Quiquepr
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies

Hello:

 

I am creating a list button to mass create new opportuies based on records from a custom object.  I am in a bind to get this into production early next week and would appreciate the communities help...

 

We have a policy sales record (PSR) custom object  and need to create renewal opportunities from selected records in a policy sales record  list view.  I have very little Javascript knowledge but using several postings from the boards & blogs I came up with the following code that throws the following error after selecting the policies in the view and clicking on the button to execute.  

 

When clicking onthe button we want to create new opportunities of a specific record type and prepopulate sevaral key records from the values on the policy sales record.

 

 

Error message in a windows  dialog box:
A problem with the OnClick JavaScript for this button or link was encountered:
unterminated string literal
I have reviewed the code and cannot find where these error seems to be coming from as the code in my limited knowledge seem properly formed.
Also, I am not sure if the insert portion is the correct syntax for Javascript to push the insert of the new records.

 

 

Here is the code for my button:

 

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}    //adds the proper code for inclusion of AJAX toolkit
var url = parent.location.href;    //string for the URL of the current page
var records = {!GETRECORDIDS($ObjectType.Policy_Sales_Record__c)};    //grabs the Policy Sales Records records that the user is requesting to update
var CreateNewRecords = [];    //array for holding records that this code will ultimately update

if (records[0] == null) { //if the button was clicked but there was no record selected
	alert("Please select at least one record to update.");    //alert the user that they didn't make a selection 
} else {   //otherwise, there was a record selection
	for (var a=0; a<records.length; a++) {    //for all records
		var create_new_opportunity = new sforce.SObject("opportunity");    //create a new sObject for storing updated record details
		create_new_opportunity.RecordTypeId = "012A0000000R4UX";    //set the record type to Renewal Opportunities
		create_new_opportunity.AccountId = "{!Policy_Sales_Record__c.Account__c}";    //set the account ID value from PSR 
		create_new_opportunity.Closedate = "{!Policy_Sales_Record__c.Policy_Renewal_Date__c}";     //set the value for renewal date from policy data
		create_new_opportunity.OwnerId = "{!Policy_Sales_Record__c.Account_Owner__c}";    //set the value for account owner
		create_new_opportunity.Primary_Producer__c = "{!Policy_Sales_Record__c.Producer__c}";    //set the value for the producer
		create_new_opportunity.Renewal_Base_Premium__c = "{!Policy_Sales_Record__c.Renewal_Base_Premium__c}"
		create_new_opportunity.Renewal_Base_No_of_Contracts__c = {!Policy_Sales_Record__c.Renewal_Base_No_of_Contracts__c}";

		CreateNewRecords.push(create_new_opportunity);   //add the updated record to our array
	}
	result = sforce.connection.insert(CreateNewRecords);    //insert new records into to Salesforce
	parent.location.href = url; //refresh the page
}

 

 

Regards and thanks in advance

 

Quique

 

I am trying to put Printable View option on a VF page and I am using PrintUrl attribute in Apex:sectionheader tag. my code is similar to this. but if I click on the Printable View the popup window is not coming in the same format as we get for standard pages. Is there any working around or am I missing something. Please help me. Thanks in advance.

 

PK

 

<apex:sectionHeader title="Page Title" printUrl="/apex/SamplePage?Id={!companyId}"/>

Hi,

 

I have been charged with creating a report that displays only opportunities that do not have opportunity partner related records; however, I do not see the Opportunity Partner related table as an option when creating custom report types and I do not see how custom report types allow you to create a type that returns only records in the parent that have no children?

 

Is there a way to do this in a simple report?  If it is not then how can I create a SOQL that can do it?  If I have a SOQL that can do it I can use it in code to populate a custom table then use that custom table in a report?

 

Any ideas?

Hello all,

 

Long time lurker, first time poster. I'm trying to create a custom button for my lead view that will:

 

1. Fire an email template to a lead

2. Update a status field

3. Return the user to the lead view

 

Here's what I've got so far - it fires the template but does NOT update the status. Can someone point me in the right direction?

 

location.replace('/email/author/emailauthor.jsp?p2_lkid={!Lead.Id}&retURL=%2F{!Lead.Id}&template_id=00X40000001B4fY&{!URLFOR($Action.Lead.Edit, Lead.Id, [retURL=URLFOR($Action.Lead.View, Lead.Id), lea13_ileinner ="First email and call attempt made", save=1] )}')

 

Much appreciated!

 

Christopher S. Penn | cspenn@gmail.com

I have a simple page to display our customer references on our web site via sites.  I chek the page within salesforce and renders just fine, but when I go through sites, only the table column headers show and no data on the table.

 

 

 

The fields are based on account object and also have a puyblish fla field.  Also the logo url field presents the location of the logo.  All the logos are in customer logo folder under the documents tabs and all have a external view value of true.  Security is public read write.

 

 

I have granted read access on the site publi settgins to the guest profile for the specfific site.

 

Any ideas anyone?

 

 

Here is the page

<apex:page controller="ValueCustomerListing" showHeader="false" cache="true" expires="0">
<site:googleAnalyticsTracking />
<apex:image url="http://tvmcompany.com/images/logo.gif" />
<br/>
<apex:dataTable value="{!accounts}" var="account" id="thelist" rowClasses="odd,even"
styleClass="tableClass" cellpadding="5" cellspacing="4">
<apex:column >
<apex:image alt="Logo Not Available" width="125" url="{!account.Logo_Location__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Organization</apex:facet>
<apex:outputText style="center" value="{!account.name}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Industry</apex:facet>
<apex:outputText style="center" value="{!account.industry}"/>
</apex:column>
</apex:dataTable>
</apex:page>

 

 

Here is the controller

 

public with sharing class ValueCustomerListing {
List<Account> accounts;
public List<Account> getAccounts(){
accounts = [select name, industry, logo_location__c from account WHERE valuecloud_publish__c = TRUE ORDER BY Name];
return accounts;
}
}

 

 

When accessed via sites, this page only renders the following (no data table....)



Organization
Industry

 

 

This the sfdc internal page (but is shows the logos.)

 


Organization
Industry
Logo Not AvailableCentennial Communications de Puerto RicoTelecommunications & Technology
Logo Not AvailableFideicomiso de Conservacion de Puerto RicoEnvironmental
Logo Not AvailableHumano ARSFinance, Insurance, Real Estate
Logo Not AvailableLiberty Cablevision Puerto RicoTelecommunications & Technology
 
Logo Not AvailableSistema de Retiro de MaestrosPublic Sector
Logo Not AvailableThe Value Management CompanyConsulting
Logo Not AvailableWireless IdeaEnterntainment
Logo Not AvailableWorldNet TelecommunicationsTelecommunications & Technology

I am trying to create a page using the BlankTemplate based on a VF page I created with a custom controller using CMSForce.  I have read and re-read the documention and can't seem to get it to work in sandbox or production.  The page I created is below.  What am I missing? Thank you for your help!

 

 

<apex:page controller="CourseList">
    <apex:pageBlock >
    <apex:dataTable value="{!Courses}" var="CourseList" width="100%" >
     <apex:column >
      <apex:facet name="header"><b>Class Name</b></apex:facet>
      {!CourseList.Name}
     </apex:column>
     <apex:column >
       <apex:facet name="header"><b>Class Description</b></apex:facet>
      {!CourseList.Description_Short__c}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Date of Class</b></apex:facet>
      {!CourseList.Date_of_Class__c}
     </apex:column>
     <apex:column >
      <apex:facet name="header"><b>Class Location</b></apex:facet>
      {!CourseList.Class_Venue__r.Name}
     </apex:column>
   </apex:dataTable>                
 </apex:pageBlock>
</apex:page>

 

 

Hopefully I'm missing something really simple here. I created a "Home Page Component" with the following body:

 

 

<iframe src="/apex/test" width="100%" frameborder="0" height="100"></iframe>

 

 

Where "test" is my VisualForce page. When I configure this to display on my home page, I see the source code as opposed to my VF page? Any help is greatly appreciated!

 

Regards

We have a number of custom Amount fields on an opportunity record, including an view-only field that totals all of them up.  I need to get this value into the standard Amount field - but cannot seem to find a way.
 
We are running PE, so no access to Workflows.  Basically on edit of an Opportunity I would like to push the calculated field value into the Amount field.
 
Anyone done this before on PE?