• amorgan
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 19
    Replies

Just installed Safari 5 and now find that the text in the built in visualpage editor is unreadable :(

 

( This is actually with Safari 5 under Windows XP - will try later on my Mac at home, but assume it will be the same. Safari 4 worked fine )

 

 

I have a managed package that I plan on shipping out, but I am worried that a newly created required field will cause problems. It seems that already existing objects will have a null for this new field even though I specified a default ($0). This is causing the sforce javascript api to break since it can't parseInt a null. One thought I had was to use the dataloader and update all the fields to 0 for everything first thing after the upgrade, but that would be a lot of work to do this for all the customers. Another thought was to make an update script to initialize the old objects to 0, but that only can update 200 records at a time. What is the standard practice answer that can scale?
I have a lookup field in my opportunity that I want populated when I create a new opportunity under a contact. When I press the button "New Opportunity", under my opportunity related list while looking at a contact, it takes me to the new opportunity page. Then I notice that there is a &conid=0038000000X2jvq in the URL which is the correct contact that I want. But, how do I get that contact in my custom lookup field?
I found out that I can render pages inside IE as if it were chrome rendering the page. http://code.google.com/chrome/chromeframe/ I just need to set this in my <meta http-equiv="X-UA-Compatible" content="chrome=1" /> But I can't seem to be able to get the <meta /> tag inside of without turning off the salesforce header. I want to do this: <meta http-equiv="X-UA-Compatible" content="chrome=1" />
I am trying to run a report that shows sales over time but the report seems to skip months that have no sales.
This causes a problem because when you graph this report it will never show any flat spots. The graph seems at first glance to show continuos sales until it is realized that the graph is skipping months in the date axis that have no data.

I've seen this happen a few times already and I don't see how to resolve this issue. Is this a fundamental problem is Salesforce reporting?
Am I, and others, missing something?

P.S. Please don't answer "You simply need to sell more" ;-)
Is it possible to get more information from views that have been set up? I want to get the SOQL string that the view uses to be able to dynamically add additional filters to the already configured views for an opportunity.
I need a good way to know if I'm in a managed package with a namespace or not.
If I use sforce.connection.query(soql) the query string will be different depending if the page is managed or not.

Example, if I'm in a managed packaged the query string would be
soql = "select myNamespace__myCustomField__c from myNamespace__myCustobObj__c"

but, when I deploy to another server my code becomes unmanaged and the query string needs to be:
soql = "select myCustomField__c from myCustobObj__c"

So, what's a good way to know if the code is managed or not so I can use the correct query string?
If today is 2009 and someone selects their fiscal year to start on January and they based the year on the ending month then wouldn't the Fiscal Year still be FY 2009?
It seems that the option to base the fiscal year on "the ending month" or "the starting month" makes no sense if the starting month is January.

Is this true?

Ultimately I'm trying to display a list of opportunities in a paging and sortable way. apex:EnhancedList seemed perfect for what I need, but I can seem to feed it my opportunity list.

 

Page sample: 

<apex:enhancedList listId="MyOppList" height="300"/>

 

Controller sample:

 

public Opportunity[] getMyOppList() {

return [select id, name from Opportunity];

}

 



How do you use listId? All the docs say is "The Salesforce object for which views are displayed"

 

The class attribute isn't being set when I use outputField. As you can see in my example the HTML output is missing the class attribute which was set to XXX


My Page:


<apex:page controller="TestPageCon">
<apex:outputField styleClass='XXX' value='{!field.amount}'/>
</apex:page>


My Controller:


public class TestPageCon {
public Opportunity getField() {
return [select id, amount from Opportunity limit 1];
}
}


Actual HTML output:


<span id="j_id0:j_id1">$60,000.00</span>

Where did my XXX go?

I have this Controller:

public class TestPageCon {

    public class Row {
        public Integer closed {
            get{
                return 54;
            }
        }
    }
    
    public Row[] getRows() {
        Row[] rows = new Row[5];
        for (Integer i=0; i < 5; i++) {
            rows[i] = new Row();
        }
        return rows;
    }
}

I have this Page:

<apex:page controller="TestPageCon">
<apex:repeat var="row" value="{!rows}">
%{!row.closed}%<br/>
</apex:repeat>
</apex:page>



I expect this:


%54%
%54%
%54%
%54%
%54%

I get this instead:


%54%
%%
%%
%%
%%



Message Edited by amorgan on 02-02-2009 12:09 PM
Message Edited by amorgan on 02-02-2009 12:11 PM
I have here an innerclass with a property that always returns 54. When I try to access the property more than once in a VisualForce Page then I get an unexpected result.

Expected Page Result:
54 - 54

Actual Page Result:
54 -

Notes:
Accessing the property twice in the testmethod works so this makes me think it's a VisualForce issue.

Page:
<apex:page controller="TestPageCon">
{!b.b} - {!b.b}
</apex:page>

Controller:
public class TestPageCon {
public class TestPageCon {
public class B {
public Integer b {
get {return 54;}
}
}

public B getB() {return new B();}

testmethod static void testBug() {
TestPageCon test = new TestPageCon();
System.assertEquals(test.getB().b, 54);
System.assertEquals(test.getB().b, 54);
}
}

I want to display something like this:


  • User 1:
    • Opportunity 1
    • Opportunity 2
  • User 2:
    • Opportunity 3
    • Opportunity 4

Here is the Page code I'm trying to use:



<apex:page controller="myController">
<apex:pageBlock title="Opportunities by User">
<apex:dataList value="{!users}" var="user">
<apex:pageBlockSection title="{!user.firstname}">
<apex:dataTable value="{!XXX what do I put here? XXX}" var="opp">
<apex:column >{!opp.name}</apex:column>
</apex:dataTable>
</apex:pageBlockSection>
</apex:dataList>
</apex:pageBlock>
</apex:page>


Here is the Controller Code:



public class myController {

public List getUsers() {
return [select firstname from user];
}

public List getOppsForUser(User user) { // How can I use this method?
return [select name from opportunity where ownerid=:user.id];
}

}
I have a lookup field in my opportunity that I want populated when I create a new opportunity under a contact. When I press the button "New Opportunity", under my opportunity related list while looking at a contact, it takes me to the new opportunity page. Then I notice that there is a &conid=0038000000X2jvq in the URL which is the correct contact that I want. But, how do I get that contact in my custom lookup field?

Just installed Safari 5 and now find that the text in the built in visualpage editor is unreadable :(

 

( This is actually with Safari 5 under Windows XP - will try later on my Mac at home, but assume it will be the same. Safari 4 worked fine )

 

 

Can someone tell me what I'm missing here.  In the debug log it says no records found after I update an OpportunityLineItem record:

 

Trigger.oppLineItem_prod_data_trigger2: line 20, column 33: SOQL query with 0 rows finished in 3 ms

 

trigger oppLineItem_prod_data_trigger2 on OpportunityLineItem (after insert, after update) { Set<String> opportunityLineItemIDs = new Set<String>(); List<OpportunityLineItem> updtOpportunityLineItems = new List<OpportunityLineItem>(); OpportunityLineItem[] opportunityLineItems = new List<OpportunityLineItem>(); OpportunityLineItem[] oliList = [select pricebookentry.product2.bu_code__c FROM OpportunityLineItem where id in :opportunityLineItemIDs]; for(OpportunityLineItem oli : oliList) { oli.bu_code__c = oli.pricebookentry.product2.bu_name__c; } update oliList; }

 

I need to create  a UserRole record as part of test class. The field 'PortalType' is a picklist defined field. I've seen several examples of reading the values from the picklist but no examples of how to create a new record containing a picklist field. not a new value, but a existing value within the picklist for this note new UserRole record. For example, this snippet will result in the error :'Field PortalType is not writable'. What is the correct procedure?

 

Regards,

 

 

UserRole r = new UserRole(RollupDescription =a.Name + ' Customer Manager',PortalType = 'Customer Portal', PortalRole = 'Manager', PortalAccountId = a.Id); insert r;

 

  • September 29, 2009
  • Like
  • 0
I need a good way to know if I'm in a managed package with a namespace or not.
If I use sforce.connection.query(soql) the query string will be different depending if the page is managed or not.

Example, if I'm in a managed packaged the query string would be
soql = "select myNamespace__myCustomField__c from myNamespace__myCustobObj__c"

but, when I deploy to another server my code becomes unmanaged and the query string needs to be:
soql = "select myCustomField__c from myCustobObj__c"

So, what's a good way to know if the code is managed or not so I can use the correct query string?

Gurus,

need a big help.  Got to deploy the code tomorrow morning and it does not work.

 

I wrote a javascript to create a custom button called Submit Proposal on Opportunity page. It is an onclick Javascipt.

 

The code is working fine on Developer edition but when I deploy it as a package in Professional edition, it is throwing me an error saying  " API access" is disabled. I tried uploading the code as a package on appexchage to bypass the API thingy, still it does not work.

 

Here is the code, if you happen to have any suggestion for struggling me..

 

OnClick JavaScript{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")}


var oppid="{!Opportunity.Id}";
var sql1 = "Select Submitted_as_Proposal__c from Opportunity Where Id = '" + oppid + "'" ;
var result = sforce.connection.query(sql1);
var records= result.getArray("records");
var ans=records[0].Submitted_as_Proposal__c;
var opps = new Array();
opps[0] = new sforce.SObject("Opportunity");
opps[0].id = "{!Opportunity.Id}";
opps[0].Submitted_as_Proposal__c = 'Y' ;
if(ans=='N')
{
var prop = new sforce.SObject("Proposal__c");
var rfq=new Date("{!Opportunity.RFQ_Date__c}");
rfq.setDate(rfq.getDate());
var rfp=new Date("{!Opportunity.RFP_Date__c}");
rfp.setDate(rfp.getDate());
var rfi=new Date("{!Opportunity.RFI_Date__c}");
rfi.setDate(rfi.getDate());
var adt=new Date("{!Opportunity.Estimated_Award_Date__c}");
adt.setDate(adt.getDate());
var pdt=new Date("{!Opportunity.Estimated_Proposal_Due_Date__c}");
pdt.setDate(pdt.getDate());
prop.name = "{!Opportunity.Name}";
prop.CRGT_Role__c="{!Opportunity.CRGT_Role__c}";
prop.Prime_Name__c="{!Opportunity.Prime_Name__c}";
prop.Sub_Name__c="{!Opportunity.Sub_Name__c}";
prop.Total_Contract_Vlaue__c="{!Opportunity.Total_Contract_Value__c}";
prop.CRGT_Value__c="{!Opportunity.CRGT_Value__c}";
prop.Lead_Source__c="{!Opportunity.Lead_Source__c}";
prop.OwnerId="{!Opportunity.OwnerId}";
prop.Account__c="{!Opportunity.AccountId}";
prop.Contract_Vehicle__c="{!Opportunity.Contract_Vehicle__c}";

if(rfq!='NaN')
{
prop.RFQ_Date__c=rfq;
}
if(rfi!='NaN')
{
prop.RFI_Estimated_Date__c=rfi;
}
if(rfp!='NaN')
{
prop.RFP_Date__c=rfp;
}
if(adt!='NaN')
{
prop.Estimated_Award_Date__c=adt;
}
if(pdt!='NaN')
{
prop.Estimated_Proposal_Due_Date__c=pdt;
}
if(rfp!='NaN')
{
prop.RFP_Date__c=rfp;
}
sforce.connection.create([prop]);
sforce.connection.update(opps);
alert("This Opportunity is now submitted as a proposal");

}

else
{
alert("This Opportunity has already been submitted as a proposal");
}

 

 

  • June 30, 2009
  • Like
  • 0

Ultimately I'm trying to display a list of opportunities in a paging and sortable way. apex:EnhancedList seemed perfect for what I need, but I can seem to feed it my opportunity list.

 

Page sample: 

<apex:enhancedList listId="MyOppList" height="300"/>

 

Controller sample:

 

public Opportunity[] getMyOppList() {

return [select id, name from Opportunity];

}

 



How do you use listId? All the docs say is "The Salesforce object for which views are displayed"

 

As discussed in Ideas (http://ideas.salesforce.com/article/show/69729) here's a solution we have used for clients to enable customisation of the Clone button on Opportunities. This can be used to selectively choose which fields to copy and set default values:

 

For full details and the code to clone opportunity Line Items please contact me directly. We will be re-writing this in VisualForce over the coming months to make it futureproof.

 

Steps to Implement - Admins only

1. Setup -> Customize -> Opportunity -> Buttons and Links

2. Create new custom button called Clone, behaviour is Execute Javascript, Display Type Detail Page Button.

3. Paste in the code below and edit to match your requirements.

4. Remember to add the new button to the Opportunity page layout(s) and hide the original Clone button.

4. Test!

 

// Copyright 2008 BrightGen Ltd - All Rights Reserved try{ {!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} // ** EDIT THIS QUERY TO LIST THE FIELDS YOU WANT TO COPY ** var result = sforce.connection.query("Select o.Type, o.StageName, o.Product_Type__c, o.Planned_Opportunity__c, o.MarketSector__c, o.CampaignId, o.Business_Unit__c, o.Amount, o.AccountId From Opportunity o WHERE o.Id = '{!Opportunity.Id}'"); var newOpp = result.getArray("records"); // Reset the Opp Id and reset fields to default values newOpp[0].Id = ''; newOpp[0].Name = "Clone {!Opportunity.Name}"; // ** EDIT THESE FIELDS TO SET DEFAULT ANY VALUES ** newOpp[0].StageName = "1. Prospecting"; newOpp[0].CloseDate = new Date(2099, 0, 1); var saveResult = sforce.connection.create(newOpp); if (saveResult[0].getBoolean("success")) { newOpp[0].id = saveResult[0].id; alert("Opportunity cloned without line items"); } else { alert("Failed to create clone: " + saveResult[0]); } // Refresh the page to display the new oppportunity window.location = newOpp[0].id; } catch (err) { alert (err.description ); }

 

 
Message Edited by bg_richard on 02-05-2009 07:11 AM
The class attribute isn't being set when I use outputField. As you can see in my example the HTML output is missing the class attribute which was set to XXX


My Page:


<apex:page controller="TestPageCon">
<apex:outputField styleClass='XXX' value='{!field.amount}'/>
</apex:page>


My Controller:


public class TestPageCon {
public Opportunity getField() {
return [select id, amount from Opportunity limit 1];
}
}


Actual HTML output:


<span id="j_id0:j_id1">$60,000.00</span>

Where did my XXX go?

I can't install our package into our test org. Does anyone know how to handle this? I'd like to be able to fix it without wrangling too much with Support...

 

I have tried installing the package several times yesterday and today - and I have tried to isolate the problem within the objects. I know what object is causing the problem, but not what to do. The object has installed with no problem as a different version. (From the discussion boards, it looks like there is a known issue with installing apps in an org where they were installed (and removed) before - but no one says how to fix it in the org without Support.)

The error message I get is: "Your requested install failed. Please try this again. None of the data or setup information in your Salesforce organization should have been affected by this error. If this error persists, contact Support through your normal channels and reference number: 1525493615-16962 (717204977)"

 

I filed a customer support case: #02400539.

I want to display something like this:


  • User 1:
    • Opportunity 1
    • Opportunity 2
  • User 2:
    • Opportunity 3
    • Opportunity 4

Here is the Page code I'm trying to use:



<apex:page controller="myController">
<apex:pageBlock title="Opportunities by User">
<apex:dataList value="{!users}" var="user">
<apex:pageBlockSection title="{!user.firstname}">
<apex:dataTable value="{!XXX what do I put here? XXX}" var="opp">
<apex:column >{!opp.name}</apex:column>
</apex:dataTable>
</apex:pageBlockSection>
</apex:dataList>
</apex:pageBlock>
</apex:page>


Here is the Controller Code:



public class myController {

public List getUsers() {
return [select firstname from user];
}

public List getOppsForUser(User user) { // How can I use this method?
return [select name from opportunity where ownerid=:user.id];
}

}
 My problem is that how I convert the currency (GBP,USD,etc..) in decimal number without any comma and symbol, With hope that anyone will reply me and help me tol come up with this problem. Thanks a lot in advance.
  • November 12, 2008
  • Like
  • 0
  • April 10, 2006
  • Like
  • 0