• Jonye Kee
  • NEWBIE
  • -1 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 37
    Replies
Hello, I am trying to use a trigger to check or validate information in a Case custom field.   I have a list of data(serial numbers), I want to see if a serial number entered into my custom serial number field in the list of serial number i have.  If it is in the list, I want a notifiaction that it is on the list.   I was told a trigger may help me with this.  Can someone point me in the right direction?
Hi, we are looking for a London based Salefsforce developer/architect who can help us to connect a sign up form on Craft CMS (created by someone else) with Salesforce. Our aim is to create/update contacts and accounts and to create new campaign members.
Thank you



 
Hi there!

I need to code a button action that prints PDF attachments of the the selected objects in a list view.
How can I call to the printer automatically for doing this just by clicking a button?

Thank you!!
LEN(ZIP_Code__c) > 0 &&
(Country__c = "USA" || Country__c = "US") &&
VLOOKUP(
$ObjectType.ZIP_Code__c.Fields.City__c,
$ObjectType.ZIP_Code__c.Fields.Name,
LEFT(ZIP_Code__c,5))
<> City__c

what is the error....??
thnx, in advance
Hi,
In user debug:
DateTime currentTime = DateTime.now();
system.debug(currentTime);

The time output is an hour late but the time stamp value is correct. my locale is BST UK.
How can I get the debug log to give me the correct uk time.

Thank you

Vida

 
HI Experts,

while posting my code in developers community, getting this error what does it mean by."The operation is not permitted. If you received this in error, please contact info@developerforce.com (code: B2)"
Hello... This is driving me crazy!
I am a new admin, mainly to work on our service cloud email templates and basic things like that.

I have managed to create a button which opens a new window and in this window a MS Word Doc downloads.
We can then open this and print the address from MS Word.  Its a workaround.
Eventually, we will be getting a label printer (dymo or similar).
The MS Word document I created is a visualforce page, and I have also been able to out put this as a PDF (output:PDF) easily.. although contolling the page size and layout is tricky!

SO..
I wondered about creating flow to do this???

WHAT WE WANT:
Is to click a button within a case, or a contact record, and an address to print.  Why the hell is this so hard!!!?? haha....

I have the merge fields working in the VF page - but how can I automate this to print?

Does anyone have any tips, or have done similar things and can point me onto the right track?  Any advice greatly appreciated :)
I am new to this, so go easy on me.
Many thanks.
 
Create an Apex class that returns an array (or list) of strings: 
Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.

MyApexClass to above Challenge:

public class StringArrayTest {
    
    public static List<string> generateStringArray(Integer n)
    {
        List<String> myArray = new List<String>();
        
        for(Integer i=0;i<n;i++)
        {
            myArray.add('Test'+i);
            System.debug(myArray[i]);
        }
        return myArray;
        
    }


It's compile and execute as per requirement in Developer console. But Traihead showing the below error:

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.

Anyhelp would be greatly appreciated. Thanks.
 
Hi everyone, 

First attempt at writing a trigger and need some guidance. 

I have a custom Child object calls Account_Contact_Roles_c (not using the standard Salesforce b/c we want to see the related list on both the account and contact record) that tracks the account main contacts. We have a custom field on the contact record calls Contact Roles_c, which is a formula text field that pulls in the value from the Account_Contact_Roles_c's Role_c field. Using a WF rule with the following formula:

IF ( INCLUDES ( Roles__c , "Primary Contact" ), "Primary Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Key Contact" ), "Key Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Billing Contact" ), "Billing Contact: ",null ) &
IF ( INCLUDES ( Roles__c , "Sponsor Contact" ), "Sponsor Contact: ",null )

Whenever the contact role is updated in the custom object, the field on the contact record will update to reflect the new value. Thus if Primary & Sponsor are seleted in Role_C, Contact_Roles_c will have the value Primar Contact: Sponsor Contact.

However, we want the Contact_Roles_c field to clear out when the Account Contact Role record is deleted. I know WF can't accomplish this and only trigger can. Hope someone can point me in the right direction.

Thanks!
The REST API documentation references a /limits endpoint (http://www.salesforce.com/us/developer/docs/api_rest/index_Left.htm#StartTopic=Content/resources_limits.htm) to discover the limits for the authorized organization. However, the docs say that it is still in PILOT mode and only available for developers.

The "Status Codes and Error Responses" section (http://www.salesforce.com/us/developer/docs/api_rest/index_Left.htm#StartTopic=Content/errorcodes.htm) of the documentation makes no reference to a LIMITS error code.

1) Is the /limits endpoint still in pilot mode? If so, how else can I programmatically discover the API limits for the authorized organization? 
2) What status code and errorCode (i.e. LIMIT_HIT) can I watch for in my code to stop pinging Salesforce? How can I get the expiration as well so I know when I can start pinging Salesforce again?

Hello out there,

 

I have a multi select picklist called "Artist_Type__c". The values in "Artist_Type_c" are also the title of other picklists. "Visual_Artist__c", "Sculptor__c", etc. I need a rule that forces the user to make a selection from the picklists based on their response in the multi select picklist. Is this possible? If so, help!

 

