• imuino2
  • NEWBIE
  • 260 Points
  • Member since 2010

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 104
    Replies

I want to create a visualforce page which displays some data. 

 

The standard controller is Phone Line, a custom object.

 

Each opportunity has multiple phone lines. In each phone line there is a lookup field to the opportunity it is related to.

 

I want to be able to display data from the opportunity that the current phone line is related to.

 

For example, from a particular phone line record, the user should click a button to get to the visualforce page which should display information about the opportunity the phone line is related to.

 

I'm very new to this, and from my limited understanding, I believe that I would have to either write a custom controller, or an extension in apex. Your help would be appreciated

How do I make a SOQL query from a custom object data using apex ?

 

I have custom object named News and I want to get all the added news a webpage.

 

This probably very simple to do, but I just couldn't find any examples or advise how to do this.

 

 

Hi everyone,

 

 I am having a radio button with multiple options now my requirement is i want to display all the options values in aseparate  line/options in multiple lines .How could i do this help me wi th an example

 

My radio button is as follows

 

<apex:selectRadio     value="{!selectedOption}">
     <br/>
                 <apex:selectOptions   value="{!choices}"/>
        <br/>
       
          </apex:selectRadio>

 

 

 

 

I've tried to upload a trigger to sandbox via Eclipse but I get an error stating that the ORG is not enabled for deploying, I also get an error INVALID_TYPE: Cannot create ApexClass. So basically i CAN'T SAVE ANY CHANGES TO SANDBOX.

I've tried all sort of things such as changing the XML to Active ut it won't save the changes to sandbox. I dont know why it is doing this, since I've done all sort of triggers and some coding and never saw this issue in Sandbox, only in production.

 

Can anyone tell me what it is that I am not noticing or need to do?

 

This is the error I get when I try to save the trigger to Sandbox:

 

 

Description Resource Path Location Type
Save error: Not available for deploy for this organization PreventPortalUserOwner2.trigger _SANDBOX Shell Project/src/triggers line 0 Force.com save problem

Description Resource Path Location TypeSave error: Not available for deploy for this organization

 

 

 

 

The replacement does not happen at all in this code. Any ideas why?!!

 

 

String res = //some very long string of length 72000 chars
res = res.substring(4000, 5000); //this substring contains carriage return chars \n

res = res.replaceAll('\n', ' ');
system.debug(res);

 

Thanks in advanace!

Is there any way to find out all places where a custom field is referenced?

 

I have a custom field and I want to know if it is referenced in any Visual Force Pages, Apex Classes, Validation rules, or Workflows.

 

I know if I try to delete it, it will show me, but was hoping there was a way that didn't risk me accidently deleting the field.

 

 

Thanks for the help.

How do I apply CSS to a field level Error message (eg: a validation rule or a required field)?

 

In my page I have used:

