• Ankit Khurana24
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 15
    Replies

i need to show last visited of any record of standard salesforce object (e.g. account) on standard salesforce page .

please help me out with this.

 

note:i need to show last visited date not updated date on standard page

how to show dependent picklist on vf page also controlling picklist need to be shown as radio button.

There are 2 dependent picklist in standard account object name Select region and Select Countries.....i need to show them on vf page such that  Select region should be as radio button....Slect region has 3 values ASIA,EUROPE AND ALL...and 10 countries values in Select Countries.first five for Asia ,last five for EUROPE ..and all values for all option are made..as dependent picklist..

....i am also able to convert picklist to radio button ..but dependent functionality is not working with radio button..please help..below is the code..

apex page

<apex:page standardController="account" extensions="CountryClass">
<apex:form >

<apex:pageBlock title="Dependent Picklist" mode="edit">
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.Select_REGION__c}">
<apex:selectoptions value="{!types}"></apex:selectoptions>

</apex:inputField>
<apex:inputField value="{!account.Select_Countries__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

controller

public class CountryClass
{

public CountryClass(ApexPages.StandardController controller)
{

}

public List<SelectOption> getTypes()
{
Schema.sObjectType sobject_type = account.getSObjectType();

Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();

Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();

List<Schema.PicklistEntry> pick_list_values = field_map.get('Select_Region__c').getDescribe().getPickListValues();

List<selectOption> options = new List<selectOption>();

for (Schema.PicklistEntry a : pick_list_values)
{
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}

}

 

 

i have 3 radio buttons Asia,Europe and  and a picklist conatining 10 countries.....on selecting Asia only five asian countries shouldbe shown ,on selecting euopre all five european countries shouls be shown and on selecting all ..all 10 countries shouls be shown..

i have made vf page ..and controller ...please let me know how to bind radio button with picklist

 

below class shows all contacts on vf page in data table and perform pagination...maxim of 20 records are shown on a page...next,previous,last buttons are provided for navigation

 

public class ContactGrid

{
public Boolean Displayout{get;set;}
public List<Contact> cList {get;set;}
public List<Contact> cppz{get;set;}
public List<Contact> subListCon{get;set;}
public List<Contact> mainListCon{get;set;}
public Id retid{get;set;}
public boolean shownext{get;set;}
public boolean showprevoius{get;set;}
Integer pageNumber{get;set;}
Integer maxPages;

List<Contact> updatedContactList = new List<Contact>();
public ContactGrid(){
cppz = new List<Contact>();
subListCon = new List<Contact>();
mainListCon = new List<Contact>();
shownext = false;
showprevoius = false;
pageNumber = 1;

cppz=[Select c.Phone, c.LastName, c.FirstName, c.Email, c.AccountId From Contact c];
integer remainder = math.MOD(cppz.size(),20);
if(remainder ==0){
maxPages = cppz.size()/20;
}
else{
maxPages = cppz.size()/20+ 1;
}
if(cppz.size()>0)
{

if(cppz.size()>20)
{
for(integer i =0;i<20;i++)
{
Contact chlObj = cppz[i];
subListCon.add(chlObj);
}
shownext = true;
}
else
{
for(Contact chlObj : cppz)
{
subListCon.add(chlObj);
}
shownext = false;
showprevoius = false;
}
for(Contact chlObj : cppz)
{
mainListCon.add(chlObj);
}
}

 

}

public void goToLast()
{
while (shownext)
nextBtnClick();
}

public void nextBtnClick()
{
pageNumber = pageNumber+1;
System.debug('pageNumber----->' + pageNumber);
System.debug('maxPages + '+maxPages);
subListCon = new list<Contact>();
if(pageNumber == maxPages){
System.debug('pageNumber == maxPages ');
for(integer i=((20*pageNumber)-20); i<mainListCon.size(); i++)
{
subListCon.add(mainListCon[i]);
}
shownext = false;
}
else{

for(integer i=((20*pageNumber)-20); i<(20*pageNumber); i++)
{
subListCon.add(mainListCon[i]);
}
}
showprevoius = true;
}


public void previousBtnClick()
{
pageNumber = pageNumber-1;

subListCon = new list<Contact>();
for(integer i=((20*pageNumber)-20); i<(20*pageNumber); i++)
{
subListCon.add(mainListCon[i]);
}
shownext = true;
if(pageNumber == maxPages){
shownext = false;
}
if(pageNumber == 1){
showprevoius = false;
}
else{
showprevoius = true;
}
}

public void saveContact()
{

for(Contact c: subListCon ){
updatedContactList.add(c);
}
if(updatedContactList.size()> 0)
update updatedContactList;
//Displayout = true;
//return null;
}

public pageReference CreateContact()
{
List<Contact> new1= new List<Contact>();
cppz.addall(new1);
return null;
}



}

there is a vf page on custom object which shows all the contacts in the grid view.in the following format

 

 