Thanks, everybody!

Olivia

  • April 03, 2012
  • Like
  • 0

Here is the start of my class method:
___________________________________________________________________
 

public class TradeCalendarController {

    // Set class variable
  public Trade_Calender__c nitch;
  public Trade_Events__c trade;
  
    //set List variables
    Trade_Events__c[] recList; 
    Trade_Events__c[] recDelete; 
        
    //STANDARD CONTROLLER SECTION
 
 public TradeCalendarController(Trade_Calender__c item){
    this.nitch = item;

}  
   public String getParam(String name) {
        return ApexPages.currentPage().getParameters().get(name);   
    }

public TradeCalendarController(ApexPages.StandardController stdController) {
    this.nitch = (Trade_Calender__c)stdController.getRecord();
        
    recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c, 
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,  
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];
    
    if(recList.size()==0){
        newRow();
    }
}
// returns Record information
 public Trade_Events__c[] getRecList() { 
   return recList; 
}
      
 // Inserts all changes into records
 public pagereference saveChanges() { 
update nitch;
try {
upsert recList;
} catch (DMLException e){
     ApexPages.addMessages(e);
   return null;

     }
// after save refreshes data on page
  recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c,
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];

   getRecList();
 
return null;
}

 // Inserts a new row
 public pagereference newRow() { 

  Trade_Events__c d = new Trade_Events__c();
  for(Trade_Calender__c trade:[Select id, name, account__c, Year__c from Trade_Calender__c where id = :nitch.id]){
  d.Account__c = trade.account__c;
  d.Name = trade.name;
  d.Year__c = trade.Year__c;
  d.Trade_Calender__c = nitch.id;
  recList.add(d);

}
return null;

 }

// clones a row
 public PageReference cl() {
 String delid = getParam('delid');
 Trade_Events__c d = new Trade_Events__c();
  for(Trade_Events__c trade:[Select id, Pack__c, Vendor__c, Merch_Type__c, Promo_Price__c, Category__c, name, account__c, Year__c from Trade_Events__c where Trade_Calender__c=:nitch.id and ID=:delid]){
  d.Account__c = trade.account__c;
  d.Name = trade.name;
  d.Year__c = trade.Year__c;
  d.Trade_Calender__c = nitch.id;
  d.New_Pack__c = trade.Pack__c;
  d.Merch_Type__c = trade.Merch_Type__c;
  d.Pack__c ='a0y40000000LzEK';
  d.Promo_Price__c = trade.Promo_Price__c;
  d.Category__c = trade.Category__c;
  d.Vendor__c = trade.Vendor__c;
  recList.add(d);

 }

   return null;
   }
 // delete row
 public PageReference del() {
        try {
            String delid = getParam('delid');
            Trade_Events__c event = [SELECT Id FROM Trade_Events__c WHERE ID=:delid];
            DELETE event;
        } catch (Exception e) {
            ApexPages.addMessages(e);
        }
// after del refreshes the data on page
    recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c,
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];
    getRecList();
    return null;
    }

}

 

I have a formula that works as designed but need to make it work only for a specific record type.  My formula is below.  I appreciate any help provided.

 

IF ( INCLUDES ( Account.Blog_Selections__c , "used-car-values.com" ), "used-car-values.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c , "my-home-improvement.com" ), "my-home-improvement.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "rentals-on-vacation.com" ), "rentals-on-vacation.com; ",null ) &
IF ( INCLUDES ( Account.Blog_Selections__c, "client’s website blog" ), "client’s website blog; ",null )

Part One: How can I make an app open in the custom view that I created for that app? Part Two: How can I create a local .csv or .xls file from the data in the app? Thanks for all of your help. 

hi can anybody help me in writing test class for this controller. I need just a start to finish it.I am new to this test classes creation.

 

public with sharing class gusignup {

     public Boolean emailacept { get; set; }

    public Boolean emailerror { get; set; }

    public String email { get; set; }

    public String job { get; set; }

    public String ctry { get; set; }

    public String zip { get; set; }

    public String state { get; set; }

    public String city { get; set; }

    public String street { get; set; }

    public String comp { get; set; }

    public String lname { get; set; }

    public String fname { get; set; }
    
    public Boolean echeck { get; set; }

    public String rpwd { get; set; }

    public String pwd { get; set; }

}

    public PageReference psignup() {
    emailerror=false;
        emailacept=false;
        List<guestuser__c> ldtls=[select Id from guestuser__c where Email__c=:email];
        
        if(ldtls.size()>0)
        {
            emailerror=true;
            emailacept=false;
            //uid exist
        }
        else
        {
            if(pwd==rpwd)
            {
                emailerror=false;
                emailacept=false;
                guestuser__c gu=new guestuser__c();
                gu.First_Name__c=fname;
                gu.Password__c=pwd;
                gu.Email__c=email;
                gu.Title__c = job;
                gu.Email_Optout__c = echeck;
                gu.Last_Name__c = lname;
                gu.Company__c = comp;
                gu.Street__c = street;
                gu.State__c = state;
                gu.City__c = city;
                gu.Country__c = ctry;
                gu.Zipcode__c = zip;
                
                
                Lead ld=new Lead();          
                ld.FirstName =fname;
                ld.LastName=lname;
                ld.Company=comp;
                ld.Street=street;
                ld.State=state;
                ld.city=city;
                ld.PostalCode=zip;
                ld.country=ctry;
                ld.Title=job;
                ld.Email=email;
                ld.HasOptedOutOfEmail=echeck;
                
                
                try{
                insert ld;
                insert gu;
                Pagereference pageref=new Pagereference('/apex/thankq');     
                    pageref.setRedirect(true);
                    return pageref;
                }
                catch(Exception e)
                {
                    system.debug(e);
                }
            }
            else
            {
                ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.WARNING, 'PASSWORD MISS-MATCH');
                ApexPages.addMessage(myMsg);
            }
        }
        return null;
    }


    
    public void checkavlble() {
        String lusername= Apexpages.currentPage().getParameters().get('mail');
        List<guestuser__c> chkldtls=[select Id from guestuser__c where Email__c=:email];
        if(chkldtls.size()>0)
        {
            emailerror=true;
            emailacept=false;
        }
        else
        {           //try another
            emailerror=false;
            emailacept=true;
        }
    }


    

 

 

