• Tillu
  • NEWBIE
  • 100 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 10
    Likes Received
  • 10
    Likes Given
  • 113
    Questions
  • 44
    Replies
From opportunity , while creating Task...if the Task is associated with opportunity via 'Related To'  field   Then  Opportunity fields need to populate some values and update the Opportunity record. I have tried but the Opportunity record was not updated.

Please check where i have missed ?

trigger TaskonOpp on Task (before insert,before update) {

set<Id> Tid = new set<id>();

for(Task t:trigger.new){
Tid.add(t.whatid);
}

List<Opportunity> ollist = [select id,name from opportunity where id in:Tid];

for(Task T : Trigger.new){
for(Opportunity O:ollist){

if(T.whatId==O.id&&T.RecordType.name=='Annuity Log a Call'&&T.Activity_Type__c == 'Voicemail'){
O.StageName = '3-Rep follow up - VM';
O.CloseDate = System.ToDay()+30;
}
if(T.whatId==O.id&&T.RecordType.name=='Annuity Log a Call'&&T.Activity_Type__c == 'Client Meeting - IW'){
O.StageName = '4-Client Meetings';
O.CloseDate = System.ToDay()+7;
}
if(T.whatId==O.id&&T.RecordType.name=='Annuity Log a Call'&&T.Activity_Type__c == 'Business drop'){
O.StageName = '5-Paperwork/Ticketing incoming';
O.CloseDate = System.ToDay()+7;
}
update ollist;
}
}
 
  • November 12, 2014
  • Like
  • 0
For  an user  getting   'You  can not modify  events on this calander'  error. while assigning to other contact.  Why ? how to over come hav no idea. any help?
  • November 12, 2014
  • Like
  • 0
HI , I am facing a problem in writing  contains operator for Multi select Picklist. Any help to find sollution pleas?
  • November 10, 2014
  • Like
  • 0
I want to display all opportunities  records in  new window on button click on contact page. it is like all related to contact opportunities should need to be visible. Can any one help pls
  • October 30, 2014
  • Like
  • 0
On Opportunity   record ..i want to create a butoon  when we click that button the opportunity field ''stage"  value should need to be change to  ''6 – Closed Lost'. After it should open another pop up and need to display a Text in a Text field. i was strucked on stage field it self ? any help please.....


{!requireScript("/soap/ajax/26.0/connection.js")}
var Opportunity = new sforce.SObject("Opportunity");
Opportunity.StageName = '6 – Closed Lost';
sforce.connection.update([Opportunity]);
window.location.reload();
  • October 27, 2014
  • Like
  • 0
I have 2 objects LA_Summery , LA_Detail. while creating LA_Detail record it will need to check with LA_Summery records wheather SE2_Id,Appointment sate is equal or not. If eqaul then we have to update LA_Summery record. If not need to create a new LA_Summery record. I have writtened a trigger but getting exception.


trigger LAdetail on L_A_Detail__c (before insert,before update) {

set<string> Tset = new set<string>();

Map<string,string> LDetailMap1 = new Map<string,string>();
Map<string,string> LSumeryMap2 = new Map<string,string>();

for(L_A_Detail__c La : Trigger.new){
Tset.add(La.SE2_ID__c);
LDetailMap1.put(La.SE2_ID__c+La.Appointment_State__c,La.SE2_ID__c+La.Appointment_State__c);
}

List<L_A_Summary__c> LAlist = [select id,SE2_ID__c,Appointment_State__c from L_A_Summary__c  where SE2_ID__c in:Tset];

for(L_A_Summary__c Al : LAlist){
LSumeryMap2.put(Al.SE2_ID__c+Al.Appointment_State__c,Al.SE2_ID__c+Al.Appointment_State__c);
}

for(L_A_Detail__c D : Trigger.new){
for(L_A_Summary__c S : LAlist){
string s1 = LDetailMap1.get(D.SE2_ID__c+D.Appointment_State__c);
string s2 = LSumeryMap2.get(S.SE2_ID__c+S.Appointment_State__c);

if(s1==s2){
if(D.Appointment_State__c == 'NC'){
S.Variable__c = true;
S.Life__c = true;
S.DI__c = true;
S.Annuity__c = true;
}
if(D.Appointment_State__c == 'NJ'){
S.Variable__c = true;
}
if(D.Appointment_State__c == 'TX'){
S.Variable__c = true;
S.Life__c = true;
S.DI__c = true;
S.Annuity__c = true;
}
if(D.Appointment_State__c == 'VA'){
S.Variable__c = true;
S.Life__c = true;
S.DI__c = true;
S.Annuity__c = true;
}
update LAlist;
}
if(s1!=s2){
L_A_Summary__c Lanew = new L_A_Summary__c();
Lanew.Name = 'SampleTest';
Lanew.License_Number__c = '1234589';
Lanew.Life__c = true;
Lanew.Property__c = true;

if(Lanew.name != Null){
insert Lanew;
}
}
}
}
}
  • October 24, 2014
  • Like
  • 0
I want to put condition to calculatre amount in Last 12 months. How to  write this  condition in formulae.
  • September 26, 2014
  • Like
  • 0
I want to put condition to calculatre amount in Last 12 months. How to  write this  condition in formulae.
  • September 26, 2014
  • Like
  • 0
I would like to write a formuale that will give the summerized amount where policy Type__c = va and Posted date__c is 'Last 12 months '.

The summerized amount is  from other object Transaction. we have policy, Transaction and need to display  summerized transaction amount on Policy. Policy is master and transaction is child.
  • September 26, 2014
  • Like
  • 0
I have contact , policy,Transaction objects are there. I want to display  summerized amount of Transaction   on  contact field. Can anyone improve below code.

trigger ConPoliTrigger on Contact (before insert,after update) {

Set<id>  Cset = new set<id>();
List<Contact> Clist = new List<Contact>();

for(Contact c:Trigger.new){
Cset.add(c.id);
}


List<Policy__c> pi = [select id,name,Contact__c from Policy__c where Contact__c in:Cset];
List<Transaction__c> Tr = [select id,name,Policy__c from Transaction__c where policy__c in:Pi AND Posted_Date__c > NEXT_N_DAYS:365 ];

for(Contact ca:Trigger.new){
for(Policy__c po:pi){
for(Transaction__c Ta:Tr){

if(Transaction__c Tran : Trigger.new){
kkkif(po.Type__c == 'VA'){
ca.X12_Months__c = po.Amount__c;

}
}
}
}
CList.add(ca);
}
//update Clist;
}
  • September 26, 2014
  • Like
  • 0
For a Case record, if a specified profile user edits the record and save. The user name should populate on  Case field. But whenm i add the condition it was empty. Where it is wrong ?

trigger UpdateCase on Case(before insert,before update) {

set<id> cset = new set<id>();
//Id profileUser = UserInfo.getProfileId();
//profile p = [select id,name from profile where name = 'Operations'];
for(case c:Trigger.new){
cset.add(c.id);
}

List<Case> CaseList = [select id,Assigned_To__c from case where id in:cset];

List<User> UserList = [select id,profile.id,Lastname,name from User];

for(Case Cs:Trigger.new){
for(User u :UserList ){
if(U.Profile.id == '0098467tXEr6767'){
Cs.Assigned_To__c = U.id;
Cs.UserName__c = U.id;
System.Debug('User>>>>'+U.id);
System.Debug('NameUser>>>>'+Cs.UserName__c);
}
}
}
}
  • September 22, 2014
  • Like
  • 0
why  lookup  field is  not  commonly  available for  joineed reports ?  user lookup  unable  to  drag  and drop on  2  reports
  • September 18, 2014
  • Like
  • 0
Hi,

I have a small problem while executing the If , else statements....

i am working with Contact,Territory objects...if  contacts  zip code  matches with the condition Then  correct territory record  would need to be displayed on Contact.

Here is Condition...If  contact's Account name  is equals  to  Territory field  Protect name  Then the Territory record should be pulled on to contact. Otherwise  other territory record need to be pulled on contact.

For below   if/else  at a time only one condition executed....when i remove else statement it ables to  pull the  matched one...

when i add the else  it always  executes else statement...even when it  satisfies if statement....





try
          {  
                  if(tListForecare.size() > 0)
                  {
                   for(Territory__c t: tListForecare) //null create a map of State to territory. all go in this comparison
                   {
                        if(!ziplocked)
                        {
                            if(t.zip_start__c != null && t.zip_end__c != null && c.mailingPostalCode != null&&t.Protected_Accounts__c !=null)
                            {
                                if(t.Protected_Accounts__c.equals(aIBDMap.get(c.accountId).name)&&c.mailingPostalCode.substring(0,5) >= t.zip_start__c &&
                            c.mailingPostalCode.substring(0,5) <= t.zip_end__c)
                                {
                                    c.Forecare_Territory__c = t.Id;
                                    ziplocked = true;
                                }                          
                        else if(c.mailingState == t.state__c &&
                            (t.zip_start__c == null || t.zip_start__c == null) &&
                            t.Id!= null  )
                            {
                                c.Forecare_Territory__c = t.Id;
                            }
                      }       
   }
}
  • September 18, 2014
  • Like
  • 0
I have Market , Business  custom objects. Market is Master  object and Business is child object. So Market has any no of Business records in its related list.

Now i want to update a Market  object field , if  Market has  No Business Records. It is Text field. Can any one correct the below field ? I am getting error on sowl statements.

trigger MarketChange on Market__c (before insert,before update) {

set<id> Pset = new set<id>();

for(Market__c py : Trigger.new){
Pset.add(py.id);
}
List<Market__c> Ltf = [select id,(select id,Market__c  from Business__r ) from Market__c];  // Error Here

if(Ltf.size() > 0){
for(Market__c px : Trigger.new){
px.ResultField__c = 'No Business data';
}
}
}

Error : Compile Error: Didn't understand relationship 'Business__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 8 column 17
  • September 09, 2014
  • Like
  • 0
Hii  I am getting System.Limit Exception. Please any one help me out....


public static Transaction__c GenTransactionAnnuity(Integer unique, String policyFieldVal, String CUSIP)
    {

      User annuityUser =                 TestFactory.CreateUser(10+unique, 'Annuity External Wholesaler', 'Mouse');
      User forecareUser =                 TestFactory.CreateUser(11+unique, 'Annuity External Wholesaler', 'Dragon');
      insert annuityUser;
      insert forecareUser;

      Territory__c Annuitory =        TestFactory.CreateTerritory(10+unique, annuityUser.Id, 'Annuity', '♣WA0', '98000', '99000', 'WA', 'Independent');
      Territory__c Forecaritory =     TestFactory.CreateTerritory(11+unique, forecareUser.Id, 'Forecare', '♣WA1', '', '', 'WA', 'Independent');
     
     
      insert Annuitory;    ///// Getting exception Too many soql querries...
    
     
      insert Forecaritory;
     

      Account IndependentAccount = TestFactory.CreateAccount(10+unique, 'rigid', 'Active', 'Independent');
      insert IndependentAccount;

      Contact A = GenContactAnnuity(0+unique, false, 'Independent');
        A.Annuity_Territory__c = Annuitory.Id;
        A.Exclude_from_Territory__c = true; //so the trigger

      Contact F = GenContactForecare(2+unique, false, 'Independent');
        F.Forecare_Territory__c = Forecaritory.Id;
        F.Exclude_from_Territory__c = true; //so the trigger   
        List<Contact> contacts = new List<Contact>();
        contacts.add(A);
        contacts.add(F);
        insert contacts;

      Map<Id, Contact> contactMap = new Map<Id, Contact>([SELECT Annuity_Territory__c, Forecare_Territory__c FROM Contact WHERE Id =: A.Id OR Id =: F.Id]);
        A = contactMap.get(A.Id);
        F = contactMap.get(F.Id);     

      contacts = new List<Contact>([SELECT Annuity_Territory__c, Forecare_Territory__c FROM Contact WHERE Id =: A.Id]); ///// Getting exception Too many soql querries...

      Policy__c annuityPolicy = TestFactory.CreatePolicy(10+unique, A.id, CUSIP);
     
     
      insert annuityPolicy;
  • September 04, 2014
  • Like
  • 0
is it  possible to disable certain users from commenting to chatter posts. I have tried a trigger but how to include profile id  for this ?

I have tried but i don't think it gonna work..the user able to post on chatter..i want to restrict from profile.

trigger FeedCommentBefore on FeedComment(Before Insert) {
Id profileUser = UserInfo.getProfileId();

profile AnnuityProfile = [select id from profile where name = 'Annuity External Wholesaler'];
    for(FeedComment fc : trigger.new)
        if(fc.CommentType== 'ContentComment' && ProfileUser == AnnuityProfile.Id)
            fc.addError('you dont have permissions to Comment');
}
  • September 03, 2014
  • Like
  • 0
An Account has  few checkbox fields. When these fields checked Then the contact record Text box field should update with some values. Is this possible with Formulae or else trigger.

Ex: Account fields     AiroSteel , BeuroCost , DuerTest , AspiriCraft are check box fields..

Contact has a Checkbox field. AVailable Prod  should be updates based on Checkbox to true.


IF Acct_’AiroSteel’ = TRUE, {AS}
IF Acct_’BeuroCost’ = TRUE, {BC}
IF Acct_’DuerTest’ = TRUE, {DT}
IF Acct_’AspiriCraft’ = TRUE, {AC}
  • August 11, 2014
  • Like
  • 0
I have 2 objects policy and  Interview. On Interview Record, i have policy as a lookup.

If interview fields contact name , Insured name  matches with any policy record's contact name , Annuity name  Then i have to pull the Policy record on to the Interview. I have written below code but failed. please any one update this ?


trigger Interview_PolicyUpdate on Interviews__c(before insert,before update) {

set<id> cset = new set<id>();

Map<Id,List<Policy__c>> policyMap = new Map<Id,List<Policy__c>>();
List<policy__c> poList = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from Policy__c where Contact__c in:cset ];

Map<Id,string> Intmap = new Map<id,string>();

for(Policy__c poli : PoList ){
if(policyMap.get(poli.Contact__c) !=null){
policyMap.put(poli.Contact__c,new list<policy__c>());
Intmap.put(poli.Id,poli.Annuitiant_Name__c);
}
}
for(Interviews__c Intrvews : Trigger.new){
for(Policy__c polic : PoList ){
if(policyMap.ContainsKey(Intrvews.Contact__c)&&policyMap.ContainsKey(Intrvews.Insured_Name__c)){ // Comparing  both policy,Interview matches

Intrvews.Policy1__c = Polic.Id;
}
}
}
}
  • July 27, 2014
  • Like
  • 0
I have 2 objects   Policy , Interview. On interview record policy lookup is there.  If interview fields Contact name  matches with policy field contact name and Interview field Insured name matches with any policy record's Annuity name Then it should pull the policy on to the Interview record on  policy look up field.

I have writtened below code. But it was not works properly. There is no immediate update for the Policy look up field. Can any one correct below code ?


trigger Interview_PolicyUpdate on Interviews__c

(before insert,before update) {

set<id> cset = new set<id>();
set<string> Aset = new set<string>();

for(Interviews__c Intr : Trigger.new){

If(Intr.Contact__c != Null){
cset.add(Intr.Contact__c);
}

}
List<policy__c> po = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from
Policy__c where Contact__c in:cset ];
try{
for(Interviews__c Inr : Trigger.new){
for(Policy__c p : po){
//If(Inr.Annuitant_Name__c !=null){
if(p.Contact__c == Inr.Contact__c && Inr.Insured_Name__c == p.Annuitiant_Name__c){
Inr.Policy1__c = p.Id;
}
}
}
}
catch(Exception e){
System.Debug(e.getMessage());
}
}
  • July 25, 2014
  • Like
  • 0
I have 2 objects policy and  Interview. On Interview Record, i have policy as a lookup.

If interview fields contact name , Insured name  matches with any policy record's contact name , Annuity name  Then i have to pull the Policy record on to the Interview. I have written below code but failed. please any one update this ?


trigger Interview_PolicyUpdate on Interviews__c(before insert,before update) {

set<id> cset = new set<id>();

Map<Id,List<Policy__c>> policyMap = new Map<Id,List<Policy__c>>();
List<policy__c> poList = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from Policy__c where Contact__c in:cset ];

Map<Id,string> Intmap = new Map<id,string>();

for(Policy__c poli : PoList ){
if(policyMap.get(poli.Contact__c) !=null){
policyMap.put(poli.Contact__c,new list<policy__c>());
Intmap.put(poli.Id,poli.Annuitiant_Name__c);
}
}
for(Interviews__c Intrvews : Trigger.new){
for(Policy__c polic : PoList ){
if(policyMap.ContainsKey(Intrvews.Contact__c)&&policyMap.ContainsKey(Intrvews.Insured_Name__c)){ // Comparing  both policy,Interview matches

Intrvews.Policy1__c = Polic.Id;
}
}
}
}
  • July 22, 2014
  • Like
  • 0
I have created Detailed abutton and placed on the Task Record. The button should function like when we click the button a New opportunity page will opened and carry the data from Task to the Opportunity and need to display on Opportunity fields.  Below javascript created. But  it giving error like that    'Task.WhoId' is not exist like that. Please anyone correct bthis.




{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}

    var OpportunityCreate= new sforce.SObject("Opportunity");

OpportunityCreate.Contact_Name__c = '{!Task.WhoId}';


    var result = sforce.connection.create([OpportunityToCreate]);

    if (result[0].success == 'true')
    
   var newURL = '/' + result[0].id + '/e';
   window.top.location = newURL;
}
  • June 26, 2014
  • Like
  • 1