       Create New Contact(button)

                                    

Action

Last Name

First Name

Email

Phone

Account Name

Save

Editable data

Editable data

Editable data

Editable data

Editable lookup

Save

Editable data

Editable data

Editable data

Editable data

Editable lookup

what i need to do is:

1.on editing some field and then clicking save button...record should be saved and refreshes same page.

2. there is pagination required such only 20 records shown at a time and blow link to next page and previous page

2.a.there should not be previous on first page and next on last page.

 

i did like  this...but both functionality are not working..please help

 

my vf page:-

<apex:page controller="ContactGrid" id="thepage" >
<apex:form id="theform" >



<apex:pageBlock title="Contact Grid" id="theblock" >
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<apex:commandButton value="Create New Button"/>
<apex:pageBlockTable width="80%" columns="6" value="{!cppz}" var="o" id="thetable">
<apex:column headerValue="Action" >
<apex:commandButton value="Save" id="savebutton" action="{!saveContact}" rendered="{!Displayout == false}"/>
</apex:column>
<apex:column headerValue="Last Name" >
<apex:inputField value="{!o.LastName}" rendered="{!Displayout == false}"/>

</apex:column>
<apex:column headerValue="First Name" >
<apex:inputField value="{!o.FirstName}" rendered="{!Displayout == false}"/>
</apex:column>
<apex:column headerValue="Email" >
<apex:inputField value="{!o.Email}" rendered="{!Displayout == false}"/>
</apex:column>
<apex:column headerValue="Phone">
<apex:inputField value="{!o.Phone}" rendered="{!Displayout == false}"/>
</apex:column>
<apex:column headerValue="Account Name" >
<apex:inputField value="{!o.AccountId }" rendered="{!Displayout == false}"/>
</apex:column>
</apex:pageBlockTable>



<apex:outputPanel layout="block" styleClass="pSearchShowMore" id="otpNav2">
Total Records Found: <apex:outputText rendered="{!IF(Con.resultSize==20,true,false)}">20 +</apex:outputText><apex:outputText rendered="{!IF(Con.resultSize < 20,true,false)}">{!Con.resultSize}</apex:outputText>
<apex:image url="/img/search_prevarrow_disabled.gif" styleClass="prevArrow" rendered="{!NOT(Con.HasPrevious)}"/>
<apex:image url="/img/search_prevarrow.gif" title="Previous Page" styleClass="prevArrow" rendered="{!Con.HasPrevious}"/>
<apex:commandLink action="{!Previous}" title="Previous Page" value="Previous Page" rendered="{!Con.HasPrevious}"/>
<apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!NOT(Con.HasPrevious)}">Previous Page</apex:outputPanel>
&nbsp;({!IF(Con.PageNumber == 1,1,((Con.PageNumber -1) * Con.PageSize)+1)}-{!IF(Con.resultSize < Con.PageSize,Con.resultSize,Con.PageNumber * Con.pageSize)})&nbsp;
<apex:outputPanel styleClass="pShowLess noLink" style="color:grey" rendered="{!NOT(Con.HasNext)}">Next Page</apex:outputPanel>
<apex:commandLink title="Next Page" value="Next Page" rendered="{!Con.HasNext}" action="{!Next}"/>&nbsp;
<apex:image url="/img/search_nextarrow.gif" title="Next Page" styleClass="nextArrow" rendered="{!Con.HasNext}"/>
<apex:image url="/img/search_nextarrow_disabled.gif" rendered="{!NOT(Con.HasNext)}"/>
</apex:outputPanel>


