• Naveen Nelavelli
  • NEWBIE
  • 55 Points
  • Member since 2013

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 20
    Replies

Hi,

 

  I created a trigger to check the Billingstate. In below trigger if user enter ALABAMA it will update as AL. 

 

  What if user enter Alabama or alabama how to convert this into upper case please suggest. 

 

trigger Update_Account_BillTO_ShipTO_State on Account (Before Insert, Before Update)
{
  for (Account a : Trigger.new) 
  {
     if ( a.BillingState == 'ALABAMA' ) 
      {
         a.BillingState = 'AL';
       }     
  
 
   } 
}

 Thanks

Sudhir

I am new to Salesforce and would appreciate some help with a validation rule:

 

I currently have:

 

AND (
OR (
ISPICKVAL (Level_of_Interest__c, "Enrolled")),
ISBLANK (Date_of_First_Class__c))

 

But I need to add another AND condition:

 

Campaign_Master__r.Campaign_Name__c  contains the text 'Cert II Tourism'

 

Thanks in advance.

  • August 28, 2013
  • Like
  • 0

I am trying to do a concatenate merging two text fields.  Occasioanlly the concatenated field may contain a duplicate value. I am looking for a way to delete the duplicate value so only the value only appears once. 

 

IE: Field 1: 123567,88595

      Field 2: 987987,88595

 

Concatenate Field Result: 123567,88595, 987987,88595

 

Desired Result: 123567,987987,88595

 

Can anyone suggest a way to do this? 

  • September 05, 2013
  • Like
  • 0

Hi

i written one schedular class assigning task to users

am getting this error can any one tell me why am getting

this schedular class worked me for few days but after some days its showing this error

 

System.ListException: Duplicate id in list: 00T9000000O8CnMEAV

 

this is my class.

 

global with sharing class Task_Escalation_duedate implements Schedulable
 {

public List<Client_Requirement__c> clientreq=new list<Client_Requirement__c>();
public List<Client_Requirement__c> clientreq1=new list<Client_Requirement__c>();
public List<Client_Requirement__c> clientreq2=new list<Client_Requirement__c>();
public list<task> listtask=new List<task>();
public list<task> listtask2=new list<task>();
public list<task> listtask3=new List<task>();
public list<task> listtask4=new List<task>();
public list<task> crmtasks=new List<task>();
public list<task> crmtasks1=new List<task>();
public list<user> userrecords=new List<user>();
public set<id> listtask1=new set<id>();
public set<id> CRID=new set<id>();
public set<id> CRMID=new set<id>();
 
public set<id> sysid=new set<id>();


global void execute(SchedulableContext SC) {

try{

// list of all client requirements
clientreq=[select id,name,RecordTypeid,Ownerid  from Client_Requirement__c];
system.debug('List of client requirement'+clientreq);
for(Client_Requirement__c cr: clientreq)
{
CRID.add(cr.id);// fetching the list of all client req IDS
}
// query for fetching the tasks that are not closed with in due date

listtask=[Select t.CreatedDate, t.Id, t.LastModifiedById, t.LastModifiedDate, t.OwnerId, t.Priority,
t.Status, t.Subject, t.WhatId, t.WhoId,t.ActivityDate,t.Due_Date__c from Task t where Whatid=:CRID and Status='Not Started'  and  ActivityDate=YESTERDAY];
system.debug('List of tasks that are not closed with in due date '+listtask);
 //d=listtask.ActivityDate;
if(listtask.size()>0)
{
for(task t: listtask)
{
if(t.OwnerId=='00590000001qNM7' || t.OwnerId=='00590000001qNMq' || t.OwnerId=='00590000001qNMM')
{
t.OwnerId='00590000001qNKB';// Assigning the crm owner to the all the tasks
listtask2.add(t);
}
}

}
update listtask2; //updating the tasks
system.debug('List of tasks that are updated to user crm head '+listtask2);

//--------------------------------------------------------------------------------------------------
clientreq1=[select id,name,RecordTypeid,Ownerid  from Client_Requirement__c where OwnerId='00590000001qNKB'];
system.debug('List of client requirement'+clientreq1);
for(Client_Requirement__c cr: clientreq1)
{
CRMID.add(cr.id);// fetching the list of all client req IDS
}

crmtasks1=[Select t.CreatedDate, t.Id, t.LastModifiedById, t.LastModifiedDate, t.OwnerId, t.Priority,
t.Status, t.Subject, t.WhatId, t.WhoId from Task t where Whatid=:CRMID and Status='Not Started' and ActivityDate=YESTERDAY];
system.debug('List of tasks that are not closed with in 1 days of crm user created records'+crmtasks1);
if(crmtasks1.size()>0)
{
for(task t: crmtasks1)
{
if(t.OwnerId=='00590000001qNKB')
{
t.OwnerId='00590000001WzWy';
crmtasks.add(t);
}
}
}
update crmtasks;
system.debug('List of crm tasks that are updated to system admin '+crmtasks);

//-----------------------------------------------------

clientreq2=[select id,name,RecordTypeid,Ownerid  from Client_Requirement__c];
system.debug('List of client requirement'+clientreq2);
for(Client_Requirement__c cr: clientreq2)
{
sysid.add(cr.id);// fetching the list of all client req IDS
}
system.debug('list of idssss for system admin'+sysid);

// query for fetching the task that crm head user not completed the tasks
listtask3=[Select t.CreatedDate, t.Id, t.LastModifiedById, t.LastModifiedDate, t.OwnerId, t.Priority,
t.Status, t.Subject, t.WhatId, t.WhoId from Task t where whatid=:sysid and Status='Not Started' and Due_Date_3_days__c=today];

system.debug('List of tasks that are not closed after 3 days '+listtask3);

if(listtask3.size()>0)
{
for(task t: listtask3)
{
if(t.OwnerId=='00590000001qNKB' || t.OwnerId=='00590000001qNM7' || t.OwnerId=='00590000001qNMq' )
{
t.OwnerId='00590000001WzWy';// Assigning the system admin to the tasks that crm head user not completed
listtask4.add(t);
}

}
update listtask4;  // updating the tasks.
system.debug('List of tasks that are updated to user sysadmin head '+listtask4);
}
}catch(Exception e){system.debug('@@@@@@@@@@@@@@'+e);}
}
}

 