I want calculate % of sales  for Sum of Amount/GrandTotal.. But in formulae field i am unable to use Grand Total. I knew we can use ParentVal(row, coloumn) but it displays at Grand total Row/coloumn. I want on all summery levels.


% of sales showing wrong.

User-added image
  • March 28, 2014
  • Like
  • 1
I want to give full access to compaign for a specific user. His Profile setting for compaign is only. 'Read' . I had crfeated a permission set and given Xreate,Edit Delete,Modify all  permissions. And i have assigned that user in to that permission set. But still it was not impacted. He is only Read access to records. The sharing setting for compaign is Public Read only.  Did i missed anything ?
  • March 25, 2014
  • Like
  • 1
For specific users  not able to access the old records belongs to case. I have verified  in profile level. he has Read,Edit,Create permissions. Still he has no access to  already created records. I saw that no users under this Role has not access to case records.

I think we need to create a sharing rule.  Users in this role do not own any contacts.
  • March 25, 2014
  • Like
  • 1
In formulae field i want to use  completed calender weeks , But i dont know how to give in the formulae. Any one help please.

From  this year staring  1/1/2014   to  Last Friday 3/7/2014. we have  10 calender weeks.

So in my formulae i need to give something like   Amount / Calender weeks  .

But how to give this 10 (Calender weeks)  here. Because for every record it varies.
  • March 11, 2014
  • Like
  • 1