</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

controller class:-

public class ContactGrid

{
public Boolean Displayout{get;set;}
public ApexPages.StandardSetController con{get; set;}
public List<Contact> cppz;
public Id retid{get;set;}

public ContactGrid(){ }
public List<Contact> getCppz()
{
cppz=[Select c.Phone, c.LastName, c.FirstName, c.Email, c.AccountId From Contact c];
return cppz;
}

public pageReference saveContact()
{
upsert cppz;
Displayout = true;
return null;

}
//Boolean to check if there are more records after the present displaying records
public Boolean hasNext
{
get
{
return con.getHasNext();
}
set;
}

//Boolean to check if there are more records before the present displaying records
public Boolean hasPrevious
{
get
{
return con.getHasPrevious();
}
set;
}

//Page number of the current displaying records
public Integer pageNumber
{
get
{
return con.getPageNumber();
}
set;
}

//Returns the previous page of records
public void previous()
{
con.previous();
}

//Returns the next page of records
public void next()
{
con.next();
}

 

}

 

 

 

what i need to do is:make a class to to a create a campaign for all those opportunities whose status is "closed lost" and create a campaign for them also all the contacts related to that opportunity should move to campaign member.e

 

Step  would be like this:

1.Create a camapign.

2.Identify lost opportunities

3.Identify contact related to those opportunities.

4.Put Idsof conatc into set,<map>

5.Add these conatacts to cmapaign members.

 

public class moveopportunity
{
List<Opportunity> selectopp;
public string campaignid1;
public string conactid;
List<CampaignMember> cmember;
public moveopportunity()
{
selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];
cmember=new List<CampaignMember>();

if(selectopp!=null)
{
for(Opportunity O:selectopp)
{

O.CampaignId = '70190000000MjHs';("how to avoid hard code")
cmember=[Select c.ContactId, c.CampaignId From CampaignMember c where CampaignId =:'70190000000MjHs'];
for(integer i=0;i<O.OpportunityContactRoles.size();i++)
{
cmember[0].ContactId= O.OpportunityContactRoles[i].ContactId ;
}
update O;
update cmember;
}

}
}
public void move()
{

}


}

 

please help the above code in

1Avoid.hard code the campaign..i need to create it..

2. How to fetch contacts from opportunities because opportuniti>>>account>>contact is relationship

3.how to add conatcts obtained in sets to campaign member..

.

 i need to write test class for the respective class...i  did like it but no coverage has been attained.

public class moveopportunity
{
  List<Opportunity> selectopp;
  public string campaignid1;
  public string conactid;
  List<CampaignMember> cmember;
  public moveopportunity()
  {
   selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];
  cmember=new List<CampaignMember>();
  }
  public void move()
  {
        if(selectopp!=null)
        {
            for(Opportunity O:selectopp)
            {
               
                O.CampaignId = '70190000000MjHs';
                cmember=[Select c.ContactId, c.CampaignId From CampaignMember c  where CampaignId =:'70190000000MjHs'];
               for(integer i=0;i<O.OpportunityContactRoles.size();i++)
                {
                cmember[0].ContactId= O.OpportunityContactRoles[i].ContactId ;
                }
                update O;
                update cmember;
            }
           
        }
  }


}

 

