-
ChatterFeed
-
0Best Answers
-
2Likes Received
-
0Likes Given
-
27Questions
-
67Replies
I have 2 profiles profile 1 and profile 2, Here profile 1 data users don't want to see profile 2 users data
Hi,
I have 2 profiles profile 1 and profile 2, Here profile 1 data users don't want to see profile 2 users data,at the same time e profile 2 users data don't want to view by profile 1 data users.how can we achieve it.
I really appreciate quick responses.
Thanks
I have 2 profiles profile 1 and profile 2, Here profile 1 data users don't want to see profile 2 users data,at the same time e profile 2 users data don't want to view by profile 1 data users.how can we achieve it.
I really appreciate quick responses.
Thanks
- sonam guptha
- November 30, 2017
- Like
- 0
- Continue reading or reply
trigger on contact
hi
I have 2 fields on contact which is inc__c and dec__c
so when i set the value on inc__c = 20, Dec__c = 0 should set to null
if i change the value on Dec__c = 0 to Dec__c = 1
the inc__c should decrement to inc__c = 19.
if add one more Dec__c =2
i.e. inc__c = 18
how can i acheive this,if its trigger please give me the sample code,i really appreciate your responses
Thanks
I have 2 fields on contact which is inc__c and dec__c
so when i set the value on inc__c = 20, Dec__c = 0 should set to null
if i change the value on Dec__c = 0 to Dec__c = 1
the inc__c should decrement to inc__c = 19.
if add one more Dec__c =2
i.e. inc__c = 18
how can i acheive this,if its trigger please give me the sample code,i really appreciate your responses
Thanks
- sonam guptha
- September 06, 2017
- Like
- 0
- Continue reading or reply
Help me out with to create Visualforce page
HI,
select as_of_date__c, salesforceid__c, name__c, sum(arr_usd__c) from history__c where status__c <> 'Cancelled' group by as_of_date__c, salesforceid__c, name__c order by as_of_date__c, salesforceid__c descThe above query iam trying to query from custom table and wants to display on vf page but iam getting an error on view state that governor limit exceeded so can any one please provide me the visualforce page with the controller
- sonam guptha
- August 30, 2017
- Like
- 0
- Continue reading or reply
In a Single Visualforce with different tabs and different values
HI,
-Iam struggling with problem please provide me some solution.
-how can we create three tabs in a single visual force page and that 3 tabs need to show different values on the page on a Account Search?
for example:
iam searching Account ‘Wipro’ on that particular visual force page,as result i have to show the different values on the three tabs?
-Iam struggling with problem please provide me some solution.
-how can we create three tabs in a single visual force page and that 3 tabs need to show different values on the page on a Account Search?
for example:
iam searching Account ‘Wipro’ on that particular visual force page,as result i have to show the different values on the three tabs?
search ————> Account ‘Wipro’ Result should be like :— tab 1 tab 2 tab3 | | | | | | | | | Avg sum startdate of of of Account Account AccountThanks In Advance!
- sonam guptha
- August 28, 2017
- Like
- 0
- Continue reading or reply
Salesforce Connect: OData 2.0 or Salesforce Connect: OData 4.0.
hello,
iam not able to see the option "Salesforce Connect: OData 2.0 or Salesforce Connect: OData 4.0." on salesforce external data sources.
i need to enable any thing on my profile or any thing iam missing can anyone please help me out to fix it
Thanks
iam not able to see the option "Salesforce Connect: OData 2.0 or Salesforce Connect: OData 4.0." on salesforce external data sources.
i need to enable any thing on my profile or any thing iam missing can anyone please help me out to fix it
Thanks
- sonam guptha
- August 21, 2017
- Like
- 1
- Continue reading or reply
get redshift data and display it on visual force page
Hello,
Here iam trying to display the redshift data on visualforce page.
i hope we have to write an api which will get the data from redshift and then we need to display it using visual force page.
But here i have to show different data in three different tabs.
And other thing i have to show the data on daily basis
for example someone wants look into some ‘X’ Account info on the visual force page then they need to search by using with name of X.
How can i search that account on visualforce page and is it possible to get that data?
Then it has to give the result of that particular account in detail and on daily basis
can any one help me out to resolve it.
But here iam getting below error :--
Here iam trying to display the redshift data on visualforce page.
i hope we have to write an api which will get the data from redshift and then we need to display it using visual force page.
But here i have to show different data in three different tabs.
And other thing i have to show the data on daily basis
for example someone wants look into some ‘X’ Account info on the visual force page then they need to search by using with name of X.
How can i search that account on visualforce page and is it possible to get that data?
Then it has to give the result of that particular account in detail and on daily basis
can any one help me out to resolve it.
public class consolewrap { public String Name{get;set;} public String AccNumber{get;set;} public String Source{get;set;} public String Site{get;set;} public String Email{get;set;} }
<apex:page controller="calloutcontroller" title="JSON table" > <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!performcallout}" var="wrap" width="100%"> <apex:column headerValue="Name" value="{!wrap.Name}"/> <apex:column headerValue="AccountNumber" value="{!wrap.AccNumber}"/> <apex:column headerValue="Source" value="{!wrap.Source}"/> <apex:column headerValue="Website" value="{!wrap.Site}"/> <apex:column headerValue="Email" value="{!wrap.Email}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
public class Calloutcontroller { public List<consolewrap> ConsoleWrapperList{get;set;} public List<consolewrap> getperformcallout(){ ConsoleWrapperList = new List<consolewrap>(); HttpRequest req = new HttpRequest(); HttpResponse res = new HttpResponse(); Http http = new Http(); req.setEndpoint('https://redshiftURL'); req.setMethod('GET'); res = http.send(req); if(res.getstatusCode() == 200 && res.getbody() != null){ ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class); } return consolewrapperlist; } }settedup remote site settings even
But here iam getting below error :--
System.CalloutException: Unable to tunnel through proxy. Proxy returns "HTTP/1.0 403 Forbidden" Class.Calloutcontroller.getperformcallout: line 10, column 1
- sonam guptha
- August 21, 2017
- Like
- 0
- Continue reading or reply
Grabing the accounts even more than 60 days even
HI,
iam trying to send an email notification based on custom column,so here i have to send an email when my EndDate__c is less than 60 days,the below code is working fine but its grabing few accounts even more than 60 days,can i get any help to fix it?
i think iam not calculating right value here?
iam trying to send an email notification based on custom column,so here i have to send an email when my EndDate__c is less than 60 days,the below code is working fine but its grabing few accounts even more than 60 days,can i get any help to fix it?
i think iam not calculating right value here?
if(m.EndDate__c.daysBetween(D) < 60 )
global class expireNotify implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext bc) { //Date d = Date.today()+90; String soql = 'SELECT EndDate__c, Name FROM Account WHERE EndDate__c !=NULL'; return Database.getQueryLocator(soql); } global void execute(Database.BatchableContext bc, List<account> recs) { List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>(); Date D =Date.today(); Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); List<String> toAddresses = new List<String>(); String messageBody; list<string> accstring =new list<string>(); integer i=0; for(account m : recs) { if(m.EndDate__c.daysBetween(D) < 60 ) { i+=1; messageBody = i+'-->'+ m.Name ; accstring.add(messageBody ); } } toAddresses.add('spnvarun0121@gmail.com'); mail.setToAddresses(toAddresses); mail.setSubject('Welcome to Sweet 16 Siebel Batch'); string allstring = string.join(accstring,'<br/>'); mail.setHtmlBody('<html><body>Hi Sir Hope you are well <br>'+'<br> List of accounts <br>'+allstring + ',<br>Your accounts Expires today. <br>Kindly contact your administrator.<br><br><b>Regards,</b><br>Magulan D<br/></body></html>'); mailList.add(mail); Messaging.sendEmail(mailList); } global void finish(Database.BatchableContext bc) { } }
- sonam guptha
- June 30, 2017
- Like
- 0
- Continue reading or reply
trigger to make value as zero if no values present no child records present on it
HI
Below is my trigger iam counting child records based and prinitng on parent object,but one error iam seeing if there are no child objects with that picklist value still its showing count as 1,i wanted to show the value as zero,if no records present on it,please help me out
Below is my trigger iam counting child records based and prinitng on parent object,but one error iam seeing if there are no child objects with that picklist value still its showing count as 1,i wanted to show the value as zero,if no records present on it,please help me out
trigger requirementsTrigger on Requirements__c (after insert, after update) { List <Id> progIds = new List<Id> (); List <Programs__c> programs = new List<Programs__c>(); List <AggregateResult> requirements = new List<AggregateResult>(); for(Requirements__c req:trigger.new){ progIds.add(req.Programs__c); } programs = [Select Id, Count__c From Programs__c Where Id In :progIds]; requirements = [Select Programs__c, Count(Id) From Requirements__c Where Programs__c IN: progIds AND Waived__c = 'Yes' AND Status__c IN ('Active') Group By Programs__c]; for(AggregateResult ar: requirements){ for(Programs__c p:programs){ if(ar.get('Programs__c') == p.Id){ p.Count__c = Decimal.ValueOf(String.ValueOf(ar.get('expr0'))); } } } update(programs); }
- sonam guptha
- June 28, 2017
- Like
- 0
- Continue reading or reply
sending an email based on account.enddate__c on every month
HI,
Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out
Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out
- sonam guptha
- June 22, 2017
- Like
- 0
- Continue reading or reply
apex trigger show total sum as wrong value on updating the previous records
Hi,
Here iam adding sum of revenue__c to account column acc.Finance__c.
for Example :--
if opportunity.member__c.Revenue__c is 10
& opportunity.member__c.Revenue__c is 20
total = 30
this value iam printing on acc.Finance__c column,but now the problem is its keep on adding the values when we are changing the value on same record.
for example :--
for the same above record the value is 30.
if i change the same opportunity.member__c.Revenue__c from 10 to 20
& opportunity.member__c.Revenue__c is 20
the value should be 40 but here it counting has 50.
its counting the old value even.
can any one help me to resolve it??
Here iam adding sum of revenue__c to account column acc.Finance__c.
for Example :--
if opportunity.member__c.Revenue__c is 10
& opportunity.member__c.Revenue__c is 20
total = 30
this value iam printing on acc.Finance__c column,but now the problem is its keep on adding the values when we are changing the value on same record.
for example :--
for the same above record the value is 30.
if i change the same opportunity.member__c.Revenue__c from 10 to 20
& opportunity.member__c.Revenue__c is 20
the value should be 40 but here it counting has 50.
its counting the old value even.
can any one help me to resolve it??
trigger updateAccount on member__c (After Insert,After update,After Delete,) { List<Account> UpdateList = new List<Account>(); Id recTypeFinance = [select Id,name from RecordType where name='Finance' and SObjectType='member__c' limit 1].Id; string ids; if(Trigger.isInsert || Trigger.isUpdate) { for(Asset__c asst : Trigger.new) { if(asst.Opportunity__c != null) ids= asst.id; } For(member__c ast:[select Id,Opportunity__c,Revenue__c,RecordTypeId from member__c where ID=:ids]){ if(ast.RecordTypeId == recTypeFinance){ for(opportunity opp : [Select Id,AccountId from Opportunity where Id =: ast.Opportunity__c]){ for(Account acc : [Select Id,Finance__c from Account where Id =: opp.AccountId]){ if(acc.Finance__c == null){ acc.Finance__c= ast.Revenue__c; }else{ acc.Finance__c += ast.Revenue__c; } UpdateList.add(acc); } } } } update UpdateList; }
- sonam guptha
- June 21, 2017
- Like
- 0
- Continue reading or reply
update is not working on existing records for sumof values
Hi,
Here iam adding sum of revenue__c to account column acc.Finance__c.
for Example :--
if opportunity.member__c.Revenue__c is 10
& opportunity.member__c.Revenue__c is 20
total = 30
this value iam printing on acc.Finance__c column,but now the problem is its keep on adding the values when we are changing the value on same record.
for example :--
for the same above record the value is 30.
if i change the same opportunity.member__c.Revenue__c is 10 to 20
& opportunity.member__c.Revenue__c is 20
the value should be 40 but here it counting has 50.
its counting the old value even.
can any one help me to resolve it??
Here iam adding sum of revenue__c to account column acc.Finance__c.
for Example :--
if opportunity.member__c.Revenue__c is 10
& opportunity.member__c.Revenue__c is 20
total = 30
this value iam printing on acc.Finance__c column,but now the problem is its keep on adding the values when we are changing the value on same record.
for example :--
for the same above record the value is 30.
if i change the same opportunity.member__c.Revenue__c is 10 to 20
& opportunity.member__c.Revenue__c is 20
the value should be 40 but here it counting has 50.
its counting the old value even.
can any one help me to resolve it??
trigger updateAccount on member__c (After Insert,After update,After Delete,) { List<Account> UpdateList = new List<Account>(); Id recTypeFinance = [select Id,name from RecordType where name='Finance' and SObjectType='member__c' limit 1].Id; string ids; if(Trigger.isInsert || Trigger.isUpdate) { for(Asset__c asst : Trigger.new) { if(asst.Opportunity__c != null) ids= asst.id; } For(member__c ast:[select Id,Opportunity__c,Revenue__c,RecordTypeId from member__c where ID=:ids]){ if(ast.RecordTypeId == recTypeFinance){ for(opportunity opp : [Select Id,AccountId from Opportunity where Id =: ast.Opportunity__c]){ for(Account acc : [Select Id,Finance__c from Account where Id =: opp.AccountId]){ if(acc.Finance__c == null){ acc.Finance__c= ast.Revenue__c; }else{ acc.Finance__c += ast.Revenue__c; } UpdateList.add(acc); } } } } update UpdateList; }
- sonam guptha
- June 20, 2017
- Like
- 0
- Continue reading or reply
after delete is not working on rollup summary of particular recordtype
Hello,
i have a custom object member,here i need to sum-up each record type value total_column__c and print on account,everything is working as expected,but after delete is not working.
for example:—
i have account.ITWING__c = 1000
and member. total_column__c = 500
if i delete member record,account.ITWING__c = 500 should be 500.
but this is not working as expected,please help me out to resolve it.
i have a custom object member,here i need to sum-up each record type value total_column__c and print on account,everything is working as expected,but after delete is not working.
for example:—
i have account.ITWING__c = 1000
and member. total_column__c = 500
if i delete member record,account.ITWING__c = 500 should be 500.
but this is not working as expected,please help me out to resolve it.
trigger updatetotalAccount on Member__c (After Insert,After update,After Delete) { List<Account> recTypeITdeleteList = new List<Account>(); List<Account> recTypeITUpdateList = new List<Account>(); List<Account> recTypeFinanceList = new List<Account>(); Id recTypeIT = [SELECT Id FROM RecordType WHERE name='ITWING' AND SObjectType='member__c' LIMIT 1].Id; Id recTypeFinance = [SELECT Id FROM RecordType WHERE name='Finance' AND SObjectType=‘member__c' LIMIT 1].Id; string ids; if(Trigger.isInsert || Trigger.isUpdate) { for(Member__c objMember : Trigger.new){ if(objMember.lookupAccount__c != null) ids= objMember.id; } } if(Trigger.isDelete){ for(Member__c objMember : Trigger.old){ if(objMember.lookupAccount__c != null) ids= objMember.id; If(mem.RecordTypeId=recTypeIT) { for(opportunity opp : [Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]){ for(Account acc:[Select Id,ITWING__c,Finance__c from Account where Id=:opp.AccountId]){ for(Account aaa:acc){ if(acc.ITWING__c == null){ aaa.ITWING__c=null; }else aaa.ITWING__c -= mem.total_column__c; } } recTypeITdeleteList.add(aaa); }}}} for(Member__c mem :[select Id,lookupAccount__c,total_column__c,RecordTypeId from Member__c where ID=:ids]){ If(mem.RecordTypeId=recTypeIT) { for(opportunity opp : [Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]){ for(Account acc:[Select Id,ITWING__c,Finance__c from Account where Id=:opp.AccountId]){ for(Account aaa:acc){ if(acc.ITWING__c == null){ aaa.ITWING__c=mem.total_column__c; }else aaa.ITWING__c+=mem.total_column__c; } } recTypeITUpdateList.add(aaa); }} elseIf(mem.RecordTypeId=recTypeFinance) { for(opportunity opp : [Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]){ for(Account acc:[Select Id,ITWING__c,Finance__c from Account where Id=:opp.AccountId]){ for(Account bbb:acc1){ bbb.ITWING__c=mem.total_column__c; if(acc.ITWING__c == null){ bbb.ITWING__c=mem.total_column__c; }else bbb.ITWING__c+=mem.total_column__c; } } recTypeITUpdateList.add(bbb); }} update recTypeITUpdateList; update recTypeFinanceList; update recTypeITdeleteList; }}}
- sonam guptha
- May 30, 2017
- Like
- 0
- Continue reading or reply
Rollup Trigger on account based on recordtype
Hello,
Please provide me some sample code for below rollup.
Rollup summary on a specific record types,i have a custom object ,which had 3 record types on it,there is common_column on all record types called sum__c,And custom object is lookup to Account,on account i have 3 custom columns,here i have to count each record type sum_c values and print it on Account.
Thanks!
Please provide me some sample code for below rollup.
Rollup summary on a specific record types,i have a custom object ,which had 3 record types on it,there is common_column on all record types called sum__c,And custom object is lookup to Account,on account i have 3 custom columns,here i have to count each record type sum_c values and print it on Account.
Thanks!
- sonam guptha
- May 26, 2017
- Like
- 0
- Continue reading or reply
rollup trigger to update on account based on different recordtypes
Can any one help me to reslove it.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
And i have to rollup at the same time as below :—
for example if my member__c have the different values with same recordtype,i have to count those values and place it on account.ITWING__c.thats nothing but rollup or summingup,that should work on all our events like insert,delete,update : -- please check below for more info.
member__c.ITWING(recordtype).total_column__c = 100
member__c.ITWING(recordtype).total_column__c = 200
Result woud be like:--
on account we have to sum up those values with same record type.
aaa.ITWING__c = 300
if we delete 100
aaa.ITWING__c = 200
Here is my current code please have a look :--
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
And i have to rollup at the same time as below :—
for example if my member__c have the different values with same recordtype,i have to count those values and place it on account.ITWING__c.thats nothing but rollup or summingup,that should work on all our events like insert,delete,update : -- please check below for more info.
member__c.ITWING(recordtype).total_column__c = 100
member__c.ITWING(recordtype).total_column__c = 200
Result woud be like:--
on account we have to sum up those values with same record type.
aaa.ITWING__c = 300
if we delete 100
aaa.ITWING__c = 200
Here is my current code please have a look :--
trigger updatetotalAccount on Member__c (After Insert,After update,After Delete) { Id recTypeIT = [SELECT Id FROM RecordType WHERE name='ITWING' AND SObjectType='member__c' LIMIT 1].Id; Id recTypeFinance = [SELECT Id FROM RecordType WHERE name='Finance' AND SObjectType=‘member__c' LIMIT 1].Id; string ids; if(Trigger.isInsert || Trigger.isUpdate) { for(Member__c objMember : Trigger.new){ if(objMember.lookupAccount__c != null) ids= objMember.id; } } if(Trigger.isDelete){ for(Member__c objMember : Trigger.old){ if(objMember.lookupAccount__c != null) ids= objMember.id; }} AggregateResult mem=[select Id,lookupAccount__c,RecordTypeId,SUM(total_column__c)sumtc from Member__c where ID=:ids GROUP BY RecordTypeId]; If(mem.RecordTypeId=recTypeIT) { opportunity opp=[Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]; Account acc=[Select Id,ITWING__c,Finance__c from Account where Id=:opp.AccountId]; for(Account aaa:acc){ aaa.ITWING__c=(Decimal)mem.get('sumtc'); update aaa; } } elseIf(mem.RecordTypeId=recTypeFinance) { opportunity opp1=[Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]; Account acc1=[Select Id,ITWING__c,Finance__c from Account where Id=:opp1.AccountId]; for(Account bbb:acc1){ bbb.ITWING__c=(Decimal)mem.get('sumtc'); update bbb; } }
- sonam guptha
- May 26, 2017
- Like
- 0
- Continue reading or reply
Struked with rollup summary trigger
Can any one help me to reslove it.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
And i have to rollup at the same time as below :—
for example if my member__c have the different values with same recordtype,i have to count those values and place it on account.ITWING__c.thats nothing but rollup or summingup,that should work on all our events like insert,delete,update : -- please check below for more info.
member__c.ITWING(recordtype).total_column__c = 100
member__c.ITWING(recordtype).total_column__c = 200
Result woud be like:--
on account we have to sum up those values with same record type.
aaa.ITWING__c = 300
if we delete 100
aaa.ITWING__c = 200
Here is my current code please have a look :--
And after delete event is not working at the same time.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
And i have to rollup at the same time as below :—
for example if my member__c have the different values with same recordtype,i have to count those values and place it on account.ITWING__c.thats nothing but rollup or summingup,that should work on all our events like insert,delete,update : -- please check below for more info.
member__c.ITWING(recordtype).total_column__c = 100
member__c.ITWING(recordtype).total_column__c = 200
Result woud be like:--
on account we have to sum up those values with same record type.
aaa.ITWING__c = 300
if we delete 100
aaa.ITWING__c = 200
Here is my current code please have a look :--
And after delete event is not working at the same time.
trigger updatetotalAccount on Member__c (After Insert,After update,After Delete) { Id recTypeIT = [SELECT Id FROM RecordType WHERE name='ITWING' AND SObjectType='member__c' LIMIT 1].Id; Id recTypeFinance = [SELECT Id FROM RecordType WHERE name='Finance' AND SObjectType=‘member__c' LIMIT 1].Id; string ids; if(Trigger.isInsert || Trigger.isUpdate) { for(Member__c objMember : Trigger.new){ if(objMember.lookupAccount__c != null) ids= objMember.id; } } if(Trigger.isDelete){ for(Member__c objMember : Trigger.old){ if(objMember.lookupAccount__c != null) ids= objMember.id; }} AggregateResult mem=[select Id,lookupAccount__c,RecordTypeId,SUM(total_column__c)sumtc from Member__c where ID=:ids GROUP BY RecordTypeId]; If(mem.RecordTypeId=recTypeIT) { opportunity opp=[Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]; Account acc=[Select Id,ITWING__c,Finance__c from Account where Id=:opp.AccountId]; for(Account aaa:acc){ aaa.ITWING__c=(Decimal)mem.get('sumtc'); update aaa; } } elseIf(mem.RecordTypeId=recTypeFinance) { opportunity opp1=[Select Id,AccountId from Opportunity where Id=:mem.lookupOpportunity__c ]; Account acc1=[Select Id,ITWING__c,Finance__c from Account where Id=:opp1.AccountId]; for(Account bbb:acc1){ bbb.ITWING__c=(Decimal)mem.get('sumtc'); update bbb; } }
- sonam guptha
- May 25, 2017
- Like
- 0
- Continue reading or reply
help on a trigger to update standard object with the record type related values
Hello everyone,
Can any one help me to reslove it.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
Here is the code for trigger :--
Can any one help me to reslove it.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
Here is the code for trigger :--
trigger updatetotalAccount on Member__c (After Insert,After update,After Delete) { Id recTypeIT = [SELECT Id FROM RecordType WHERE name='ITWING' AND SObjectType='member__c' LIMIT 1].Id; Id recTypeFinance = [SELECT Id FROM RecordType WHERE name='Finance' AND SObjectType=‘member__c' LIMIT 1].Id; Map<Id, Account> mapAccount = new Map<Id, Account>(); for(Member__c objMember : Trigger.new){ if(objMember.lookupAccount__c != null){ Account objAccount; if(mapAccount.containsKey( objMember.lookupOpportunity__r.AccountId)){ objAccount = mapAccount.get(objMember.lookupOpportunity__r.AccountId); } else{ objAccount = new Account(); } objAccount.Id = objMember.lookupOpportunity__r.AccountId; if(objMember.RecordTypeId == recTypeIT){ objAccount.ITWING__c = objMember.total_column__c; } else if(objMember.RecordTypeId == recTypeFinance){ objAccount.Finance__c = objMember.total_column__c; } mapAccount.put( objMember.lookupOpportunity__r.AccountId, objAccount); } } if(mapAccount.size()>0){ update mapAccount.values(); } }
- sonam guptha
- May 23, 2017
- Like
- 0
- Continue reading or reply
Need a trigger to get a field value from a custom table based on a record type and print it on standard table account.
Hello everyone,
Can any one help me to reslove it.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
it looks something like below :—
Thaks in Advance!
Can any one help me to reslove it.
I have a custom table(Member__c) it has 2 record types(rc1,rc2) and on member__c i have a column total_column__c,And on account, we created 2 custom columns(rc1,rc2),so in this columns now i wanted to print out that particular values,here member__c is lookup to account and opportunity,and member__c is a junction object,i can only select opportunity on member__c not account as per my flow.account is tagged on opportunity,so now i have to consider account from opportunity.and print those values on opportunities related account.
it looks something like below :—
member__c.rc1.total_column__c(print this value on account custom column) = account.rc1(Custom field).(i.e; member__c.releted_account) member__c.rc2. total_column__c( print this value on account custom column) = account.rc2(Custom field).(i.e; member__c.releted_account)Here is my apex trigger but am printing the same values on all 2 columns :—
trigger updatetotalAccount on Member__c (After Insert,After update,After Delete) { IdITWINGId = [select Id,name from RecordType where name='ITWING' and SObjectType=‘member__c' limit 1].Id; Id FinanceId = [select Id,name from RecordType where name=‘Finance' and SObjectType=‘member__c' limit 1].Id; List<Account> lst = new List<Account>(); List<RecordType> ITWingId = [select Id,name from RecordType where name=‘ITWING' and SObjectType=‘Member__c' limit 1]; Map<ID,RecordType> FinanceId = new Map<ID,RecordType>([select Id,name from RecordType where name=‘Finance' and SObjectType=‘Member__c' limit 1]); id ITWINGRT = Schema.SObjectType.member__c.getRecordTypeInfosByName().get('ITWING').getRecordTypeId(); id FinanceRT = Schema.SObjectTypemember__c.getRecordTypeInfosByName().get('Finance').getRecordTypeId(); Map<id,member__c> ITWINGList =new Map<id,Asset__c>([SELECT RecordTypeid, total_column__c FROM member__c WHERE RecordTypeId =: ITWINGId]); for(Member__c asst : Trigger.new){ for(Account temp : [select id,name from Account where id =: asst.lookupAccount__c]) { if(asst.RecordTypeId == ITWINGRT) { temp.ITWING__c = ITWINGList.get(total_column__c); } if(asst.RecordTypeId == FinanceRT){ temp.Finance__c = asst.total_column__c; } lst.add(temp); } } if(lst.size()>0){ update lst; } }
Thaks in Advance!
- sonam guptha
- May 23, 2017
- Like
- 0
- Continue reading or reply
how to deactivate a managed package apex trigger?
Hello,
Can anyone suggest me how to inactive a trigger which is in managed package,i cannot look at the code and dont have any access to change the code,i googled it,after some reserach got to know i can do it with custom settings,but no blog has complete information,can any one help me out to resolve this issue,without using any code.
Thanks!
Can anyone suggest me how to inactive a trigger which is in managed package,i cannot look at the code and dont have any access to change the code,i googled it,after some reserach got to know i can do it with custom settings,but no blog has complete information,can any one help me out to resolve this issue,without using any code.
Thanks!
- sonam guptha
- May 15, 2017
- Like
- 0
- Continue reading or reply
slack integration with salesforce
Hi,
Am trying to get the salesforce accounts information on slack,if any user is checking with the salesforce account name we need to send that infromation to slack, by searching salesforce accounts,can we write any api in apex code,if we can do it with apex please provide some sample code snippets.Here i few questions:-
-only on a command prompt we can provide the data on slack?
-If we have any other way please recommend me,here for sure we need to use some other middleware scripts to achive it?
- we cannot do it with apex?
Am trying to get the salesforce accounts information on slack,if any user is checking with the salesforce account name we need to send that infromation to slack, by searching salesforce accounts,can we write any api in apex code,if we can do it with apex please provide some sample code snippets.Here i few questions:-
-only on a command prompt we can provide the data on slack?
-If we have any other way please recommend me,here for sure we need to use some other middleware scripts to achive it?
- we cannot do it with apex?
- sonam guptha
- April 06, 2017
- Like
- 1
- Continue reading or reply
Code coverage issue for triggerhandler
Hi,
Can anyone help me to fix this issue,here am attaching the test class which am able to cover 50%,just help me out to cover the rest.
Thanks
Can anyone help me to fix this issue,here am attaching the test class which am able to cover 50%,just help me out to cover the rest.
//trigger code trigger UpdateTotalAmount on Opportunity (after insert,after update) { clsUpdateAccount.updateAccount(Trigger.new); } //APEX Class public class clsUpdateAccount{ public static void updateAccount(List<Opportunity> lstOpportunities) { List<Id> lstAccountIDs = new List<Id>(); for(Opportunity opp: lstOpportunities) { lstAccountIDs.add(opp.AccountId); } Map<Id, Account> mapAccount = new Map<Id, Account>([SELECT Id, Name, TotalAmount__c FROM Account WHERE Id =:lstAccountIDs]); List<Account> lstAccounts = new List<Account>(); for(AggregateResult result: [SELECT SUM(Amount) Amt, AccountId FROM Opportunity GROUP BY AccountId, StageName Having AccountId IN :mapAccount.keyset() AND StageName = 'Closed Won' ]) { Account acc = mapAccount.get((Id)result.get('AccountID')); acc.TotalAmount__c = (Decimal)result.get('Amt'); lstAccounts.add(acc); } if(lstAccounts.size() > 0){ update lstAccounts; } } }
static testmethod void oppamount(){ Test.starttest(); Account acc = new Account(Name = 'testacc' ,TotalAmount__c = 1000); insert acc; Opportunity opp = new Opportunity(RecordTypeId = '012E0000000Dke9', Name = 'name', CloseDate = Date.today(), StageName = 'Prospecting', AccountId = acc.id, Amount = 1000, ForecastCategoryName = 'nextlevel', Opportunity_Source__c='Marketing Campaign (Inbound)'); insert opp; Account acc1 = [SELECT id, Sum_of_Opportunity_Amount__c FROM Account WHERE Id = :acc.Id]; // Verification System.assertEquals(acc1.TotalAmount__c, opp.amount); Test.stopTest(); }But here am getting below error:--
System.AssertException: Assertion Failed: Expected: null, Actual: 1000
Thanks
- sonam guptha
- April 05, 2017
- Like
- 0
- Continue reading or reply
Salesforce Connect: OData 2.0 or Salesforce Connect: OData 4.0.
hello,
iam not able to see the option "Salesforce Connect: OData 2.0 or Salesforce Connect: OData 4.0." on salesforce external data sources.
i need to enable any thing on my profile or any thing iam missing can anyone please help me out to fix it
Thanks
iam not able to see the option "Salesforce Connect: OData 2.0 or Salesforce Connect: OData 4.0." on salesforce external data sources.
i need to enable any thing on my profile or any thing iam missing can anyone please help me out to fix it
Thanks
- sonam guptha
- August 21, 2017
- Like
- 1
- Continue reading or reply
slack integration with salesforce
Hi,
Am trying to get the salesforce accounts information on slack,if any user is checking with the salesforce account name we need to send that infromation to slack, by searching salesforce accounts,can we write any api in apex code,if we can do it with apex please provide some sample code snippets.Here i few questions:-
-only on a command prompt we can provide the data on slack?
-If we have any other way please recommend me,here for sure we need to use some other middleware scripts to achive it?
- we cannot do it with apex?
Am trying to get the salesforce accounts information on slack,if any user is checking with the salesforce account name we need to send that infromation to slack, by searching salesforce accounts,can we write any api in apex code,if we can do it with apex please provide some sample code snippets.Here i few questions:-
-only on a command prompt we can provide the data on slack?
-If we have any other way please recommend me,here for sure we need to use some other middleware scripts to achive it?
- we cannot do it with apex?
- sonam guptha
- April 06, 2017
- Like
- 1
- Continue reading or reply
I have 2 profiles profile 1 and profile 2, Here profile 1 data users don't want to see profile 2 users data
Hi,
I have 2 profiles profile 1 and profile 2, Here profile 1 data users don't want to see profile 2 users data,at the same time e profile 2 users data don't want to view by profile 1 data users.how can we achieve it.
I really appreciate quick responses.
Thanks
I have 2 profiles profile 1 and profile 2, Here profile 1 data users don't want to see profile 2 users data,at the same time e profile 2 users data don't want to view by profile 1 data users.how can we achieve it.
I really appreciate quick responses.
Thanks
- sonam guptha
- November 30, 2017
- Like
- 0
- Continue reading or reply
In a Single Visualforce with different tabs and different values
HI,
-Iam struggling with problem please provide me some solution.
-how can we create three tabs in a single visual force page and that 3 tabs need to show different values on the page on a Account Search?
for example:
iam searching Account ‘Wipro’ on that particular visual force page,as result i have to show the different values on the three tabs?
-Iam struggling with problem please provide me some solution.
-how can we create three tabs in a single visual force page and that 3 tabs need to show different values on the page on a Account Search?
for example:
iam searching Account ‘Wipro’ on that particular visual force page,as result i have to show the different values on the three tabs?
search ————> Account ‘Wipro’ Result should be like :— tab 1 tab 2 tab3 | | | | | | | | | Avg sum startdate of of of Account Account AccountThanks In Advance!
- sonam guptha
- August 28, 2017
- Like
- 0
- Continue reading or reply
Grabing the accounts even more than 60 days even
HI,
iam trying to send an email notification based on custom column,so here i have to send an email when my EndDate__c is less than 60 days,the below code is working fine but its grabing few accounts even more than 60 days,can i get any help to fix it?
i think iam not calculating right value here?
iam trying to send an email notification based on custom column,so here i have to send an email when my EndDate__c is less than 60 days,the below code is working fine but its grabing few accounts even more than 60 days,can i get any help to fix it?
i think iam not calculating right value here?
if(m.EndDate__c.daysBetween(D) < 60 )
global class expireNotify implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext bc) { //Date d = Date.today()+90; String soql = 'SELECT EndDate__c, Name FROM Account WHERE EndDate__c !=NULL'; return Database.getQueryLocator(soql); } global void execute(Database.BatchableContext bc, List<account> recs) { List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>(); Date D =Date.today(); Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); List<String> toAddresses = new List<String>(); String messageBody; list<string> accstring =new list<string>(); integer i=0; for(account m : recs) { if(m.EndDate__c.daysBetween(D) < 60 ) { i+=1; messageBody = i+'-->'+ m.Name ; accstring.add(messageBody ); } } toAddresses.add('spnvarun0121@gmail.com'); mail.setToAddresses(toAddresses); mail.setSubject('Welcome to Sweet 16 Siebel Batch'); string allstring = string.join(accstring,'<br/>'); mail.setHtmlBody('<html><body>Hi Sir Hope you are well <br>'+'<br> List of accounts <br>'+allstring + ',<br>Your accounts Expires today. <br>Kindly contact your administrator.<br><br><b>Regards,</b><br>Magulan D<br/></body></html>'); mailList.add(mail); Messaging.sendEmail(mailList); } global void finish(Database.BatchableContext bc) { } }
- sonam guptha
- June 30, 2017
- Like
- 0
- Continue reading or reply
trigger to make value as zero if no values present no child records present on it
HI
Below is my trigger iam counting child records based and prinitng on parent object,but one error iam seeing if there are no child objects with that picklist value still its showing count as 1,i wanted to show the value as zero,if no records present on it,please help me out
Below is my trigger iam counting child records based and prinitng on parent object,but one error iam seeing if there are no child objects with that picklist value still its showing count as 1,i wanted to show the value as zero,if no records present on it,please help me out
trigger requirementsTrigger on Requirements__c (after insert, after update) { List <Id> progIds = new List<Id> (); List <Programs__c> programs = new List<Programs__c>(); List <AggregateResult> requirements = new List<AggregateResult>(); for(Requirements__c req:trigger.new){ progIds.add(req.Programs__c); } programs = [Select Id, Count__c From Programs__c Where Id In :progIds]; requirements = [Select Programs__c, Count(Id) From Requirements__c Where Programs__c IN: progIds AND Waived__c = 'Yes' AND Status__c IN ('Active') Group By Programs__c]; for(AggregateResult ar: requirements){ for(Programs__c p:programs){ if(ar.get('Programs__c') == p.Id){ p.Count__c = Decimal.ValueOf(String.ValueOf(ar.get('expr0'))); } } } update(programs); }
- sonam guptha
- June 28, 2017
- Like
- 0
- Continue reading or reply
sending an email based on account.enddate__c on every month
HI,
Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out
Iam afraid as a begginer.
on a account table i have custom field termEndDate__c which was a formula field of type date,so when termEndDate__c is set to less than 90 days on a particular account, i have to send an email with the account name,and this has to done on monthly basis as a schedule and we need to include account name in the email,and has to check all the accounts in my salesforce org should send an email which accounts are less than 90 days. is it possible.please help me out
- sonam guptha
- June 22, 2017
- Like
- 0
- Continue reading or reply
apex trigger show total sum as wrong value on updating the previous records
Hi,
Here iam adding sum of revenue__c to account column acc.Finance__c.
for Example :--
if opportunity.member__c.Revenue__c is 10
& opportunity.member__c.Revenue__c is 20
total = 30
this value iam printing on acc.Finance__c column,but now the problem is its keep on adding the values when we are changing the value on same record.
for example :--
for the same above record the value is 30.
if i change the same opportunity.member__c.Revenue__c from 10 to 20
& opportunity.member__c.Revenue__c is 20
the value should be 40 but here it counting has 50.
its counting the old value even.
can any one help me to resolve it??
Here iam adding sum of revenue__c to account column acc.Finance__c.
for Example :--
if opportunity.member__c.Revenue__c is 10
& opportunity.member__c.Revenue__c is 20
total = 30
this value iam printing on acc.Finance__c column,but now the problem is its keep on adding the values when we are changing the value on same record.
for example :--
for the same above record the value is 30.
if i change the same opportunity.member__c.Revenue__c from 10 to 20
& opportunity.member__c.Revenue__c is 20
the value should be 40 but here it counting has 50.
its counting the old value even.
can any one help me to resolve it??
trigger updateAccount on member__c (After Insert,After update,After Delete,) { List<Account> UpdateList = new List<Account>(); Id recTypeFinance = [select Id,name from RecordType where name='Finance' and SObjectType='member__c' limit 1].Id; string ids; if(Trigger.isInsert || Trigger.isUpdate) { for(Asset__c asst : Trigger.new) { if(asst.Opportunity__c != null) ids= asst.id; } For(member__c ast:[select Id,Opportunity__c,Revenue__c,RecordTypeId from member__c where ID=:ids]){ if(ast.RecordTypeId == recTypeFinance){ for(opportunity opp : [Select Id,AccountId from Opportunity where Id =: ast.Opportunity__c]){ for(Account acc : [Select Id,Finance__c from Account where Id =: opp.AccountId]){ if(acc.Finance__c == null){ acc.Finance__c= ast.Revenue__c; }else{ acc.Finance__c += ast.Revenue__c; } UpdateList.add(acc); } } } } update UpdateList; }
- sonam guptha
- June 21, 2017
- Like
- 0
- Continue reading or reply