I have created a field "userassigne" to account object .this field is lookup to User. And i have writtened a workflow that if "Userassigne" equals Null. then email alert to send an email to selected user from lookup.

I have added all users in the Selected List in workflow email alert.

while creating new record i have given 1 user in Userassigne field. But the email sent to all users   why.
So i have removed all users and given only one user in selected list in workflow. Again when i am trying to send a mail even what ever the user that i have selected the email sent to only one person which i have added in selected list in workflow.

How to solve. what ever the user that i have selected in lookup, the email should be sent to that user only.?
  • February 25, 2014
  • Like
  • 1

I am working in enterprise edition. As winter 14 changed... i am unable to see the option reset security token . In devoloper edition it is visible. So from Enterprise edition i am unable to find.

  • December 16, 2013
  • Like
  • 2
I have a custo object  Business. and i have a field  'Amount' on this object. On Account i want to display average of this  'Amount' field. I have created a Roll Up on Account but it was giving only Count , SUM,MIN,MAX. Then How to calculate Average? for this
  • November 22, 2013
  • Like
  • 1

Policy is Detailed object and contact is Master , they are in master detail relationship. we can  create policy records from  contact  related list.

On policy  i have a field   "issue Date". and on contact i have checkbox field  "Current Year".

 suppose if i have created 2 policy records from contact related list, this means  contact  has 2 associated policy records. if  that 2 policy records "issue Date" is "equal or less than 60 Days" then the contact checkbox(Current year)  field should be True (Checked).