i wrote test class as:

@isTest
private class moveopportunity_test {

    static testMethod void myUnitTest() {
        Opportunity opp = new Opportunity();
       /*8opp.Id='00690000008BBTp' ;**/
        opp.CampaignId='70190000000MjHs';
        opp.StageName ='Closed Lost' ;
        /*opp.OpportunityContactRoles.ContactId ='0039000000FtGgY';*/
        
        insert opp;
        moveopportunity ci = new moveopportunity();
        ci.move();
        
    }
        
    }

 

how to modify to increase coverage to 75%

 

i need to write schedular class to move "Closed lost " opportunities to a campaign and their related contacts to campaign member..idid loike this but it is not working....please help also let me know where do i need to write system.schedule method....

public class moveopportunity
{
  List<Opportunity> selectopp;
  public string campaignid1;
  public string conactid;
  public moveopportunity()
  {
   selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];
  
  }
  public void move()
  {
        if(selectopp!=null)
        {
            for(Opportunity O:selectopp)
            {
               
                O.CampaignId = '70190000000MjHs';
                 update O;
            }
           
        }
  }


}

 

and

 

global class scheduledMerge implements Schedulable
{
   global void execute(SchedulableContext SC)
   {
      moveopportunity M = new moveopportunity();
   }
}

 

" i need to make a scheduler which will find all opportunity whose status is lost and will create campaign for them and add their contact as campaign member" 

 

 now how will i find all the contacts related to an opprtunity and how do i move then under an campaign.

i need to  find all the opportunity whose status is "closed lost" and create a camapigjn for them...i did like this but its not working.Please rectify the error:-

  

public class moveopportunity
{
List<Opportunity> selectopp;
public string campaignid1;
public string conactid;
public moveopportunity()
{
selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];

}
public void move()
{
if(selectopp!=null)
{
for(Opportunity O:selectopp)
{

O.CampaignId = '70190000000MjHs';
update O;
}

}
}


}

I need to create a schedular which will find all opportunity whose status is lost and will create campaign for them and add their contact as campaign member.

i have written a code for the show this functionality..

There is an custom button on contact record page...on the click of this button an vf page will open which will show 5 fields of this contact and 5 fields of the account associated with this contact..

i have written this code..please help me writing test class for this code..

public class contactdetail
{
public Contact con{get;set;}
public string retid{get;set;}
public PageReference pr;
public List<Contact> contactrecord{get;set;}
public List<Account> cppz;
public List<Contact> oppz;



public contactdetail(ApexPages.StandardController controller)
{
retid=ApexPages.currentPage().getParameters().get('id');
this.con=(Contact)controller.getRecord();
pr=new PageReference('/'+retid);
pr.setRedirect(true);
}
Public PageReference Contactdetails()
{
return pr;
}
public List<Contact> getOppz()
{
Contact con1= [Select id FROM Contact where id = :con.id];
if (con1.id == null)
return null;
oppz = [Select c.FirstName, c.Fax, c.Email, c.Department, c.Birthdate, c.AssistantName From Contact c where c.Id = :con1.id];
return oppz;

}
public List<Account> getCppz()
{
Contact con2= [Select id ,AccountId FROM Contact where id = :con.id];
if (con2 .AccountId == null)
return null;
cppz = [Select a.Type, a.Phone, a.Name, a.CreatedDate, a.Birthday__c From Account a where a.Id = :con2.AccountId ];
return cppz;
}


}

1.i need to get id of 20 latest created cases.

how to create a grid on vf page ......

1.grid need to show which case has been assigned to whom(loged in users)

2. grid need to contains  maximum of 20 latest  cases.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 How to Create tab for case grid on VF Page which will show all the cases which are assigned to logged in  users (maximum  record shown 20 new created cases should come first).

Whenever a new case is created, Assign case to most free user (who have minimum no of cases). There is a counter on user which show that how many cases has been assigned to an user.  Based on this counter cases will be assigned to users....

 

