• srilakshmi1.387861669756762E12
  • NEWBIE
  • 40 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 32
    Replies
Hai friends, if any one want this criteria go thuough it .

trigger UpdateAccount on Opportunity (after insert,after delete, after update ) {
   
    if(Trigger.isInsert) {
  
    List<Account> acc=new List<Account>();
    List<Id> listIds = new List<Id>();
  
    for (opportunity childObj : Trigger.new) {
        listIds.add(childObj.AccountId);
    }
   
    Map<id,Account> mapAccounts=new Map<id,Account>([SELECT Id,TotalCount__c FROM Account where Id IN :listIds]);
         
    for (Opportunity opp :trigger.new){
        account a=mapAccounts.get(opp.AccountId);
        if(a!=null) {
            if(a.TotalCount__c == null) a.TotalCount__c =100;
            if(opp.Count__c != null) {
                a.TotalCount__c -= opp.Count__c;
                acc.add(a);
            }    
        }
        for(integer i=0;i<acc.size();i++)
        {
            update acc;
        }
    } 
    }
    
          
    if(trigger.isDelete) {
   
    List<Account> acc=new List<Account>();
    List<Id> listIds = new List<Id>();
  
        for (opportunity childObj : Trigger.old) {
            listIds.add(childObj.AccountId);
        }
        Map<id,Account> mapAccounts=new Map<id,Account>([select id, TotalCount__C from Account where id=:listIds]);
        for (opportunity childObj : Trigger.old) {
            if(childObj.AccountId != null) {       
                account ac=mapAccounts.get(childObj.AccountId);
                ac.TotalCount__c -= childObj.Count__c;
                acc.add(ac);
            }
        }
        for(integer i=0;i<acc.size();i++)
        {
              update acc;
        }
     }

   
    if(trigger.isUpdate)
    {
    List<Account> acc=new List<Account>();
    List<Id> listIds = new List<Id>();
    List<opportunity> newopp=new List<opportunity>();
   
        for (opportunity childObj : Trigger.new) {
            listIds.add(childObj.AccountId);
            newopp.add(childObj);
        }
         
        Map<id,Account> mapAccounts=new Map<id,Account>([select id, TotalCount__C from Account where id IN :listIds]);
          
        for (opportunity childObj : Trigger.New) {
            account ac=mapAccounts.get(childObj.AccountId);
            Opportunity oldOp = Trigger.oldMap.get(childObj.ID);
           
                if(ac.TotalCount__C == null) ac.TotalCount__C = 100;
               
                if(childObj.Count__c !=oldOp.count__c)
                {
                    if(oldOp.count__c>childObj.count__c)
                    {
                        Decimal i=oldOp.count__c-childObj.count__c;
                        ac.TotalCount__C =ac.TotalCount__C+i;
                        acc.add(ac);
                     }
                     else if(oldOp.count__c<childObj.count__c)
                     {
                         Decimal i=childObj.count__c-oldOp.count__c;
                         ac.TotalCount__C =ac.TotalCount__C-i;
                         acc.add(ac);
                     }
                    update acc;
               
                }
            }
        }       
}


hai friends

i created a webservices class,for that i genarated wsdl file from this file i created .jar file ok fine.
now i want to give this jar file to another user he can use what ever the class,method that are in .jar file ,any one guide me please urgent
Hello All,

When i try to append a div tag which contains a component, Javascript is not working.
I am trying to display components as header and footer over a div.

I have pasted my code and please check it and tell me what is the issue.

 
mydiv = $('<div id="somediv" class="somediv"></div>');
             mydiv1 = $('<br/>');
             alert('1');
             footerdiv = $('<div id="somediv2" class="header1"><c:Template_Header /></div>');
            alert('3');
            headerdiv = $('<div id="header_next" class="footer1"><c:Template_Header /></div>');     
            alert('2');
             
            alert('4');
            mydiv1.appendTo('body');
            headerdiv.droppable().appendTo('body');
            mydiv.droppable().appendTo('body');
            footerdiv.droppable().appendTo('body');
Sometimes, footerdiv is working and it is not executing after headerdiv.

Thanks in Advance,