<style type="text/css">
.error{border:1px solid #ff0000;}
label.error{display:block; width:200px; font-size:10px; color:#ff0000; border:0; float:none; font-family: arial;}
</style>

 

 

<style type="text/css">
        .error{border:1px solid #ff0000;}
        label.error{display:block; width:200px; font-size:10px; color:#ff0000; border:0; float:none; font-family:  arial;}
</style>

 

 

Which is putting a nice red border around inputs with errors (as it should). But the error message itself is still displaying in Black, 12pt, Times New Roman.

Any ideas?

 

Any help would be greatly appreciated.

Good day All, 

 

May i know how can i get the salesforce site URL ? say if we are in sandbox , it show : https://cs2.salesforce.com

 

if production , it show me https://na7.salesforce.com ?

 

I'm using unlimited version.

 

Thank you !

Is there a way to perform a "global search" through all Apex code --- classes, triggers, etc.?  For example, if I want to search for a specific block of code but don't remember what class it's in...

  • April 30, 2010
  • Like
  • 0

Hi:

   If a SOQL Query has no records I keep getting List Out Of Bounds:0..

 

How can I write a message stating to the user " There are no records for the filters selected" onto my VF Page???

 

Thanks

eTechCareers

Help with auto call logger

I created this script to auto log calls based on the current disposition field...it also handles creation of follow up tasks. Basically elminates the need for the standars call log process. I have it working on the Account SO but cannot get it working on the leads SO.... not sure what the deal is. Here is a copy of the script for the leads object:

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Lead");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Lead.OwnerId}";
task.Subject = "{!Lead.Current_Disposition__c}";
task.WhatId = "{!Lead.Id}";
task.Description = "{!Lead.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Lead.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Lead.OwnerId}";
followUp.Subject = "{!Lead.Current_Disposition__c}";
followUp.WhatId = "{!Lead.Id}";
followUp.Description = "{!Lead.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Lead.Follow_Up_Date__c});
}

var result = sforce.connection.update([lead]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
{!Lead.IsDirty__c} = false;
{!Lead.Follow_Up_Required__c} = false;
{!Lead.Follow_Up_Date__c} = null;
{!Lead.Current_Disposition__c} = null;
{!Lead.Notes__c} = null;

result = sforce.connection.update([lead]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

 

I am receiving a "missing ) after arguments list" error, not sure why...code is identical except for field names and variables.

 

Here is copy of working code on account object:

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "{!Account.Current_Disposition__c}";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

Any help would be appreciated

Hi,

I have a trigger on Account object in production environment. Although i have tried deactivating that trigger using n number of ways. But its not getting deactivated.

Now, i have lots of Account data to get uploaded using data loader. And i want that trigger not to fire.

Do we have any way to keep that trigger silent and let the complete data upload?? Thanks

Hi

I am new here :) 

I want to join the force developers but can't menage to do so,

when I go to http://www.developerforce.com/events/regular/registration.php and fill up the forms I am getting error page.

please help  :)

I will admit that I'm relatively new to writing formulas for Salesforce but I just can't seem to get my head 'round why this isn't working

 

AMOUNT.CONVERT:SUM:IF(ISPICKVAL( StageName, "05a - Awaiting OEM Activation", "06 - Closed Won"))

 

I am trying to create a custom Summary Formula that will total the "Amount Converted" revenue from Opportunities with a Sales Stage picklist value 05a or 06.

 

When I try to validate the formula I get this:

Error: Field StageName does not exist. Check spelling.
I've tried a few different variants Opportunity.StageName, OpportunityStage, SalesStage, etc...  Whatever I try I always get the error that the spelling is incorrect or the field doesn't exist. 
Any help would be greatly appreciated.

Hi,

 

Online help says "Roll-up summary fields cannot calculate the values of other roll-up summary fields except for account to opportunity roll-up summary fields, which allow you to calculate the values of opportunity roll-up summary fields."

 

I have three objects A, B and C. A is a master of B and B is a master of C. In object B there is a roll-up summary field X that sums the values from the field in C. Despite of what online help says I was able to create a roll-up summary field in object A that sums the values in the field X.

 

Did I misunderstood something or are there some potential problems if I use roll-up summary field to calculate values of other roll-up summary fields?

 

 

  • August 04, 2010
  • Like
  • 0

I'm trying to develop a  custom page which contains  positions( object: position) and the Job Application Form(object:Job application). Here i want to display all Positions as just readOnly position names  ( but not listview) and Job application as input field with some Fields... i want when i sumbit form by Save action it should navigate to new page where some Greeting masg ll be there......and data enetered by candidate in form should be mapped in Job application Object in Force.com Enviornment.....

 

The Page Code is below:

 

<apex:page showHeader="false" standardController="Job_Application__c" recordSetVar="Jobform" extensions="jobAppFormExtension" standardStylesheets="true" >

<apex:pageblock id="thePage" >   
<apex:listViews type="position__c"/>

</apex:pageblock>
<apex:form >
        <apex:stylesheet value="{!$Resource.jobFormBgColor}"/>
<apex:pageBlock title="Job Application Form">
<apex:pageblockSection >
<apex:inputField value="{!Job_Application__c.Applicant_Name__c}" styleClass="page"></apex:inputField>

<apex:inputField value="{!Job_Application__c.Email__c}" styleClass="page"></apex:inputField>
<apex:commandButton value="Save" action="{!save}" oncomplete="{!greeting}"/>
</apex:pageblockSection>


</apex:pageBlock>

</apex:form>

</apex:page>

 

 

 

 

 

PLz give  me sample controller code for above problem...

 

 

Urgent...

 

Thanx

san

Hi:

 

On some browsers our sites page looks like the css file did load. I am storing the css file in a static resource and it works perfectly on my work computer and my home computer.

 

I used the development feature in Safari to view the site in all sorts of browsers and it looks just fine.

But when this one customer looks at the site it looks like the css file didn't load.

 

Can some browsers reject linked CSS? That would seem odd.

Also the graphics are showing up fine, and they are in the same static resource zip file.

 

Thoughts?

  • July 28, 2010
  • Like
  • 0

 

I can't figure out why this isn't working:
<apex:repeat value="{!MyContacts}" var="c" >
    <c:ContactRowComponent contactLastName="{!c.LastName}"/>  
</apex:repeat>
(where on the main controller MyContacts returns an array of Contact objects, and on the component contactLastName is defined as a String attribute)
This gives me error:
Literal value is required for attribute contactLastName in <c:ContactRowComponent> at line 25 column 27
It seems to be saying that a literal value is required and not a formula? Is what I am trying to do impossible, or am I doing it wrong?

 

I can't figure out why this isn't working:

 

<apex:repeat value="{!MyContacts}" var="c" >
    <c:ContactRowComponent contactLastName="{!c.LastName}"/>  
</apex:repeat>

 

 

(where on the main controller MyContacts returns an array of Contact objects, and on the component contactLastName is defined as a String attribute)

 

This gives me error:

 

Literal value is required for attribute contactLastName in <c:ContactRowComponent> at line 25 column 27


It seems to be saying that a literal value is required and not a formula? Is what I am trying to do impossible, or am I doing it wrong?

 

This question also at StackOverflow if you want to get some StackOverflow points : )

okay so im getting this error:

 

Compile Error: line 19, column 7: Invalid foreign key relationship: Lead.createdDate

 

 

with this code:

 

it comes from the part where i compare each aspect of CreatedDate to my variables.

     

 

 

public with sharing class stuff {
Date   oldThreshold = Date.newInstance(2010, 1, 1); 
String newStatusForOldLeads = 'Archive-Omitted';

   
List<Lead> oldLeads = [select id, createdDate, status, isConverted
from Lead where status = 'open' OR status = 'working'];

List<Lead> leadsToUpdate = new List<Lead>();


{
if(oldLeads.size() > 0)
{
 
 for(Lead currentLead: oldLeads)
 {  
  integer compareyear = 2010;
integer comparemonth = 1;
integer compareday = 1;
  //Date x = currentLead.CreatedDate.Date;
  
  if (currentLead.CreatedDate.year < compareyear &&
     currentLead.CreatedDate.month < comparemonth &&
     currentlead.CreatedDate.day < compareday)
     {
    
     
     
      currentLead.status = newStatusForOldLeads;  
      leadsToUpdate.add(currentLead);
 


       
     }
  }
}

if(leadsToUpdate.size() > 0)
{
update(leadsToUpdate);
}
 


}
}

 

I don't get it ?

  Hi All,

            I am getting an error Too many script statements: 10201. Please provide your suggestion for the same.

In below code: I m trying to update location object while its a child object of Quote and Quote is the child object of an Opportunity.

  we have one checkbox on Opportunity and it should be true or false for the below query.
*********************************

 public static void checkAllocationPricesUpdate(Location__c[] locationArr)
    { 
     System.debug('TOTAL LOCATIONS ARE -----'+ locationArr);
     Set<Id> my_QuoteId = new Set<Id>();
   for (Location__c OLoc : locationArr)
      {
       my_QuoteId.add(OLoc.OpportunityProduct__c);
      }
     Map<Id, Quote_Line__c> my_OpprQuotMap = new Map<Id, Quote_Line__c>(
     [Select SalesPrice__c, Opportunity__c, LostCode__c From Quote_Line__c where id in :my_QuoteId]);
     Set<Id> my_OpporId = new Set<Id>();
      for (Quote_Line__c quot : my_OpprQuotMap.values())
      {
       my_OpporId.add(quot.Opportunity__c);
      } 
      System.debug('TOTAL QUOTE IDS ARE -----'+ my_QuoteId);
     Map<Id, Quote_Line__c> my_OpprQuotIdsMap = new Map<Id, Quote_Line__c>(
     [Select Id,SalesPrice__c, Opportunity__c, LostCode__c From Quote_Line__c where Opportunity__c in :my_OpporId]);
     Map<Id, Opportunity> my_OpprMissMatchChkBoxMap = new Map<Id, Opportunity>();
     //[select Mismatched_Allocation__c from Opportunity where id in :my_OpporId]);
     Map<Id,Location__c> my_OpprlocAllocatedPrice = new Map<Id,Location__c>(
     [Select OpportunityProduct__c, Id, AllocatedPrice__c From Location__c  where OpportunityProduct__c in :my_OpprQuotIdsMap.keySet()]);
  System.debug('STATUS OF LOCATION -----'+ my_OpprlocAllocatedPrice);
     //for (Opportunity opp : my_OpprMissMatchChkBoxMap.values())
    // {         
     // opp.Mismatched_Allocation__c = false;
      Integer iTest = 0;
      for (Quote_Line__c quot : my_OpprQuotIdsMap.values())
      {
       System.debug('INSITE OF QUOTE');
       if(my_OpprQuotIdsMap.get(quot.id).LostCode__c == Null)
       {
        Double sum = 0.00;                  
        for (Location__c opploc : my_OpprlocAllocatedPrice.values())
        { 
             if (my_OpprlocAllocatedPrice.get(opploc.Id).AllocatedPrice__c==null)
             {
              opploc.AllocatedPrice__c = 0;
              System.debug('VALUE OF ALLOCATED PRICE'+ opploc.AllocatedPrice__c);
             }
          if(quot.id ==opploc.OpportunityProduct__c)
          {
           sum = sum+ my_OpprlocAllocatedPrice.get(opploc.Id).AllocatedPrice__c;
           System.debug('ADDING THE VALUE'+sum);
          }  
        }
        if( my_OpprQuotIdsMap.get(quot.Id).SalesPrice__c != sum.round())
        {     
         iTest = 1;
         
        }
        else
        {
          Opportunity o =new Opportunity(ID = quot.Opportunity__c,Mismatched_Allocation__c=false);
                         my_OpprMissMatchChkBoxMap.put(o.Id,o);
         // o.Mismatched_Allocation__c = false;
         
         // my_OpprMissMatchChkBoxMap.put(o.Mismatched_Allocation__c,o);
          System.debug('Have Fun--->'+ o.Mismatched_Allocation__c);
        }       
       }       
      }
      if(iTest==1)
      {
       //opp.Mismatched_Allocation__c = true;   // Ori value
       for (Quote_Line__c quot : my_OpprQuotIdsMap.values())
      {
       Opportunity o =new Opportunity(ID = quot.Opportunity__c,Mismatched_Allocation__c=true);
                my_OpprMissMatchChkBoxMap.put(o.Id,o);
       //my_OpprMissMatchChkBoxMap.put(o.Mismatched_Allocation__c,o);
       System.debug('Have Fun_Part2--->'+ o.Mismatched_Allocation__c);
      }
      }
      //update opp;
     //} End
      if(my_OpprMissMatchChkBoxMap.size()>0){
            if(my_OpprMissMatchChkBoxMap.size()+Limits.getDmlRows()< Limits.getLimitDmlRows()){//Handling governor limit.
                try{                  
                     update my_OpprMissMatchChkBoxMap.values();  
                      System.debug('UPDATE OPPORTUNITY'+ my_OpprMissMatchChkBoxMap.values());                                  
                }catch(Exception Ex){
                 System.debug('Actual error is --'+ Ex.getMessage());
                    //throw Ex;
                }
            }
            else{//Throwing custom exception message.           
                throw new GovernerLimitException('GOVERNOR_LIMIT');
            }
        }    
    }

I am new and learning salesforce.

 

I created a custom object with attachment related list. However I found that there is no section for attachment when I create a new record, although I can add attachments after I saved the record.

 

Thanks in advance.

 

Hi

 

 

I m stuck in a code .Need some help

 

I have fired a Query on document and stored its body in a blob type variable 'BodyContent'

 

Document Doc =[Select Name, Id, Body From Document ];
        System.debug('Doc' + Doc);
        String FileName = Doc.Name;
        BodyContent=Doc.Body;

 

 

Now I m converting this blob to string using TOString() method     like this

 

String DocBody =  bodyContent.toString();

 

but i need to convert this document or string in 8 bit ASCII format

How can i do this.

Can anyone help?

I want to create a visualforce page which displays some data. 

 

The standard controller is Phone Line, a custom object.

 

Each opportunity has multiple phone lines. In each phone line there is a lookup field to the opportunity it is related to.

 

I want to be able to display data from the opportunity that the current phone line is related to.

 

For example, from a particular phone line record, the user should click a button to get to the visualforce page which should display information about the opportunity the phone line is related to.

 

I'm very new to this, and from my limited understanding, I believe that I would have to either write a custom controller, or an extension in apex. Your help would be appreciated

Hey all,

 

What I am trying to do here is create dynamic columns based on some attributes. However, I am getting a complaint that <apex:column> needs to be the direct child of <apex:pageTable>. Is there any way I can get those columns to repeat through the object's attributes? I found one solution that uses standard HTML <table>'s, etc, but that loses all the SF formatting, which is very important on this project.

 

Here is what I was trying:

 

<apex:repeat value="{!AttrDefs}" var="attr">
  <apex:column>
    <apex:facet name="header">
<apex:outputLabel value="{!attr.Name}"/>
</apex:facet> <apex:inputText value="{!row.col1}" /> </apex:column> </apex:repeat>

Thanks for suggestions!

How do I make a SOQL query from a custom object data using apex ?

 

I have custom object named News and I want to get all the added news a webpage.

 

This probably very simple to do, but I just couldn't find any examples or advise how to do this.

 

 

is there a way to convert a list of sobjects into a string?  I don't really care about the format, just that the field values can be string searched. Something like this:

 

 

List<sobject> pparcels = database.query('select ...');
String relatedMatches = pparcels.toString(); //toString doesn't exist
if (relatedMatches.indexOf(affectedIds[i]) > -1) {
...
}

 

 

  • June 22, 2010
  • Like
  • 0

So earlier I was trying to hide/show elements to implement a filter system. However, it was brought to my attention that it would be far easier to rerun the query I used to get the elements in the first place, just use a WHERE clause with the filter. However, I am wondering how to get the page to update with these new results. I am storing the filter in a global Apex variable and running this constructor:

 

 

    public DefinitionSetCtrl(ApexPages.StandardSetController controller) {
        Database.QueryLocator ql;
        ID modelDefId = ApexPages.currentPage().getParameters().get('ModelDefId');
        if(Filter == null){
        ql = Database.getQueryLocator(
            [select Name, Attribute_Type__c, Is_Required__c, Default_Checkbox_Value__c,
                                 FROM Attribute_Definition__c
             WHERE My_Definition__c = :modelDefId             ]
        );}
        else {
        ql = Database.getQueryLocator(
            [select Name, Attribute_Type__c, Is_Required__c, Default_Checkbox_Value__c,
                                 FROM Attribute_Definition__c
             WHERE My_Definition__c = :modelDefId AND Attribute_Type__c = :Filter
             ]
        );}
        StdSetCtrl = new ApexPages.StandardSetController(ql);
        DefList = (Attribute_Definition__c[])StdSetCtrl.getRecords();
}

 The filter gets updated when the user selects a type to filter on, but I am wondering how to get the page to rerun that query and display the new selection. When it runs again it should see the new Filter value and jump into that else to display only the records of type Filter.

 

Any suggestions are much appreciated, thanks!

 

private String lastName {get; set;}
public geparameter()
{
String uidd=ApexPages.currentPage().getParameters().get('useridd');
System.debug('@@@'+uidd);
List<CandidateInfo__c>  myCandidate=[select id,LastName__c,FirstName__c from CandidateInfo__c where id=:uidd ] ;
for(CandidateInfo__c t: myCandidate)
{
this.lastName=t.lastname__c;
this.firstName=t.firstname__c;
}
}
}

  • June 22, 2010
  • Like
  • 0

Hi,

 

Recently Salesforce gave ability for user create his/her own tab style. In this it allow user to give an user defined icon for the tab.

 

But Salesforce has not specified the width, height for better results. Can anyone he help me here ?

 

Thanks

Viraj

  • June 21, 2010
  • Like
  • 0