i   am doing like this but not able to...

 

Assigned_Cases__c is a custon field on user...

 

trigger assignUser on Case (before insert,after insert)
{

String userId = '';
Map<id,user> userMap= new Map<id,user>([select id, Assigned_Cases__c from User]);

if(Trigger.isInsert && Trigger.isBefore)
{
for(case c : Trigger.new)n
{
List<User> uu = userMap.values();
List<id> i =[select id from uu ORDER BY uu.Assign_Case__c ASC];
userId = i[0].id;
user up = userMap.get(userid);
up.Assign_Case__c++;
userMap.put(userId,up);
c.ownerId = userId;
}
update userMap.values();
}
}

 

ERROR:-Error: Compile Error: sObject type 'uu' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 12 column 41

 Whenever a new contact is created under an account, system should create a task for the loged in user and an email should go to the mail id of the contact

 Can anyone help me in doing this...  

  Extract   data from one salesforce Org (at least 10 records per object) and upload the same into other Salesforce Org for following objects.

I          For   Objects Account, contact, lead, opportunity

II           and  two custom object Object A (Parent) and Object B (child) having master detail relationship .both these objects contain  a field of each data type .

Whenever a new contact is created under an account, system should create a task for the loged in user and an email should go to the mail id of the contact

how to show dependent picklist on vf page also controlling picklist need to be shown as radio button.

There are 2 dependent picklist in standard account object name Select region and Select Countries.....i need to show them on vf page such that  Select region should be as radio button....Slect region has 3 values ASIA,EUROPE AND ALL...and 10 countries values in Select Countries.first five for Asia ,last five for EUROPE ..and all values for all option are made..as dependent picklist..

....i am also able to convert picklist to radio button ..but dependent functionality is not working with radio button..please help..below is the code..

apex page

<apex:page standardController="account" extensions="CountryClass">
<apex:form >

<apex:pageBlock title="Dependent Picklist" mode="edit">
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.Select_REGION__c}">
<apex:selectoptions value="{!types}"></apex:selectoptions>

</apex:inputField>
<apex:inputField value="{!account.Select_Countries__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

controller

public class CountryClass
{

public CountryClass(ApexPages.StandardController controller)
{

}

public List<SelectOption> getTypes()
{
Schema.sObjectType sobject_type = account.getSObjectType();

Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();

Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();

List<Schema.PicklistEntry> pick_list_values = field_map.get('Select_Region__c').getDescribe().getPickListValues();

List<selectOption> options = new List<selectOption>();

for (Schema.PicklistEntry a : pick_list_values)
{
options.add(new selectOption(a.getLabel(), a.getValue()));
}
return options;
}

}

 

 

 i need to write test class for the respective class...i  did like it but no coverage has been attained.

public class moveopportunity
{
  List<Opportunity> selectopp;
  public string campaignid1;
  public string conactid;
  List<CampaignMember> cmember;
  public moveopportunity()
  {
   selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];
  cmember=new List<CampaignMember>();
  }
  public void move()
  {
        if(selectopp!=null)
        {
            for(Opportunity O:selectopp)
            {
               
                O.CampaignId = '70190000000MjHs';
                cmember=[Select c.ContactId, c.CampaignId From CampaignMember c  where CampaignId =:'70190000000MjHs'];
               for(integer i=0;i<O.OpportunityContactRoles.size();i++)
                {
                cmember[0].ContactId= O.OpportunityContactRoles[i].ContactId ;
                }
                update O;
                update cmember;
            }
           
        }
  }


}

 

i wrote test class as:

@isTest
private class moveopportunity_test {

    static testMethod void myUnitTest() {
        Opportunity opp = new Opportunity();
       /*8opp.Id='00690000008BBTp' ;**/
        opp.CampaignId='70190000000MjHs';
        opp.StageName ='Closed Lost' ;
        /*opp.OpportunityContactRoles.ContactId ='0039000000FtGgY';*/
        
        insert opp;
        moveopportunity ci = new moveopportunity();
        ci.move();
        
    }
        
    }

 

