- srilakshmi1.387861669756762E12
- NEWBIE
- 40 Points
- Member since 2013
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
13Questions
-
32Replies
Trigger to Update account field when opportunity is inserted?
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;
}
}
}
}
-
- srilakshmi1.387861669756762E12
- July 30, 2014
- Like
- 0
- Continue reading or reply
how to use .jar file in sales force?
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
-
- srilakshmi1.387861669756762E12
- May 20, 2014
- Like
- 0
- Continue reading or reply
access list integers from controller to visual force page
in controller:
public with sharing class list_test {
public list<integer> i { get; set; }
public list_test()
{
i=new List<integer>();
i.add(5);
i.add(10);
i.add(15);
i.add(20);
system.debug('111111111111'+i);
}
}
-
- srilakshmi1.387861669756762E12
- April 26, 2014
- Like
- 0
- Continue reading or reply
repeating header and footer for every page in pdf ,that is genarated by visual force page
<apex:page renderAs="pdf">
<head>
<style type="text/css">
div.header {position: running(header)}
div.footer {position: running(footer)}
@page{
@top-center {content: element(header)}
@bottom-center {content: element(footer)}
}
</style>
</head>
<div class="header">
<apex:image value="{!$Resource.tvarana_logo}" width="120" height="50"/>
</div>
<div class="footer" align="right">
Date:<apex:outputText value="{!NOW()}"/>
</div>
<h1>
Editor's Note: Leonardo DiCaprio makes another Oscar-maybe move, James Franco responds to Of Mice and Men critics, and more in our pre-weekend roundup.
After getting beat down in one Oscar tourney after another (perhaps because he's too cool), Leonardo seems to be betting it all on "The Revenant," the new Alejandro González Iñárritu film based on Michael Punke's novel. As the Vanity Fair piece notes, this director's films have vaulted stars like Naomi Watts and Javier Bardem to the nomination list, and hopefully the sixth time's the charm.
The Broadway revival "Of Mice and Men" has been getting mixed-but-by-no-means-stinkaroo reviews (here's a favorable one in Variety). Star James Franco allowed himself to be wounded deeply enough by The New York Times' opinions that he cussed out reviewer Ben Brantley on Instagram. The comment has since been deleted, but just like Steinbeck's 1937 tale of friendship and humanity, the internet is forever.
To help you celebrate Easter this weekend, the AV Club has rounded up seventeen of the most terrifying bunnies in pop culture, from literary diehards like Bunnicula to angsty indie creatures like Frank from "Donnie Darko." I'm a "Night of the Lepus" fan from way back, so it's a sure bet that on Sunday morning I'll be eating Russell Stover marshmallow-filled eggs and watching gigantic mutated rabbits getting electrocuted on the train tracks. Joyous tidings!
The early creature design for 1987's "Predator" was nothing like you'd expect -- and it wasn't anything like Jean Claude Van Damme expected either. In the video below, you'll discover why the original costume was scrapped, and why The Muscles from Brussels decided not to play the now-iconic monster. I bet he's kicking himself now! (And since it's JCVD, he can actually do that.)
Editor's Note: Leonardo DiCaprio makes another Oscar-maybe move, James Franco responds to Of Mice and Men critics, and more in our pre-weekend roundup.
After getting beat down in one Oscar tourney after another (perhaps because he's too cool), Leonardo seems to be betting it all on "The Revenant," the new Alejandro González Iñárritu film based on Michael Punke's novel. As the Vanity Fair piece notes, this director's films have vaulted stars like Naomi Watts and Javier Bardem to the nomination list, and hopefully the sixth time's the charm.
The Broadway revival "Of Mice and Men" has been getting mixed-but-by-no-means-stinkaroo reviews (here's a favorable one in Variety). Star James Franco allowed himself to be wounded deeply enough by The New York Times' opinions that he cussed out reviewer Ben Brantley on Instagram. The comment has since been deleted, but just like Steinbeck's 1937 tale of friendship and humanity, the internet is forever.
To help you celebrate Easter this weekend, the AV Club has rounded up seventeen of the most terrifying bunnies in pop culture, from literary diehards like Bunnicula to angsty indie creatures like Frank from "Donnie Darko." I'm a "Night of the Lepus" fan from way back, so it's a sure bet that on Sunday morning I'll be eating Russell Stover marshmallow-filled eggs and watching gigantic mutated rabbits getting electrocuted on the train tracks. Joyous tidings!
The early creature design for 1987's "Predator" was nothing like you'd expect -- and it wasn't anything like Jean Claude Van Damme expected either. In the video below, you'll discover why the original costume was scrapped, and why The Muscles from Brussels decided not to play the now-iconic monster. I bet he's kicking himself now! (And since it's JCVD, he can actually do that.)
After getting beat down in one Oscar tourney after another (perhaps because he's too cool), Leonardo seems to be betting it all on "The Revenant," the new Alejandro González Iñárritu film based on Michael Punke's novel. As the Vanity Fair piece notes, this director's films have vaulted stars like Naomi Watts and Javier Bardem to the nomination list, and hopefully the sixth time's the charm.
The Broadway revival "Of Mice and Men" has been getting mixed-but-by-no-means-stinkaroo reviews (here's a favorable one in Variety). Star James Franco allowed himself to be wounded deeply enough by The New York Times' opinions that he cussed out reviewer Ben Brantley on Instagram. The comment has since been deleted, but just like Steinbeck's 1937 tale of friendship and humanity, the internet is forever.
To help you celebrate Easter this weekend, the AV Club has rounded up seventeen of the most terrifying bunnies in pop culture, from literary diehards like Bunnicula to angsty indie creatures like Frank from "Donnie Darko." I'm a "Night of the Lepus" fan from way back, so it's a sure bet that on Sunday morning I'll be eating Russell Stover marshmallow-filled eggs and watching gigantic mutated rabbits getting electrocuted on the train tracks. Joyous tidings!
The early creature design for 1987's "Predator" was nothing like you'd expect </h1>
</apex:page>
-
- srilakshmi1.387861669756762E12
- April 25, 2014
- Like
- 0
- Continue reading or reply
click on a button visual force page will be download as a excel file
<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
-
- srilakshmi1.387861669756762E12
- April 17, 2014
- Like
- 0
- Continue reading or reply
how to hide "new" button on account by using home page components.
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
-
- srilakshmi1.387861669756762E12
- April 14, 2014
- Like
- 0
- Continue reading or reply
how to get current location of user in sales force
-
- srilakshmi1.387861669756762E12
- April 14, 2014
- Like
- 0
- Continue reading or reply
how to get email values one by one from Map<Id, Lead> m = new Map<ID, Lead>([select id, email from Lead]); this ?
-
- srilakshmi1.387861669756762E12
- March 14, 2014
- Like
- 0
- Continue reading or reply
previous lead record will update when currently inserted record throughs an error how?
-
- srilakshmi1.387861669756762E12
- March 14, 2014
- Like
- 0
- Continue reading or reply
what happen when we write "AND(NOT(ISNEW()),ISCHANGED(INDUSRTY)" in account validation rules?
-
- srilakshmi1.387861669756762E12
- February 26, 2014
- Like
- 0
- Continue reading or reply
is it possible to inactivate status of a trigger from trigger code itself?
-
- srilakshmi1.387861669756762E12
- February 19, 2014
- Like
- 0
- Continue reading or reply
is there any file format that takes every thing(like image,text files..) and display as it is.
-
- srilakshmi1.387861669756762E12
- February 14, 2014
- Like
- 0
- Continue reading or reply
Trigger to Update account field when opportunity is inserted?
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;
}
}
}
}
- srilakshmi1.387861669756762E12
- July 30, 2014
- Like
- 0
- Continue reading or reply
how to use .jar file in sales force?
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
- srilakshmi1.387861669756762E12
- May 20, 2014
- Like
- 0
- Continue reading or reply
Using Component in Javascript/Jquery
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
- Ganesh Babu
- May 16, 2014
- Like
- 0
- Continue reading or reply
click on a button visual force page will be download as a excel file
<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
- srilakshmi1.387861669756762E12
- April 17, 2014
- Like
- 0
- Continue reading or reply
how to hide "new" button on account by using home page components.
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
- srilakshmi1.387861669756762E12
- April 14, 2014
- Like
- 0
- Continue reading or reply
how to get current location of user in sales force
- srilakshmi1.387861669756762E12
- April 14, 2014
- Like
- 0
- Continue reading or reply
Display a Multipick list as checkbox in vf page
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..........
- Manjunath BN
- June 27, 2013
- Like
- 0
- Continue reading or reply
String to Sobject
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.....
- Aman
- June 23, 2011
- Like
- 0
- Continue reading or reply
How to display the related contacts of account in the same visual force page
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
- yamini
- March 29, 2011
- Like
- 0
- Continue reading or reply