Need Trigger For this?

  • October 25, 2013
  • Like
  • 1
From opportunity , while creating Task...if the Task is associated with opportunity via 'Related To'  field   Then  Opportunity fields need to populate some values and update the Opportunity record. I have tried but the Opportunity record was not updated.

Please check where i have missed ?

trigger TaskonOpp on Task (before insert,before update) {

set<Id> Tid = new set<id>();

for(Task t:trigger.new){
Tid.add(t.whatid);
}

List<Opportunity> ollist = [select id,name from opportunity where id in:Tid];

for(Task T : Trigger.new){
for(Opportunity O:ollist){

if(T.whatId==O.id&&T.RecordType.name=='Annuity Log a Call'&&T.Activity_Type__c == 'Voicemail'){
O.StageName = '3-Rep follow up - VM';
O.CloseDate = System.ToDay()+30;
}
if(T.whatId==O.id&&T.RecordType.name=='Annuity Log a Call'&&T.Activity_Type__c == 'Client Meeting - IW'){
O.StageName = '4-Client Meetings';
O.CloseDate = System.ToDay()+7;
}
if(T.whatId==O.id&&T.RecordType.name=='Annuity Log a Call'&&T.Activity_Type__c == 'Business drop'){
O.StageName = '5-Paperwork/Ticketing incoming';
O.CloseDate = System.ToDay()+7;
}
update ollist;
}
}
 
  • November 12, 2014
  • Like
  • 0
I want to display all opportunities  records in  new window on button click on contact page. it is like all related to contact opportunities should need to be visible. Can any one help pls
  • October 30, 2014
  • Like
  • 0
I have 2 objects LA_Summery , LA_Detail. while creating LA_Detail record it will need to check with LA_Summery records wheather SE2_Id,Appointment sate is equal or not. If eqaul then we have to update LA_Summery record. If not need to create a new LA_Summery record. I have writtened a trigger but getting exception.


trigger LAdetail on L_A_Detail__c (before insert,before update) {

set<string> Tset = new set<string>();

Map<string,string> LDetailMap1 = new Map<string,string>();
Map<string,string> LSumeryMap2 = new Map<string,string>();

for(L_A_Detail__c La : Trigger.new){
Tset.add(La.SE2_ID__c);
LDetailMap1.put(La.SE2_ID__c+La.Appointment_State__c,La.SE2_ID__c+La.Appointment_State__c);
}

List<L_A_Summary__c> LAlist = [select id,SE2_ID__c,Appointment_State__c from L_A_Summary__c  where SE2_ID__c in:Tset];

for(L_A_Summary__c Al : LAlist){
LSumeryMap2.put(Al.SE2_ID__c+Al.Appointment_State__c,Al.SE2_ID__c+Al.Appointment_State__c);
}

for(L_A_Detail__c D : Trigger.new){
for(L_A_Summary__c S : LAlist){
string s1 = LDetailMap1.get(D.SE2_ID__c+D.Appointment_State__c);
string s2 = LSumeryMap2.get(S.SE2_ID__c+S.Appointment_State__c);

if(s1==s2){
if(D.Appointment_State__c == 'NC'){
S.Variable__c = true;
S.Life__c = true;
S.DI__c = true;
S.Annuity__c = true;
}
if(D.Appointment_State__c == 'NJ'){
S.Variable__c = true;
}
if(D.Appointment_State__c == 'TX'){
S.Variable__c = true;
S.Life__c = true;
S.DI__c = true;
S.Annuity__c = true;
}
if(D.Appointment_State__c == 'VA'){
S.Variable__c = true;
S.Life__c = true;
S.DI__c = true;
S.Annuity__c = true;
}
update LAlist;
}
if(s1!=s2){
L_A_Summary__c Lanew = new L_A_Summary__c();
Lanew.Name = 'SampleTest';
Lanew.License_Number__c = '1234589';
Lanew.Life__c = true;
Lanew.Property__c = true;

if(Lanew.name != Null){
insert Lanew;
}
}
}
}
}
  • October 24, 2014
  • Like
  • 0
I have Market , Business  custom objects. Market is Master  object and Business is child object. So Market has any no of Business records in its related list.

Now i want to update a Market  object field , if  Market has  No Business Records. It is Text field. Can any one correct the below field ? I am getting error on sowl statements.

trigger MarketChange on Market__c (before insert,before update) {

set<id> Pset = new set<id>();

for(Market__c py : Trigger.new){
Pset.add(py.id);
}
List<Market__c> Ltf = [select id,(select id,Market__c  from Business__r ) from Market__c];  // Error Here

if(Ltf.size() > 0){
for(Market__c px : Trigger.new){
px.ResultField__c = 'No Business data';
}
}
}

Error : Compile Error: Didn't understand relationship 'Business__c' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 8 column 17
  • September 09, 2014
  • Like
  • 0
An Account has  few checkbox fields. When these fields checked Then the contact record Text box field should update with some values. Is this possible with Formulae or else trigger.

Ex: Account fields     AiroSteel , BeuroCost , DuerTest , AspiriCraft are check box fields..

Contact has a Checkbox field. AVailable Prod  should be updates based on Checkbox to true.


IF Acct_’AiroSteel’ = TRUE, {AS}
IF Acct_’BeuroCost’ = TRUE, {BC}
IF Acct_’DuerTest’ = TRUE, {DT}
IF Acct_’AspiriCraft’ = TRUE, {AC}
  • August 11, 2014
  • Like
  • 0
I have 2 objects policy and  Interview. On Interview Record, i have policy as a lookup.

If interview fields contact name , Insured name  matches with any policy record's contact name , Annuity name  Then i have to pull the Policy record on to the Interview. I have written below code but failed. please any one update this ?


trigger Interview_PolicyUpdate on Interviews__c(before insert,before update) {

set<id> cset = new set<id>();

Map<Id,List<Policy__c>> policyMap = new Map<Id,List<Policy__c>>();
List<policy__c> poList = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from Policy__c where Contact__c in:cset ];

Map<Id,string> Intmap = new Map<id,string>();

for(Policy__c poli : PoList ){
if(policyMap.get(poli.Contact__c) !=null){
policyMap.put(poli.Contact__c,new list<policy__c>());
Intmap.put(poli.Id,poli.Annuitiant_Name__c);
}
}
for(Interviews__c Intrvews : Trigger.new){
for(Policy__c polic : PoList ){
if(policyMap.ContainsKey(Intrvews.Contact__c)&&policyMap.ContainsKey(Intrvews.Insured_Name__c)){ // Comparing  both policy,Interview matches

Intrvews.Policy1__c = Polic.Id;
}
}
}
}
  • July 22, 2014
  • Like
  • 0