how to modify to increase coverage to 75%

 

i need to write schedular class to move "Closed lost " opportunities to a campaign and their related contacts to campaign member..idid loike this but it is not working....please help also let me know where do i need to write system.schedule method....

public class moveopportunity
{
  List<Opportunity> selectopp;
  public string campaignid1;
  public string conactid;
  public moveopportunity()
  {
   selectopp=[Select o.Id, o.CampaignId, (Select OpportunityId, ContactId From OpportunityContactRoles) From Opportunity o where Opportunity.StageName =:'Closed Lost'];
  
  }
  public void move()
  {
        if(selectopp!=null)
        {
            for(Opportunity O:selectopp)
            {
               
                O.CampaignId = '70190000000MjHs';
                 update O;
            }
           
        }
  }


}

 

and

 

global class scheduledMerge implements Schedulable
{
   global void execute(SchedulableContext SC)
   {
      moveopportunity M = new moveopportunity();
   }
}

 

I need to create a schedular which will find all opportunity whose status is lost and will create campaign for them and add their contact as campaign member.

i have written a code for the show this functionality..

There is an custom button on contact record page...on the click of this button an vf page will open which will show 5 fields of this contact and 5 fields of the account associated with this contact..

i have written this code..please help me writing test class for this code..

public class contactdetail
{
public Contact con{get;set;}
public string retid{get;set;}
public PageReference pr;
public List<Contact> contactrecord{get;set;}
public List<Account> cppz;
public List<Contact> oppz;



public contactdetail(ApexPages.StandardController controller)
{
retid=ApexPages.currentPage().getParameters().get('id');
this.con=(Contact)controller.getRecord();
pr=new PageReference('/'+retid);
pr.setRedirect(true);
}
Public PageReference Contactdetails()
{
return pr;
}
public List<Contact> getOppz()
{
Contact con1= [Select id FROM Contact where id = :con.id];
if (con1.id == null)
return null;
oppz = [Select c.FirstName, c.Fax, c.Email, c.Department, c.Birthdate, c.AssistantName From Contact c where c.Id = :con1.id];
return oppz;

}
public List<Account> getCppz()
{
Contact con2= [Select id ,AccountId FROM Contact where id = :con.id];
if (con2 .AccountId == null)
return null;
cppz = [Select a.Type, a.Phone, a.Name, a.CreatedDate, a.Birthday__c From Account a where a.Id = :con2.AccountId ];
return cppz;
}


}

 How to Create tab for case grid on VF Page which will show all the cases which are assigned to logged in  users (maximum  record shown 20 new created cases should come first).

Whenever a new case is created, Assign case to most free user (who have minimum no of cases). There is a counter on user which show that how many cases has been assigned to an user.  Based on this counter cases will be assigned to users....

 

i   am doing like this but not able to...

 

Assigned_Cases__c is a custon field on user...

 

trigger assignUser on Case (before insert,after insert)
{

String userId = '';
Map<id,user> userMap= new Map<id,user>([select id, Assigned_Cases__c from User]);

if(Trigger.isInsert && Trigger.isBefore)
{
for(case c : Trigger.new)n
{
List<User> uu = userMap.values();
List<id> i =[select id from uu ORDER BY uu.Assign_Case__c ASC];
userId = i[0].id;
user up = userMap.get(userid);
up.Assign_Case__c++;
userMap.put(userId,up);
c.ownerId = userId;
}
update userMap.values();
}
}

 

ERROR:-Error: Compile Error: sObject type 'uu' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names. at line 12 column 41

Hi... 

Please let me know..how to update a custom field in case object {say enter_text_c} on save click such that if we there is an text 'today' in the field it should be converted to today's date..