• User@SVF
  • NEWBIE
  • 205 Points
  • Member since 2008

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 27
    Replies

Hi there.  I can't seem to remove the "--none--" option in picklists...  I am sure it is an easy tweak, any thoughts?

Hi, I need help retrieving the option the user selected of a pre-determine values of a picklist I created. So my other indepedent picklist retrieves the value depending on the user first selection.

 

Thanks for all the Help you can give.

 

Here's the Code:

 

Controller Code:

 

    Public string select1{get; set;}
    Public string select2{get; set;}

 


    public List<SelectOption> getItems()
    {
        List<SelectOption> option = new List<SelectOption>(option); 
        option.add(new SelectOption('Modem1','Celulares'));
        option.add(new SelectOption('Modem2','Dmax'));
        option.add(new SelectOption('Modem3','ATM'));
        option.add(new SelectOption('Modem4','VOIP'));
        option.add(new SelectOption('Modem5','Modem5'));
        return option;
    }

 

    public List<SelectOption> getItems2()
    {
          List<SelectOption> options = new List<SelectOption>();

          if( theValueimsearchingfor = 'VOIP){


          List<Product2> proList = [select name from Product2 where ProductCode like '0001-%'];
          for(product2 a : proList)
           options.add(new SelectOption(a.Name,a.Name));
        }
        return options;
    }

 

Apex Code:

 

<apex:selectList id="picklist1" title="Tipo" id="selectlist1" value="{!select1}" size="1">
        <apex:actionSupport event="onclick" reRender="selectlist2"/>
        <apex:selectOptions value="{!items}"/>    

</apex:selectList>

 

 <apex:selectList title="Marca" id="selectlist2" value="{!select2}" size="1">
        <apex:actionSupport event="onclick"  reRender="selectlist3"/>
        <apex:selectOptions value="{!items2}"/>    
 </apex:selectList>

  • August 13, 2010
  • Like
  • 0

Hi,

I'd like to use a validation rule to say that if a certain value is selected in a pick list, a currency field MUST be left blank in order to save the case.  I have used validations before saying that if a field value is selected, a field is MANDATORY, but not the other way around.  Details below:

 

Controlling pick list:  Integration__c

Value:  "PCI"

Currency field name:  Publisher_CPM__c

 

Can you help?  Thanks so much!

I am trying to update the parent opportunity record with a count of all child records that meet a specified criteria when a new child custom object is created or modified. I have checked the SOQL queries and they are returning the results I expected. The opportunity relationship field is present and required.

 

trigger UpdatePendingPOMRequests on DM__c (after insert, after update) {

    //Find ID for 'POM' Record Type
    RecordType rt = [Select r.Id from RecordType r WHERE r.name = 'POM' AND r.SobjectType = 'DM__c'];

for(DM__c dm : trigger.new){
       if(dm.RecordTypeId == rt.id){

            integer dmct = [Select Count()
                            FROM DM__c d
                            WHERE dm__c.dm_opportunity_id__c = :dm.dm_opportunity_id__c
                            AND dm__c.RecordTypeId = :rt.id
                            AND dm__c.POM__c = 'Pending'
                            ];           
            Opportunity oid = [Select Num_Pending_NSP__c from Opportunity WHERE id =:dm.dm_opportunity_id__c ];
            oid.Num_Pending_NSP__c = dmct;

        Database.upsert(oid);
       }
    }
}

 

Thanks, in advance for your response.

Hi all,

I am working on a VF page with a lot of different modussus. Depending on the modus certain information should be shown. So I was thinking, and I thought I found a cool way how I could accomplish this. I created a function with a string as argument, and returns back if the element should be rendered or not.Using this function, the VF code should stay clean.

 

But when I try to use this function in my rendered attribute, it's not working :smileysad:. When I try to save (in eclipse) it says "Unknown function renderMe. Check spelling.".

 