HI Folks,

I have 2 objects   Policy , Interview. On interview record policy lookup is there.  If interview fields Contact name , Insured name matches with any  policy record's Contactname,Annuity name Then it should pull the policy on to the Interview record policy look up field.

I have writtened below code. But it was not works properly. There is no immediate update for the Policy look up field. Can any one correct below code ?


trigger Interview_PolicyUpdate on Interviews__c

(before insert,before update) {

set<id> cset = new set<id>();
set<string> Aset = new set<string>();

for(Interviews__c Intr : Trigger.new){

If(Intr.Contact__c != Null){
cset.add(Intr.Contact__c);
}

}
List<policy__c> po = [select Id,name,Contact__c,Type__c,Annuitiant_Name__c from
Policy__c where Contact__c in:cset ];
try{
for(Interviews__c Inr : Trigger.new){
for(Policy__c p : po){
//If(Inr.Annuitant_Name__c !=null){
if(p.Contact__c == Inr.Contact__c && Inr.Insured_Name__c == p.Annuitiant_Name__c){
Inr.Policy1__c = p.Id;
}
}
}
}
catch(Exception e){
System.Debug(e.getMessage());
}
}
  • July 21, 2014
  • Like
  • 0
I have writtened a test class for below class. But this is controller class. I am unable to cover code for  page reference method and all. please any one improve this code ?