Regards

venkatesh

I created a workflow formula to send a survey if Last Survey Sent Date is greater than or equal to 90 days. I need to also send the survey if there is no date in the field (as in the case of a new contact). 

 

Can anyone help me add to this formula?

 

Thanks in advance for your help!

 

today() - DATEVALUE(Last_Survey_Sent_Date__c) >= 90

Hi,

when do you use a static variable in Apex? for exam:

 

global with sharing class AccountRemoter{

    public String accountName { get; set; }

    public static Account account { get; set; }

 

-Kaity

  • September 02, 2013
  • Like
  • 0

hi  plz help me ,

   Maximum how many extensions can use in VF page?

Can anyone please help me take the SOQL outside the for loop?

 

The code is given below:

 

    if(Trigger.isAfter && Trigger.isInsert){
      List<Timeline_Entries__c> TimeLineList = new List<Timeline_Entries__c> ();
      List<Moratorium__c> MoratoriumList = new List<Moratorium__c>();
      for(Case cs:Trigger.new){
        MoratoriumList=[Select Name,Cert_No__c,Start_Date__c,Stop_Date__c from Moratorium__c where Cert_No__c=:cs.Cert_Number__c]  ;
          system.debug('MoratoriumListkasize'+MoratoriumList.size());
          for (integer x=0;x<MoratoriumList.size();x++){
            TimeLineList.add(new Timeline_Entries__c(Type__c='Test',Case__c=cs.id,Call_In_Out__c='In',Activity__c='TestingMoratoriums',Curtailment_Calc__c='Start',Activity_Date__c=MoratoriumList[x].Start_Date__c));
            TimeLineList.add(new Timeline_Entries__c(Type__c='Test',Case__c=cs.id,Call_In_Out__c='In',Activity__c='TestingMoratoriums',Curtailment_Calc__c='Stop',Activity_Date__c=MoratoriumList[x].Stop_Date__c));
          }
      }
    if(TimeLineList.size()>0){
     insert TimeLineList;
    }  
  }

Hi,

 

  I created a trigger to check the Billingstate. In below trigger if user enter ALABAMA it will update as AL. 

 

  What if user enter Alabama or alabama how to convert this into upper case please suggest. 

 

trigger Update_Account_BillTO_ShipTO_State on Account (Before Insert, Before Update)
{
  for (Account a : Trigger.new) 
  {
     if ( a.BillingState == 'ALABAMA' ) 
      {
         a.BillingState = 'AL';
       }     
  
 
   } 
}

 Thanks

Sudhir

Hi,

Can anyone help.

 

I want use a extension with custom controller

<apex:page controller="MyApexClass" extensions="MyExtClass"...> ... </apex:page>
public with sharing class MyExtClass {
  private MyApexClass ctrl;
  public MyExtClass(MyApexClass controllerParam){
      ctrl = controllerParam;
  }
}

I have used in similar manner but now,if i have a vf page with select list and its getter and setter method are in MyExtClass(extension) then how do i use that variable value in my controller MyApexClass.

 

like for example:

How do i use selectedvalue3 in my controller MyApexClass.

Is there any way to do this?

public with sharing class MyExtClass {
public string selectedValue3{get;set;} private MyApexClass ctrl; public MyExtClass(MyApexClass controllerParam){ ctrl = controllerParam; } }

Hi Team,

 

Is writing of 'System.debug' in class and trigger deteriorrates the performance of the UI?

 

-Kaity

 

 

  • August 30, 2013
  • Like
  • 0

Hi,

 

I have an object with the following data {name, location, distance}.  I want to identify all the objects having the same name and location and delete all but the one with the shortest distance.  Would this be possible using SOQL?

 

If not would it be possible to write a trigger to avoid the creation of objects if they have the same name and location of an existing object?

 

Thanks

What are the methods are involved while deploying the Apex class and trigger ?

 

Thank u in Advance.

I am new to Salesforce and would appreciate some help with a validation rule:

 

I currently have:

 

AND (
OR (
ISPICKVAL (Level_of_Interest__c, "Enrolled")),
ISBLANK (Date_of_First_Class__c))

 

But I need to add another AND condition:

 

Campaign_Master__r.Campaign_Name__c  contains the text 'Cert II Tourism'

 

Thanks in advance.

  • August 28, 2013
  • Like
  • 0

Hi,

 

i have 20 fields. i,e Day 1, Day2, Day3, Day4....Day20

 

i need to write a single validation rule for all  those fields to allow only 1, 0.5, 0 

 

Please help me.

 

Thanks

  • August 27, 2013
  • Like
  • 0

Validation Rule

 

If Fields 'Test ID  2','Test ID 3' ,'Test ID  4','Test ID 5'  are filled in and the  Termination  Date is AFTER the  Activation Date, then a rule shall be in place that the  Activation Date field cannot have a value AFTER the Termination Date.

 

what should be the code to achieve this..These all fields are on the same object.

 

Thanks for the help in advance

All,

 

I have a reuirement in whivh I have 2 tables with different fields.There is a field called "Unit No" in table A which should match with "Catalog No" of table B. So I want to do 3 things:-

1)Do left outer join to get all records of Table A and records of Table B with match on Unit No and Catalog No.

