• aswanijagadesh1.397398535585991E12
  • NEWBIE
  • 45 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 23
    Questions
  • 40
    Replies
hai friends 
for this i wrote like this 


trigger upserttest on Account (before insert) {
    if(trigger.isInsert)
    {
        account acc1;
        List<Account> lisAcc=trigger.new;
        list<Account> incAcc=new List<Account>(); 
        for(Account acc:lisAcc)
        {
            List<Account> preacc=[select name from account where name=:acc.name];
            system.debug('333333333333'+preacc.size());
       
            if(preacc.size()>0)
            {
                system.debug('555555555'+preacc[0].name);
   
                for(Account prea:preacc)
                {
                    prea.name=prea.name+'ing';
                    update prea;
                }
            }
           
            else
            {
             if(trigger.isBefore)
                for(integer i=0;i<10;i++)
                {
                acc1=new account(name=acc.name);
                //acc.name=acc.name;
                insert acc1;
                }
                }
            }   
   
   
    }
    }

it is updating previous records but if newly entered name is not there it is not inserting 10 record of new name
please help me for this
hai
here i created to different recod types for opportunity object.so when i want to create new opportunity record it first asks me record type selection .so how can i skip this page when creating new record?
Hi,my profile is system admin.
(developer edtion)
now i provide grant account login access from settings it provide login link to one user only.here i want login link for every user how can i please help me 
 User-added image

Hi,
i have an objects Like A,A1,A2........and so on.(No Relation Ship Between Objects).

Now i want to  get id,name fields objects where object name like '%A%'.(get all records where object name contains A)
how can i please tell me.
hi,i wrote a class like this 

global class SoapApiAccountContact {   
    webService static List<Contact> sayContact() {
    List<contact> con=[select Id,LastName from contact where Account.Name='tvarana'];
    return con;
    }
}

for genarating wsdl file for this class i am getting this error