public with sharing class SFDC_Class_Controller_Final{
  
    public list<SFDC_Enrollment__c> Enrolment { get; set; }
    public SFDC_Class__c cls{set;get;}

    public SFDC_Class_Controller_Final(ApexPages.StandardController controller) {
  
        this.cls = (SFDC_Class__c)controller.getRecord();
        if(this.cls.Id != null){
        Enrolment = [select Contact__c, Final_Exam__c, Final_Grade_Value__c, Class__r.Name,Class__r.id from SFDC_Enrollment__c where Class__r.id=:cls.id AND RecordType.Name like '%HLS HFS %'];
     
        }
    }
    public pagereference save(){
        try{
      
        upsert cls;
        upsert Enrolment;
       Pagereference p = new PageReference('/'+cls.Id);
         p.setRedirect(true);
          return p;  
     
        }
        catch(Exception e){}
        return null;
    }
     public pagereference clear(){

     for(SFDC_Enrollment__c enro:Enrolment ){
     enro.Final_Exam__c=null;
     enro.Final_Grade_Value__c=null;
     }
  
     return null;

    } 
}


Here is Test class  :

@isTest
public with sharing class SFDC_Class_Controller_Final_Test{

    static testMethod void  validatestudentdetails(){
    

    SFDC_Enrollment__c sccf=new SFDC_Enrollment__c();
    //sccf.Contact__c='kirthika@gmail.com';
        sccf.Final_Exam__c=100;
        sccf.Final_Grade_Value__c=100;
   insert sccf;
        SFDC_Class__c scc=new SFDC_Class__c();
        scc.name='testclass';
   insert scc;  

}

}
  • July 10, 2014
  • Like
  • 0