Regards,
Ganesh.B
hai in my visual force page three buttons are there pdf,word,excel.when ever click on pdf the page is render as pdf,click on word that same page will be download as word file,click on excel excel file will be downloaded for that i wrote a code like this 


<apex:page standardController="account" recordSetVar="account" renderAs="{!if($CurrentPage.parameters.isPdf == null, null, 'pdf')}" contentType="{!if($CurrentPage.parameters.isWord== null, null,'application/x-excel#FileName.doc')}" extensions="pwe">
<apex:form >
<apex:pageBlock >
<apex:pageblockButtons >
<apex:commandButton value="pdf" action="/apex/automatic_insert?isPdf=true"/>
<apex:commandButton value="word" action="/apex/automatic_insert?isWord=ture"/>
<apex:commandButton value="excel" action="{/apex/automatic_insert?isExcel=ture"/>
</apex:pageblockbuttons>
<apex:pageBlockTable value="{!account}" var="a">
  <apex:column value="{!a.name}"/>
  <apex:commandButton action="{!save}" value="save"/>
  </apex:pageBlockTable>
  </apex:pageBlock>
</apex:form>
</apex:page>
 

but i am getting confusion with contentType.in <apex:page> we can place any one contentType.when how can i get excel with this code please help me ony one
Hi,
i wrote a code like this in html area but it is not working ,i think any setting problem .please help me process to execute the below code.
<script>  Sfdc.onReady(function() {    var keyPrefix = 'a7m';    var toRemove = document.getElementsByName('new');    if(document.location.href.indexOf('/' + keyPrefix + '/o') != -1 && toRemove && toRemove.length) {      toRemove[0].style.display = 'none';    }  });</script>
and also emable the Show Custom Sidebar Components on All Pages check box but it is not working
i think in Manage Users->users->Locale Settings->Locale is the current location of sales force user can ant one suggest is it corret or not please

HI All,

 

I m trying to dispaly a multipicklist as checkboxes in vf page but not succeeding.

 

How can I display the picklists in below showed style.

 

Name of the field : testpick__c

values : a, b, c, d, e

Object name: test__c

 

Expected Output:

                                A                     B                        C                       D                      E

 

Testpick                   X                      X                        X                      X                        X 

 

 

Thanks in advance..........

 

I have a list of type String which contains objects of Salesforce like Contact, Account, Opportunity,quote,case etc.

I want to convert the list of string in sObject to use the following line.

 

List<String> a=new List<String>();a.add(sObject.valueOf('Account'));

a.add('Contact');

a.add('opportunity');

a.add('Quote');

a.add('Account');

 

for(String x:a)

{

Map<String,sObjectField> fmap=Schema.sObjectType.x.fields.getMap();

}

// but it  showing error. How i convert a string into Sobject.

 

the red color X is will be string from a list.....

 





Hi,

 

  I want to display the account and related contacts in the same visual force page. Actually i am achieved this like,

i am displayed the account names in first page block and am kept the command link for that account names if we click on that command link that will displayed the contacts related to that particular account in another pageblock. But, Now i want to display the account name first and all related contacts line by line. like that  i want to displat the contacts for all accounts. please any one help me how to solve this...

 

 

example

Maple Lawn Office III
8161 Maple Lawn Blvd
Fulton, MD 20759

Contact: Lydia Chandlee
G & R Management
840 First Street, NE
Washington, DC 20002

Phone: 301-807-0271
Fax: 202-898-0053
Email: 

Contract: No
Inspection Date: 4/6/2010
Inspection Type: Annual
5 Year Test: 2012
Reg/Serial #: HO1863
Service Company: Kone
Equipment Type: Passenger Hydraulic
Annual Price (per unit): $180
Semi-Annual Prince (per unit): $80

Maple Lawn Office III
8161 Maple Lawn Blvd
Fulton, MD 20759

Contact: Lydia Chandlee
G & R Management
840 First Street, NE
Washington, DC 20002

Phone: 301-807-0271
Fax: 202-898-0053
Email: 

Contract: Yes
Inspection Date: 4/6/2010
Inspection Type: Annual
5 Year Test: 2012
Reg/Serial #: HO1863
Service Company: Kone
Equipment Type: Passenger Hydraulic
Annual Price (per unit): $180
Semi-Annual Prince (per unit): $80

 

 

 

thanks,

yamini