Apex Generation Failed
Unable to find complexType for {http://soap.sforce.com/schemas/class/SoapApiAccountContact}address

any one please help me how to create a client class to pass list of contacts to server

Hai ,i am new to test casees so can any one help me how to write test case for following code
trigger PrefixDoctor on Lead (before insert,before update)
{
List<Lead> leadList = trigger.new;
for(Lead l: leadList)
{
l.firstname = 'Dr.'+ l.firstname;
}
}
Hai friends,
 i displayed account list view page in visual force page by using   <apex:enhancedlist>
like this

<apex:page>
    <apex:enhancedlist type="Account" height="730" customizable="false" rowsPerPage="25" Listid="00B90000006FRvh" /> 
</apex:page>

shall i change the column order in this visual force page please suggest me urgent

Hai friends,
i want to display all objects with its keyprefix values for this i done like this

in controller class:
public class GettingObjectsAndKeyPrifix {
    public List<Schema.SObjectType> gd {get;set;}
    public List<String> objectMap {get;set;}

     Public GettingObjectsAndKeyPrifix(){
        gd= Schema.getGlobalDescribe().Values();
        objectMap = new List<String>();
        for(Schema.SObjectType f : gd)
        {
            objectMap.add(f.getDescribe().getKeyPrefix());
        }
        System.debug('--------- --'+gd);
        System.debug('+++++++++ --'+objectMap.size() );
    }
}

in visual force page:
<apex:page controller="GettingObjectsAndKeyPrifix">
    <!--http://srinivas4sfdc.blogspot.in/2013/12/list-of-salesforce-object-key-prefixes.html-->
   <apex:pageBlock >
   <apex:pageBlockSection >
        <apex:pageBlockTable value="{!objectMap}" var="o">
        <apex:column value="{!o}"></apex:column>
        </apex:pageBlockTable>  
      <apex:pageBlockTable value="{!gd}" var="g">
    <apex:column value="{!g}"></apex:column>
    </apex:pageBlockTable>
  
    </apex:pageBlockSection>
   
     </apex:pageBlock>
   
</apex:page>

here output is comming ,but i want output like

account--001
Note-002
like this how can i please help.

i want ouput like this in url
http://srinivas4sfdc.blogspot.in/2013/12/list-of-salesforce-object-key-prefixes.html
hai friends,in my account i have a datetime field its value is      5/30/2014 2:49 PM.
when i queried if in apex it show      Fri May 30 09:19:00 GMT 2014.
i want to disaply date time as standard  value (5/30/2014 2:49 PM) in visual force by getting apex class.(change the date format in apex class only)
for ths i tried like this

<apex:page controller="accountdatetime">
{!a.date_created__c}<br/>
{!myDate}
</apex:page>

public with sharing class accountdatetime {
public account a{get;set;}
public user a1{get;set;}
public String myDate{get;set;}
public String strConvertedDate{get;set;}
public accountdatetime()
{
a=[select date_created__c from account where id='0019000000wD8wU'];
Datetime thisDT =a.date_created__c;
TimeZone tz=UserInfo.getTimeZone();
//myDate = thisDT.format('yyyy-MM-dd HH:mm:ss', 'PST');
//strConvertedDate = GMTDate.format('dd/MM/yyyy hh:mm:ss a', 'PST');
myDate = thisDT.format('MM/dd/yyyy hh:mm a','a.date_created__c' );
system.debug('111111'+a.date_created__c+'2222'+myDate);

}

}
ouput:
Fri May 30 09:19:00 GMT 2014
05/30/2014 09:19 AM can any one please help me to get this by using timezone,format in apes class only 
hai friends
when i click on a row in visual force page i want to get these field values into controller please any one guide me urgent
<apex:page standardController="Lead" recordSetVar="leads" tabstyle="lead" sidebar="false" extensions="leadclickgenaccount">
   <script>
   fun()
   {
   }
  
   </script>
  
   <apex:pageBlock >
    <apex:pageBlockTable value="{!leads}" var="ld"  onRowClick="fun();">
      <apex:column value="{!ld.name}"/>
      <apex:column value="{!ld.phone}"/>
      <apex:column value="{!ld.email}"/>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:page>
hai friends 

i did like this 
<apex:page standardController="account" recordSetVar="acc" >
    <script>
        function callme()
        {
        alert("hi");
        input[type='checkbox'] {alert("haiff"); }
        }
   
    </script>
   
  
    <!--<style>
    function callme()
    {
    alert("hai");
    /*input[type="checkbox"]:checked{
        background-color: yellow;
        font-weight: bold;
    }*/
    }
     </style>-->


    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable Value="{!acc}" var="a">
                <apex:column >
                <apex:inputCheckbox id="che" onclick="callme();"/>
                <apex:outputText value="{!a.name}"/>
                </apex:column>   
            </apex:pageBlockTable>
        </apex:pageBlock>   
    </apex:form>
   
</apex:page>
but i didn't get please help me to achieve this 
hai friends 
if account name is alerady exit then display error message ,other wise insert new account. for this i wrote like this
trigger DuplicateAcc on Account(after insert) {
    List<Account> acc=[select id,name from account];
    public account acc1;
    //system.debug('1111111'+acc.size());
    for (Account acct:Trigger.new) {   
     for(Account a:acc)
     {
       if(acct.name==A.name)
         {          
         acct.addError('ERROR: there is already an identical record Name in Data Base: <a href=\'https://na1.salesforce.com/'  + a.id + '\'+ target="_blank">'+ a.id+'</a>',false);
         return;
         }
         //acc1=new account(name=acct.name);        
         //insert acc1;
        
        }
         // system.debug('********'+acct.name);  
        // acc1=new account(name=acct.name);        
         //insert acc1;
         //break;
         }
         }
insert is not done please how can i do this guide me urgent


hai friend 
i want to sent a report to public group but in run report drop down schedule.. i am not getting public groups how to do this cloud you guide urgent please
hai friends
 i want to query the related opportunity of account into trigger(after insert).i wrote a query by using trigger.new here i am getting newly inserted record also why because it is executing after insert.i want previous opportunity only into trigger.isafter.


i will explain with example
for account three opportunities are there.now i am adding fourth one (i want previous three opportunity records into trigger.isafter of trigger on opportunity not fourth one) can any one please help me (i come to know this is achieved by trigger.oldMap in trigger.isafter)
hai 
in account we have contacts ,for contacts emails are there ok fine. now i want emails of contacts of all accounts.if email is duplicated then corresponing account name will be display on visual force page (urgent )
hai friends i am getting user name,my profile,my settings,developer console, logout in a row manner .how can i change that view to dropdown list please help me (i think any setting problem)
hai friends 
for this i wrote like this 


trigger upserttest on Account (before insert) {
    if(trigger.isInsert)
    {
        account acc1;
        List<Account> lisAcc=trigger.new;
        list<Account> incAcc=new List<Account>(); 
        for(Account acc:lisAcc)
        {
            List<Account> preacc=[select name from account where name=:acc.name];
            system.debug('333333333333'+preacc.size());
       
            if(preacc.size()>0)
            {
                system.debug('555555555'+preacc[0].name);
   
                for(Account prea:preacc)
                {
                    prea.name=prea.name+'ing';
                    update prea;
                }
            }
           
            else
            {
             if(trigger.isBefore)
                for(integer i=0;i<10;i++)
                {
                acc1=new account(name=acc.name);
                //acc.name=acc.name;
                insert acc1;
                }
                }
            }   
   
   
    }
    }

it is updating previous records but if newly entered name is not there it is not inserting 10 record of new name
please help me for this
hai
here i created to different recod types for opportunity object.so when i want to create new opportunity record it first asks me record type selection .so how can i skip this page when creating new record?
Hi,my profile is system admin.
(developer edtion)
now i provide grant account login access from settings it provide login link to one user only.here i want login link for every user how can i please help me 
 User-added image

Hi,
i have an objects Like A,A1,A2........and so on.(No Relation Ship Between Objects).

Now i want to  get id,name fields objects where object name like '%A%'.(get all records where object name contains A)
how can i please tell me.
hi,i wrote a class like this 

global class SoapApiAccountContact {   
    webService static List<Contact> sayContact() {
    List<contact> con=[select Id,LastName from contact where Account.Name='tvarana'];
    return con;
    }
}

for genarating wsdl file for this class i am getting this error

Apex Generation Failed
Unable to find complexType for {http://soap.sforce.com/schemas/class/SoapApiAccountContact}address

any one please help me how to create a client class to pass list of contacts to server

Hai ,i am new to test casees so can any one help me how to write test case for following code
trigger PrefixDoctor on Lead (before insert,before update)
{
List<Lead> leadList = trigger.new;
for(Lead l: leadList)
{
l.firstname = 'Dr.'+ l.firstname;
}
}
Hai friends,
i want to display all objects with its keyprefix values for this i done like this

in controller class:
public class GettingObjectsAndKeyPrifix {
    public List<Schema.SObjectType> gd {get;set;}
    public List<String> objectMap {get;set;}

     Public GettingObjectsAndKeyPrifix(){
        gd= Schema.getGlobalDescribe().Values();
        objectMap = new List<String>();
        for(Schema.SObjectType f : gd)
        {
            objectMap.add(f.getDescribe().getKeyPrefix());
        }
        System.debug('--------- --'+gd);
        System.debug('+++++++++ --'+objectMap.size() );
    }
}

in visual force page:
<apex:page controller="GettingObjectsAndKeyPrifix">
    <!--http://srinivas4sfdc.blogspot.in/2013/12/list-of-salesforce-object-key-prefixes.html-->
   <apex:pageBlock >
   <apex:pageBlockSection >
        <apex:pageBlockTable value="{!objectMap}" var="o">
        <apex:column value="{!o}"></apex:column>
        </apex:pageBlockTable>  
      <apex:pageBlockTable value="{!gd}" var="g">
    <apex:column value="{!g}"></apex:column>
    </apex:pageBlockTable>
  
    </apex:pageBlockSection>
   
     </apex:pageBlock>
   
</apex:page>

here output is comming ,but i want output like

account--001
Note-002
like this how can i please help.

i want ouput like this in url
http://srinivas4sfdc.blogspot.in/2013/12/list-of-salesforce-object-key-prefixes.html

Hi,

 

How to create custom object and custom object fields using Apex code.

 

Is this possible?

 

Thanks,

Yarram.

  • December 11, 2013
  • Like
  • 0