Hi ,

i am new to apex programming.

my requirement is like below

opportunity can have Tradin plan

 

Each opportunity can have n number of trading plan but

all trading pan amount can not  greater than the opportunity amount .

  

to check the sum of trading plan amount whether it is greater or less

in validation rules it is not possible so i thought  i  can write  apex trigger

 

but i don't know how to stop data insertion  if codition fails in apex trigger .

below i written apes trigger before insert

please help me on this

 

trigger TradingPlanInsert on Opportunity_Trading_Plan__c (before insert)
{
          
           Id opptID;
           double oppAmount = 0;
           double oppTplanAmount= 0;
           for(Opportunity_Trading_Plan__c newTradinPlanObj: Trigger.new)
           {
          
                opptID = newTradinPlanObj.Opportunity_trading__c;
                oppTplanAmount = oppTplanAmount +  newTradinPlanObj.Plan_Amount__c;
           }
          
         Opportunity_Trading_Plan__c[] oppTradingobj = [Select Id, Name, CurrencyIsoCode, Opportunity_trading__c,
         Plan_Amount__c, Trading_Received_Date__c, Milestone__c, Description__c, GM__c
         FROM Opportunity_Trading_Plan__c  where Opportunity_trading__c = :opptID];
        
         for(Opportunity_Trading_Plan__c oppTexistinObj  : oppTradingobj )
         {
            oppTplanAmount = oppTplanAmount +  oppTexistinObj.Plan_Amount__c;
         }
        
         Opportunity[]  oppobj = [Select Id, StageName, Amount, CloseDate, Type, CurrencyIsoCode   FROM Opportunity where ID =:opptID];
         for(Opportunity oppdetailsObj  : oppobj )
         {
            oppAmount =   oppdetailsObj.Amount;
         }
         if (oppAmount < oppTplanAmount )
         {
           System.Debug('Trading plan  amount more than opportunity amount ');   
         }
          
          

 

 

Message Edited by sridharbarla on 03-08-2010 11:59 PM

Hey everyone. I have another probably easy question. The Salesforce site I am building is totally powered by a custom object called Website_data__c. All the content for the site is held in records that are of that type. On the Website_data__c object, there is a field called sub_menu__c (it is a picklist). That list defines which menu this particular page will show up on. There are 4 possible options.

 

My Visual force page starts has the standard controller set to that object, and the recordsetvar set. Of course that pulls all records for that object.

 

Page TitlePage IdSub Menu
Home Pagea0Y4000000127tvEAAMain
Text Pagea0Y4000000127uUEAQMain
Careersa0Y4000000127ztEAAAbout FPI
Contact Usa0Y400000012803EAAAbout FPI
Driving Directionsa0Y40000001280DEAQTester Info

 

Thats what the results look like. However I need to divide that into 3 seperate lists (based on the sub menu attribute), or somehow filter out any links that don't belong to the sub menu I am interested in when creating my link list. So really I just want to run selects against the record set, or have a loop with an if statment or something. Being so totally new to visual force, I don't know how to include logic of any kind on my pages (or if it's even possible). Thanks ahead of time.

 

 

Hi All,


I'm the Product Manager for packaging here at salesforce.com.  We're currently working on a feature that would allow fields and objects to be removed from managed packages.  This is a popular request and something we're hoping to deliver very soon, but we need your help.  Please respond to this post with any thoughts around this topic.  I've included a few questions to get the conversation going:


  • Why do you want to remove these?  No longer used?  Customers didn't like them?  Replace with a new field?
  • When you deprecate a field/object, what should happen for existing customers?  New customers?
  • Would you have to remove all usage of a field/object in your app before you can deprecate it?  What happens if you've included the field in another formula field, etc?  
Thanks for your time and input!
Message Edited by A_Smith on 02-20-2009 05:55 PM
I have a apex code which runs fine when the user is a sysadmin.
But it errors with null pointer when the user is another profile.

How do I debug this ? Thanks