I want calculate % of sales  for Sum of Amount/GrandTotal.. But in formulae field i am unable to use Grand Total. I knew we can use ParentVal(row, coloumn) but it displays at Grand total Row/coloumn. I want on all summery levels.


% of sales showing wrong.

User-added image
  • March 28, 2014
  • Like
  • 1
I want to write validation Rule for case comments. SO if any users wants to delete/update  the case comments then it wont allowed deletion or modification. But i saw that there is no field like comments in the case fields. Then how could i acheive this ?


User-added image
  • March 25, 2014
  • Like
  • 0
I have created a field "userassigne" to account object .this field is lookup to User. And i have writtened a workflow that if "Userassigne" equals Null. then email alert to send an email to selected user from lookup.

I have added all users in the Selected List in workflow email alert.

while creating new record i have given 1 user in Userassigne field. But the email sent to all users   why.
So i have removed all users and given only one user in selected list in workflow. Again when i am trying to send a mail even what ever the user that i have selected the email sent to only one person which i have added in selected list in workflow.

How to solve. what ever the user that i have selected in lookup, the email should be sent to that user only.?
  • February 25, 2014
  • Like
  • 1
I have  "price" field in one object,  and i have  "Amount" field in other object. So now i want  to compare  "price"  value within 10% of the associated object record’s  "Amount" . If the match occues then i need to update a field. But how to compare these fields for 10 % .
  • February 21, 2014
  • Like
  • 0

User-added image


From the above  the page is "Policy" . we can see policy  (Amount). And from policy related lists we can see "Transaction" object  "Amount"  field and  from "Transfer "  object we see  "Expected Premium"  (All are Marked).

Now,

for a transfer record to update, the match must occur within the same policy record.  Attached is a screenshot of a policy .This would be considered a match. the associated transfer record has an Expected Premium value within 10% of the associated transaction record’s Amount.  A match can only occur if both records (transfer and transaction) are associated to the same Policy ID. If the match occures then I have a checkbox on Transfer record. so it enables to True.

Can we acheive this through formulae or Trigger? If any one pls provide trigger for this scinario.
  • February 18, 2014
  • Like
  • 0

I have recently created a new public calendar labeled 'Forecare Interviews'.  The business is requesting that an email alert be sent to the email address

anvesh@gmail.com 15 minutes before the start time of any meeting. i need  help to create a workflow rule  and added a time dependent action to the rule (it appears we can only do whole hours). 

 

i  am  working  in  enterprise  edition  but  in  that  "Email Alert "  action  is  not  visibled  y?

I have recently created a new public calendar labeled 'Forecare Interviews'.  The business is requesting that an email alert be sent to the email address

anvesh@mail.com 15 minutes before the start time of any meeting. i need  help to create a workflow rule  and added a time dependent action to the rule (it appears we can only do whole hours). 

 

i  am  working  in  enterprise  edition  but  in  that  "Email Alert "  action  is  not  visibled  y?

As   Admin  Created  a  Record  in  Activity  object.........and  OWD  settings  are  "Controlled By  Parent " for  Activity  obj.

but  the  problem is  user  is  unable  to  access  this  Record. this  user  assignrd to some Role. what could be the reason. records created by admin  should  visible  to  evry user by default. but  user  unable  to access.

 

the  error  is.

 

In Sufficient  Prevelegious

 

What  could be the reason?  can i  share the record?

In Contact  i  have  a  Field   "MTD Sales".  this  Field  is  Rollup SUM  to  another Object  "Policy" Field . and  this  Policy Field Name is  "Sales".

 

and  this  Policy  Field  "Sales" is  Rollup SUM  to  other object Transaction, the  Field  name  is  "Amount."

 

is this  clear? if any querries ask me about this question for better understand.

 

So  simple  in  Transaction  Field we have "Amount"  field, so  we enter  amount. 

in  policy  object  "Sales" Field  has Rollup  on  this  "Amount".

In  Contact  "MTD  Sales"  Calculated  from  "Sales" which is  Rollup  on  Policy obj .

 

                                         Roll UP  (SUM)                                          Roll UP  (SUM)

MTD  Sales (Contact) -------------------------------------->     Sales (Policy)   -------------------------------------->Amount (Transaction)

 

 

So  in  Policy  Object  "Sales"  field 

 

 

                                      (Field)                  (Opertaot)            (Value)