2)Do right outer join to get all records of Table B and records of Table A with match on Unit No and Catalog No.

3)Inner join with matching records from both tables.

 

I tried using IN but than I need Id value for comarison and my Unit No and Catalog No fields are not the name/Id field, they are normal salesforce custom text fields.

 

Any hep is greatly appreciated.

  • August 26, 2013
  • Like
  • 1

Hi,

 

I would like to create a visual force page, which contains lookup fields.

 

And I would like to set some basic value in lookup field text box. So that user can click the "lookup" button to query with some basic condition.

 

For example:
<inputField value="a"/> (text field)
<inputField value="b"/> (lookup field)

 

User will set a value first, maybe "company", then I would like to copy the value of a ("company") to b's text box, so that I can query b with conditon of a ("company").

 

Any one can help me?

 

Thanks

Kunlun

  • August 26, 2013
  • Like
  • 0

I am running into Too many SOQL queries error..

I know that there is soql inside for loop which is causing the problem.

How to change So that I cannot get "Too many SOQL queries"

 

 

 

public with sharing class Create_pass {
public list<user> usr;
public void create_password() {
List<User> userList = new List<User>();

userList = [SELECT Id,alias,Email,Territory_Id__c,Pass__c,title from User  ];
for (User u : userList)
{
System.setPassword(u.Id,u.Territory_Id__c);
System.debug('DONE: '+ u.Id);

}

}

}

  • August 26, 2013
  • Like
  • 0

have 3 currency fileds, amount a, amount b, amount c.

 

and a formala with a+b+c, but only saveed, then can see this fields. want to see this field, value change when the changing of amount a, b, c

I'm wracking my brain trying to figure out why this formula isn't working - I would like a checkbox formula field on a custom object that compares 2 date fields. One of the date fields comes from another custom object that my formula custom object has a lookup relationship to ("Church_Role_History__c").

 

Here's my formula:

NOT(ISBLANK(Church_Role_History__c)) &&
(New_End_Date__c <> Church_Role_History__r.End_Date__c)

 

I would like this checkbox to be checked if my lookup field, Church_Role_History__c is not blank, meaning my record is related to a record in that object. If it is, I'm also considering whether a date on my custom object is not equal to a date on Church_Role_History. If it's related to a Church_Role_History__c record and the dates are different, I would like the checkbox checked.

 

It's working as-is as long as there's a date entered on the Church_Role_History record (in the "End_Date__c" field, but if it's blank the checkbox is not checked. Can anyone tell me what's wrong with this formula?