Does anybody has any ideas, before I have to go and put everything in the rendered attribute itself over and over... Bleh that's gonna look dirty, I don't like to go that way :(

 

VF code:

 

<apex:page standardController="Account" extensions="AccountExtension" >
	<apex:commandButton value="Gegevens bewerken" action="{!enterEditMode}" rendered="{!renderMe('1')}"/>
	<apex:outputLabel value="" rendered="{!renderMe('1234')}"/>
</apex:page>

 

 

Controller code

 

 

public class AccountExtension {
	private static final String MODUS_1 = '1';
	private static final String MODUS_2 = '2';
	public String currentModus {get;set;}

	/** This method is used by the visual force components to determine if these can be rendered or not. 	*/
	public boolean renderMe(String modusses) {
		if (modusses.contains(currentModus)) {
			return true;
		}
		return false;
	}
}

 

 

 

 

 

 

 

I have a field "test__c" on an object order_line__c.

This field is updated to 1 when a button is clicked.

There is  a trigger that is supposed to fire  when this field is updated and it should create a new record.
However ,when the field is updated,there is no record creation.

The trigger code:

trigger iresv on order_line__c(after update)

{

    if(Trigger.isUpdate){
        for(Order_line__c m: Trigger.new)

       {

//this field(m.test) is updated when a button is clicked
          
if(m.test__c == '1')


          {

               Inventory_Reserve__c iv = new Inventory_Reserve__c();

//new object that must be created :inventory reserve has a master detail with product_inventory custom object.
//m.pinv__c has the id of the product inventory master record.
               

                iv.Product_Inventory__c= m.pinv__c;

                insert iv;

          }
         
        }
    }  

}

Please help

Hi,

 

This query produces 16,325 when reported in my test (failed because of the 10k limit) but the numbers are the focus here.  The 16,325 is coming from the error message about to many rows. 

 

System.LimitException: Too many query rows: 16,325

 

When I use the same query and export using the DataLoader I get 13,939 records.

 

Does anyone know the reason for this difference?  I even tried using the IsDeleted = false in the WHERE clause and the numbers still do not match.

 

The query is:

 

Select id, MissingPartner__c, Last_Modified_By_User__c, LastModifiedBy.Name, LastModifiedDate, (Select id From OpportunityPartnersFrom)

From Opportunity

 

 

I am going to to keep workiing on SFDC Governor Limits until I figure out why I can't get nothing done!!! :) Am a alone with this.  Do something SFDC. :(

 

 

 

Hello All,

 

Here are couple of bugs in salesforce, that we need to watch for

  • AppExchange package development: Do not use the system variable “Package.version”  in the code if you ever plan to create a patch org, as the usage of the variable will not let you create the patch org and throws “Patch Org Creation failure” exception. Salesforce acknowledged that it is an issue in the product and  will soon come up with a patch release to fix the issue. (Ref Case  #06777321)

 

  • Approval processes: Be aware that you cannot approve the records via email if you meet the following criteria(you can still continue to approve/ reject the records from salesforce)   I) The approval step has a Field-Update Approval or Rejection Action. II )The object has an Apex Trigger. (Ref Case #06849599)

 

  • Quote PDF: Even though you display the currency fields without decimal places, salesforce renders ".00" for the currency fields in Quote PDF templates. Those fields render as expected in the page layout but not in the PDF.  Ex: the value in pagelayout $100, would be rendered as $100.00 even when the field data type is currency(18,0)

 

K

Hi,

 

I have recently migrated my build into production on 21st July.

But on that particular day, after migration when I check the configuration migrated, the date specified in Last modified date was shown as 17th july.

 

This was also reflected in the workflows and task creations, which caused the tasks created on 21st with due date as rule triggered date to show the task due date as 17th.

 

We got lot of cases created by end users on this regard for showing the dated without consistency.

 

Did any one come across this situation?

 

 

Thanks,

KP.

Hi,

 

I use ANT Tool for migrating my build. Earlier I used the ant tool version 15.0

I work from a proxy protected network.

 

After upgrading my salesforce ant version to reflect 16.0 version, I am not able to login to any instance for migrating the build from a proxy protected network. When ever i try it is showing an error message Failed to send request to https://cs1.salesforce.com/...<Soap version details>/<orgId>.

 

With 15.0 version, I have migrated using ant tool specifying proxy. But with 16.0 I am not able to carry my migration tasks. 16.0 version is working only with out proxy settings.

 

I have copied the new jar file into apache ant lib folder, but of no use.

I have completly installed the ant setup by downloading apache ant & salesforce ant tool from scratch... but in vain...the same result .

 

Any help in solving this problems is highly appreciated.

 

Thanks,

KP

Hi,

I am trying to create an AccountShare and AccountTeam record.

Requirement is: When an Account is created, Account has to be assigned to the Territory of the user who is creating the Account record. Also the user has to be added to the the AccountTeam for that particular Account. We are trying to achieve this using a Trigger and we are not using Assignment rules for lack of some feasibility reasons.

 

I have following two queries:

1. Is it possible to create AccountShare object or just it can be updated? When we try creating an AccountShare object it requests for all values of AccessLevel(Account,Opp,Case,Contact) fields and when provided with these values says AccessLevel cannot be below OWD for those objects though i am providing access above or same level as OWD for these objects.

 

2. i am trying to set RowCause field on AccountShare to TerritoryManual which i am unsuccessful becos it is a read only field. How can i set value for this field as i want to add the account to the territory of the user. Can the RowCause fied be updated for an exisitng AccountShare object in case we can't create AccountShare record as whenever an AccountTeam is created an entry is created in AccountShare.

 

Any help with this regard is appreciated. This is urgent!!

 

Thanks.

Hello all,

I have a trigger that is throwing

 

"Error:Apex trigger CancelStudy caused an unexpected exception, contact your administrator: CancelStudy: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id a0CR0000001posKMAQ; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 701R00000002Xyt) is currently in trigger CancelStudy, therefore it cannot recursively update itself: []: Trigger.CancelStudy: line 74, column 4"

 

I have disabled all other triggers on the respondent__c object (the type of record that is getting updated in the last statment that seems to be causing this issue). Respondent__C objects have a master detail relationship with campaigns, so maybe that is part of the problem? I don't really know. Any thoughts or insight is much appreciated. Thank you!

 

 

trigger CancelStudy on Campaign (before update) 
{
	//This trigger needs to find all respondents attached to any passed in campaign,
	//and send them an email, the email text is contained in a field on the campaign

	//Basic Heirarchy
	//Campaign <----(Master Detail)---- Respondent__C 
	
	//This trigger receives campaigns. From the campaigns we can find all attached respondents.
	//Respondents have contacts attached as well, so we can find the peoples email addresses.
	//A respondent__c is linked to a campaign by the Master_Campaign__c field on the respondent__c.
	
	
	
	//create a list to hold all campaign Id's we are going to need to find respondents for
	List<Id> campaignIds = new List<Id>();
	
	//Loop over all the campaigns passed in
	for(Campaign c:Trigger.new)
	{
		//If this campaign is set to be cancelled and the password is correct, add it to the list
		//Yes I know this is a stupid password, I'm gonna change it later.
		if(c.Cancel_Study__c == true && c.Cancel_Study_Password__c == 'stupidUglyFace')
		{
			//Add the Id to the list
			campaignIds.add(c.Id);
			
			//Update the status of this campaign
			c.Status = 'Canceled';
		}
		
		//If this campaign is set to be canelled but the password is not correct, error that record
		else if(c.Cancel_Study__c == true && c.Cancel_Study_Password__c != 'stupidUglyFace')
		{			
			c.Cancel_Study_Password__c.addError('Incorrect Password. Study not cancelled');	
		}
		
		//Blank out these fields so this trigger doesn't get rerun on subsequent saves
		c.Cancel_Study_Password__c = '';
		c.Cancel_Study__c = false;
		
	}
	
	//So now we have a map of campaigns to be cancelled
	//Now we need to figure out who we need to send emails to (those are sent via a workflow rule). 
	//That would be any respondent__c record with one of the campaigns specified in the map 
	//set as their master that are not cancelled already.
	
	System.debug('-----------------------------------------');
	System.debug('Canceling Studies' +campaignIds);

	if(campaignIds.size() > 0)
	{	
		//A list of all the respondent records to update with a canceled status
		List<Respondent__c> canceledRespondents = new List<Respondent__c>();
								
		
		//Find every respondent__c record that belongs to one of the campaigns being canceled.
		//Update their status and cancelation reason that will cause the workflow rule to fire
		for (Respondent__c respondent : [SELECT respondent__c FROM Respondent__c WHERE Master_Campaign__c IN :campaignIds and Respondent_Status__c = 'Scheduled'])
		{		
			//We want to mark the indivdual respondent record as canceled so the triggers, that will send the proper emails
			Respondent__c newRespondent = new Respondent__c(Id=String.valueOf(respondent.get('Id')));
			newRespondent.Respondent_Status__c = 'Canceled';
			newRespondent.Cancelation_Reason__c = 'Study Canceled';
			canceledRespondents.add(newRespondent);
		}
		

		System.debug('-----------------------------------------');
		System.debug('Updating Respondent Records' +canceledRespondents);
				
		//If there are any canceled Respondents, update their records so those triggers fire.
		if(canceledRespondents.size() > 0)
		{
			//This line is causing a recursive update problem.
			//I think maybe because the type of records it is attempting to update 
			//have a master detail relationship with the kind of record that fires this trigger?
			update canceledRespondents;
		}
	}	
}

 

 

I'm getting a null pointer exception when I try to use evaluate a checkbox field from my BusinessChannels__c custom setting and the checkbox is unchecked. It seems like kind of a joke to have to set up an if statement like

 

if(null!=bc.get('somefield__c')&&(Boolean) bc.get('somefield__c'))...

 instead of simply

if((Boolean) bc.get('somefield__c'))...

 or simpler

if(bc.get('somefield__c'))...

 

 

am i missing something obvious? thanks!

 

  • August 26, 2010
  • Like
  • 0

Hi there.  I can't seem to remove the "--none--" option in picklists...  I am sure it is an easy tweak, any thoughts?

Hi, I need help retrieving the option the user selected of a pre-determine values of a picklist I created. So my other indepedent picklist retrieves the value depending on the user first selection.

 

Thanks for all the Help you can give.

 

Here's the Code:

 

Controller Code:

 

    Public string select1{get; set;}
    Public string select2{get; set;}

 


    public List<SelectOption> getItems()
    {
        List<SelectOption> option = new List<SelectOption>(option); 
        option.add(new SelectOption('Modem1','Celulares'));
        option.add(new SelectOption('Modem2','Dmax'));
        option.add(new SelectOption('Modem3','ATM'));
        option.add(new SelectOption('Modem4','VOIP'));
        option.add(new SelectOption('Modem5','Modem5'));
        return option;
    }

 

    public List<SelectOption> getItems2()
    {
          List<SelectOption> options = new List<SelectOption>();

          if( theValueimsearchingfor = 'VOIP){


          List<Product2> proList = [select name from Product2 where ProductCode like '0001-%'];
          for(product2 a : proList)
           options.add(new SelectOption(a.Name,a.Name));
        }
        return options;
    }

 

Apex Code:

 

<apex:selectList id="picklist1" title="Tipo" id="selectlist1" value="{!select1}" size="1">
        <apex:actionSupport event="onclick" reRender="selectlist2"/>
        <apex:selectOptions value="{!items}"/>    

</apex:selectList>

 

 <apex:selectList title="Marca" id="selectlist2" value="{!select2}" size="1">
        <apex:actionSupport event="onclick"  reRender="selectlist3"/>
        <apex:selectOptions value="{!items2}"/>    
 </apex:selectList>

  • August 13, 2010
  • Like
  • 0

I created a custom object that i would like to trigger the creation of a Case when the object is created or updated with an open status. I found a previously writen trigger that I am using:

 

trigger CreateCase on PE_Case__c(After Update)

{

    if(Trigger.isUpdate){
        for(PE_Case__c  p: Trigger.new)

       {

          if(p.Status__c == 'Open')

          {

               Case cs = new Case();

              

                  cs.Reason = 'Internal';

 

                insert c;

          }
        
        }
    } 

}

 

Saleforce is accepting the trigger with no errors, but it is not firing.

 

Any help would be appreciated.

Hi,

I'd like to use a validation rule to say that if a certain value is selected in a pick list, a currency field MUST be left blank in order to save the case.  I have used validations before saying that if a field value is selected, a field is MANDATORY, but not the other way around.  Details below:

 

Controlling pick list:  Integration__c

Value:  "PCI"

Currency field name:  Publisher_CPM__c

 

Can you help?  Thanks so much!

Hi all,

I am working on a VF page with a lot of different modussus. Depending on the modus certain information should be shown. So I was thinking, and I thought I found a cool way how I could accomplish this. I created a function with a string as argument, and returns back if the element should be rendered or not.Using this function, the VF code should stay clean.

 

But when I try to use this function in my rendered attribute, it's not working :smileysad:. When I try to save (in eclipse) it says "Unknown function renderMe. Check spelling.".

 

Does anybody has any ideas, before I have to go and put everything in the rendered attribute itself over and over... Bleh that's gonna look dirty, I don't like to go that way :(

 

VF code:

 

<apex:page standardController="Account" extensions="AccountExtension" >
	<apex:commandButton value="Gegevens bewerken" action="{!enterEditMode}" rendered="{!renderMe('1')}"/>
	<apex:outputLabel value="" rendered="{!renderMe('1234')}"/>
</apex:page>

 

 

Controller code

 

 

public class AccountExtension {
	private static final String MODUS_1 = '1';
	private static final String MODUS_2 = '2';
	public String currentModus {get;set;}

	/** This method is used by the visual force components to determine if these can be rendered or not. 	*/
	public boolean renderMe(String modusses) {
		if (modusses.contains(currentModus)) {
			return true;
		}
		return false;
	}
}

 

 

 

 

 

 

 

I have a field "test__c" on an object order_line__c.

This field is updated to 1 when a button is clicked.

There is  a trigger that is supposed to fire  when this field is updated and it should create a new record.
However ,when the field is updated,there is no record creation.

The trigger code:

trigger iresv on order_line__c(after update)

{

    if(Trigger.isUpdate){
        for(Order_line__c m: Trigger.new)

       {

//this field(m.test) is updated when a button is clicked
          
if(m.test__c == '1')


          {

               Inventory_Reserve__c iv = new Inventory_Reserve__c();

//new object that must be created :inventory reserve has a master detail with product_inventory custom object.
//m.pinv__c has the id of the product inventory master record.
               

                iv.Product_Inventory__c= m.pinv__c;

                insert iv;

          }
         
        }
    }  

}

Please help

Hi guys, I am trying to compare two date fields in SF schema and is getting a malformed query error. Can anyone help me how to compare this two date fields please??? My SOQL query is like this: Select c.Status, c.SR_Number__c, c.Id, c.Due_Date__c, c.CreatedDate, c.CaseNumber From Case c where CreatedDate = Due_Date__c I just want to compare if the Created Date has the same date (YYYY-MM-DD) with my due date. Your help will be greatly appreciated. Thanks!!!
  • August 11, 2010
  • Like
  • 0

Hey All

 

Is there an option in Eclipse IDE or best practices steps documentation available on "How to roll back from Production?" in case some major code changes happen.

 

I am curious there should be a easy way

 

One of the methods that I was suggested to follow was:

 

Change the code in QA (Sandbox) and Deploy to Production. Is this a suggested approach?

 

Since there were custom field level changes and changes in signature of the methods in the Class/Dependent Class that were being deployed it caused the deployment to fail.

 

Please suggest me any easier approach for this Issue.:(

 

 

 

Hello!

 

I need someone with a few years in the SalesForce saddle to help design a product tracking system. It should be pretty straightforward, but since this is my first time I would feel a whole lot better if I had someone (a SalesForce mentor?) to:

 

  • Evaluate my logic for design and clarity and tell me when I'm wrong
  • Help with (what I hope are) simple triggers and workflow
  • Be available to do future work for hire

 

The logic is mapped out and I've even partially implemented most of it in the developer edition and it seems to work well, but who knows - I could be an idiot and need to start over.

 

The thing is, as I get more into this I am excited about the possibilities, but I know that someone with more background could do this better and more quickly than I can.

 

I think what I need can all be done with custom objects and minor formula tweaking.

 

I'm hoping someone out there could use some cash? If you're interested, please contact me through this board and leave me your phone number.

 

Thanks much!

 

Alex

 

 

Hi, 

 

I am trying to develop a trigger on a custom object ("Order"), that will automatically share the object with the current user's "Portal Role and Subordinates" on insert/update.


I am able to add the user itself to the "sharing" list via APEX, but have been unable to find a way to instead add the user's "Portal Role and Subordinates" to the sharing list via the APEX trigger.


Is it even possible to access the portal roles in this way via APEX triggers? If not, does anyone know of any workaround?

 

 

 

Thanks in advance. 

Hi,
 
The problem I m facing must be solved by so many developers.
 
I m trying to set public variable value in apex class from VF page.
VF Page uses StandardCotroller and that apex class as an extension
 
but that public variable not being set...  :womansad:
 
I need proper guidence....  :womanindifferent:
 
here is the source code:  VF Page
 
<apex:inputText id="clientid" value="{!clientId}"/>

Apex Class
 
public class PointOfSale
{
    public ID clientId;

    public ID getclientId()
    {
        return clientId;
    }
    public void setclientId (ID txt)
    {
        clientId = txt;
    }

    private final POS__c pos;
   
    public PointOfSale (ApexPages.StandardController controller)
    {
        this.pos = (POS__c)controller.getRecord();
    }
}
 
Is it becoz m using this class as extension?
 
Any Idea/Sugession/ help ???
 
 
Thanks