Field  Criteria  is          CurrentMonth              Equals                  Y

 

 

This  "Y"  value  is  coming  in  flat  files we  upload  data  through dataloader  and  "Currnt month"  field  is  Transactions Obj Field. 

 

so  now the  problem  is the  current  month  calculation  is  Wrong caluculating.  it  was  Calculating  Last  30 Calender  days  instead of  calculating Current  month.  please  give  me  sollution  can i  write  any  formulae  or  workflow  for  this ?  if  so  provide  sollution  also.

 

i  want  to  give  some  more information. i  have  a  filed   "Month  Calculation" on  Transaction obj.  This  is  Formulae  field. and  the  formulae   written in  this  is..

 

IF (
(Month(TODAY()) = (Month (Transaction_Date__c))), "Y", "N")

 

By using  this  Field can  we  write  any  workflow  to  Calculate  Current  month  Calculations? how  to  trigger  this.

when field met certain value  then that record  should need to  delete...is this  possible  through  trigger....

 

My requirement is  i have field  Activity_Type__c ='  ' (is  no value)..then this record should be deleted. so  i written this trigger but  not working.

 

trigger DeleteTask on Task (after insert) {

task t= new task();
if(t.Activity_Direction__c==''){
task t1=t.clone();
t.remove(t1);
}

}

 

Please anyone have sollution?

When i  deployed my trigger from sanbox to production , the deployement is failed , i  found that  at least 1% code coverage should need to have in order to deploy...but this trigger have 0% code coverage?  what should i do? hw to increses code coverage for this trigger?

 

 

 

trigger UpdateEventRating on Event (before insert, before update) {
for(Event E : Trigger.new){
if(E.Rating__c=='-Excellent Meeting (committed to business within 3 weeks)'){
E.Rating_Value__c=5;
}
else
if(E.Rating__c=='-Good Meeting (Resulted in client meeting agreed to/set or booked a seminar)'){
E.Rating_Value__c=4;
}
else
if(E.Rating__c=='-Productive Meeting (Client specific illustration requested or next meeting scheduled)'){
E.Rating_Value__c=3;
}
else
if(E.Rating__c=='-Average Meeting (Agreed to continued discussions, no client specific activity)'){
E.Rating_Value__c=2;
}
else
if(E.Rating__c=='-Poor Meeting (No potential for future business, no further activity needed)'){
E.Rating_Value__c=1;
}
}
}

Let me clear  first.....

 

Some    records(belongs to case object)  are  created.....and that  cases  assigned to  users....

 

after i  have requirement  to  create a field  with name 'owner'(cusom field)  having look up (in look up  displayes  users).....

 

 

now  the  requirement is  when  users  opened  the  records  the  owner  field should need to be  updated with the   current  user name......how  should i  write  field update  through workflow....

 

i  have this  field on  Record type  'Production Support '....so  condition  i had  taken  is

 

Rule Criteria -  "Created"

 

Case- Case  Record Type       equals     Production_Support (this is record typr name)

 

workflow action i had  taken  feild update  on   Owner (Custom field)....next    i  am getting  Owner  field  with look up here..what  should i  give  here   for  getting  current  user name (who  openes the record  his name).

 

through  workflow is this possible or any other solution for this.

i  created a   custom field  'Owner' in sandbox  and  it  appears when the record is opened....now  need to move to production.  and  the thing is  how  to  add a workflow rule so the field updates with the current user when the record is opened. 

 

 

Any Suggestions Pls,

 

i  have a feild  named  owner  of type textbox and have lookup relation....

 

now the thing is   when i  clicked  new  button (to create)  all fields are displayed including owner field but this feild default should displayed  as  current user name in the text box...how we can do this  any one pls?.

I  am  importing data  to  'POLOCY'  object.......i have a  feild  'Living Benifit Rider' of  type  "Multi  picklist".....now  when  i  import the  data The 'Living Benefit Rider'  field is populated with a string of text from the  file import.  I would like a validation rule so that only the values that exist in the field MultiPick list are displayed in the record.  but the problem  is  some records are rejected  even the value  exist in the picklist. when  i  remove this validation rule  then it was inserted. now the problem is   it  gives the error when the picklist value inserted. but requirement is it ll gives error other than picklist value

 

 

This  is  Validation  Rule  and  Error Message : Living Benefit Rider must be a pick list value.

 

OR
(
INCLUDES(Living_Benefit_Rider__c , 'Guaranteed Interest Rate') ,
INCLUDES(Living_Benefit_Rider__c , 'No GLWB') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Annual Single') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Annual Joint') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Daily Single') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Daily Joint') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Annual Single Legacy Lock') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Annual Joint Legacy Lock') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Daily Single Legacy Lock') ,
INCLUDES(Living_Benefit_Rider__c , 'GLWB Daily Joint Legacy Lock') ,
INCLUDES(Living_Benefit_Rider__c , 'TEST')

)

 

Error Message : Living Benefit Rider must be a pick list value.