• himanshu huske 7
  • NEWBIE
  • 85 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 34
    Questions
  • 11
    Replies
In Account object there is a checkbox IsPrimary__c, and in Contact there is PickList Status__c(values: 'IsPrimary', 'IsSecondery').
for an account record if two contact record are created with one as Status__c = IsPrimary and another Status__c = IsSecondery.
1. If in Account IsPrimary__c checkbox is checked then.
Account Discription = Discription in contact having Status__c = IsPrimary. 
2. If in Account IsPrimary__c checkbox is Unchecked then.
Account Discription = Discription in contact having Status__c = IsSecondery.
Please Provide Trigger Using Map
please correct my code below,
  I have one object Customer__c,In this there are one  picklist User_to_b__c.
if valid userName is input in User_to_b__c field. owner field should update with value in User_to_b__c
trigger Cust_User_to_be on Customer__c (before insert, before update) {
     Set<string> strSet = new Set<String>();
      for(Customer__c cs : trigger.new)
      {
              strSet.add(cs.User_to_b__c);
       }
    map<string,id> csMap = new map<string,id>();  
    for(User u : [Select id,Name from user where Name IN :strSet])
    {
            csMap.put(u.Name,u.Id);
     }
    for (Customer__c cs : Trigger.new)
    {
             if (cs.OwnerId <> csMap.get(cs.User_to_b__c) )          
             {
                   cs.OwnerId = csMap.get(cs.User_to_b__c);
              }

    }
}

 
Hi guys help me out with some concept,
I learnt Set, Map and all their releted methods.
but while writing triggers I cannot decide when to use Map and Set,
please tell me how to decide, while writing, now their is need of Map.
I Have customer obj with field IsPrimary(checkbox) and addrText(textarea)
I also have an obj Addresses with field Addr_type(picklist with valuse 'Primery' and 'Secondery') and Addr_Line_1
if IspPrimary is checked, addrText should get populated with Addresses record Addr_Line_1 having  having picklist value as primary 
else adresses record with secondery value of addressLine_1
I want to create Visualforce Page in which their is a timer for Hour,Minute,Seconds which should start when we click on 'START' button and stop When 'STOP' button is clicked
I have customer__c object with FirstName_c, LastName_c, DOB_c fields.
First VF page has  FirstName_c, LastName_c, DOB_c  InputFields and a "save" button which save record in Object
And "List" Button show that record fields with that values of input field in Second VF page.
 
Please explain me soql subQuery.
when and how to use it in Apex Code(triggers) ?
in Map and in List
give me some examples

Hi developers,
Please fix th issue for thisUser-added imagetrigger TotalAmt_Child_paraent on Child__c (after insert,after update, after delete,after undelete) {
    set<id> idSet = new  set<id>();
    List<Child__c> cList = new List<Child__c>();
    List<Parent__c> pList = new List<Parent__c>();
    if(trigger.isinsert ||trigger.isupdate ||trigger.isundelete){
        for(Child__c c : trigger.new){
            if(c.ParentMD__c != null)
                idSet.add(c.ParentMD__c);
        }
    }
    if(trigger.isdelete){
        for(Child__c c : trigger.old){
            if(c.ParentMD__c != null)
                idSet.add(c.ParentMD__c);
        }
    }    
    if(idSet.size()>0){
    decimal amt = 0;
    cList = [Select id, ParentMD__c from Child__c where ParentMD__c in: idSet];
    Map<id,List<Child__c>> prMap = new Map<id,List<Child__c>>();
    for(Child__c c : cList){
        prMap.put(c.ParentMD__c, new List<Child__c>());
        prMap.get(c.ParentMD__c).add(c);
    }
    pList = [Select id,TotalAmt__c from Parent__c where id in: prMap.keySet()];
        for(Parent__c p : pList){
            for(Child__c ch : prMap.get(p.id)){
                if(ch.MyAmt__c != null)
                    amt +=  ch.MyAmt__c; 
            }
            p.TotalAmt__c = amt;
        }
        update pList;
    }
    }
Both Account and Contact has a picklist field Status_c with values Open,Close,InProgress 
account record has 3 child record in contact
if all 3 contact has picklist value = 'close', then account picklist value will get updated to 'close'.
I have customer__c object with FirstName_c, LastName_c, DOB_c fields.
First VF page shows  FirstName_c, LastName_c, DOB_c  in cloumn view.
FirstName_c is in commandLink, if we click on any of  FirstName_c in column, its record should be displayed in 2nd VF page. 
In case object there is one custom text field type_c
case has record with any subject, and if we create another record with same subject, type_c field should be populated as 'duplicate'.
and this newly created case should b displayed in related list of previus case record.
1.customer__c(master obj) and address__c(detail obj).
address__c has has 2 checkbox field Nagpur__c and Pune__c and customer__c has TextField Hometown__c 
if Nagpur__c is checked, Hometown__c = 'nagpur';
if Pune__c is checked, Hometown__c = 'pune';
2. is it true, that master-detail relation trigger like above wont require query ?
 
Hi All,
Can anybody please tell me how to Pass parameter of One Page To Another in Visualforce, like...
Account object has certain input fields in first Vf page, when we input some data and click on button. List of values of these input field is shown in another Vf page.
help me with simple code.
Account object has Acc_Satus__c  Field and Contact Object has Con_Status__c Field.
both Acc_Satus__c, Con_Status__c are picklist field with values: Open, Closed, InProgress.
Account Record Has Three Child Contact Records
1. Whenever Account record field is updated with Acc_Satus__c Piclist field as 'Closed', all Contact Con_Status__c field should be 'Closed'.
2. if Con_Status__c field in all three Contact record is selected as 'Closed' Account picklist Acc_Satus__c Field Should be 'Closed'.
give me a code with Helper class
RollUp Contact to Account.
Account has Total_Amt__c field, Customer has Amount__c(Currency) field. 
Total_Amt__c field should show all sum of all values of Amount__c field of all chield reccord
(please explain critical lines in code)
Hello, I am beginner. Help me with This,
1.When Should we use Map In Trigger.
2.Give me some trigger scenerios for account, contact, lead, opportunity in which Map can be used.
Please Help Me With Code.
I want to create a page in which,
we use <apex:inputField> or <apex:inputText> for FirstName, LastName, DateOfBirth,Gender(PickList).
There will be a button on page, after insert value in each field and clicking on button, next page will get display, wich will show list of output. which we have entered in inputField or input text.
please give me a code using following methods,
PageReference Px = page.PageName;
    Px.getParameters().put();
ApexPages.currentPage().getParameters().get();
 
<apex:page controller="CustomerAmtTransfer">
    <apex:form >
    <apex:outputText>to</apex:outputText>>
    <apex:selectList size="1" value="{!Name1}" > 
        <apex:selectOptions value="{!name1fields}"/>  
    </apex:selectList><br/>
    <apex:outputText>from</apex:outputText>>
    <apex:selectList size="1" value="{!Name2}" > 
        <apex:selectOptions value="{!name2fields}"/>  
    </apex:selectList>
       </apex:form>
</apex:page>


public class CustomerAmtTransfer {

    public String Name1 { get; set; }
        public String Name2 { get; set; }


    public String getName1fields() {
    List<Selectoption> listName1 = new List<selectoption>();
    listName1.add(new selectOption('', '- None -'));
    for(Customer__c cs : [Select First_Name__c, Last_Name__c from Customer__c]){
     listName1.add(new selectoption(cs.id,cs.First_Name__c,cs.Last_Name__c));
     }
        return listName1;
    }
    public String getName2fields() {
    List<Selectoption> listName2 = new List<selectoption>();
    listName1.add(new selectOption('', '- None -'));
    for(Customer__c cs : [Select First_Name__c, Last_Name__c from Customer__c]){
     listName2.add(new selectoption(cs.id,cs.First_Name__c,cs.Last_Name__c));
     }
        return listName2;
    }
}
 
Hello, I am a beginner
Please Help Me With simple VisualForce Code for scenerio.
In An Application There Is a Customer__c Object With Some Customer Records.
suppose customer-1 has 10000/-  balance in his account an he want to transfer 5000/- to customer-2, otp should be sent to customer-1 for confirmation of withdrawal if otp matches. Amount should get sent to customer-2. and customer-1 should have 5000/- in his account.
 
Please Help Me With VisualForce Code:
I have Customer__c object, it has First_Name__c  Last_Name__c field.
Also i have another transaction__c object which is child of Customer__c object having lookup relationship, In transaction__c object i have AmountBalance__c field and AmountTransfer__c field,
My requirement is i want to create custom button on transaction__c, and on clicking this button vf page should be open, on that page i will have lookup field of customer__c to which amount is to be transfered, also there is Submit button, on clicking submit button mail should be sent to Customer__c with otp, There is also a field for otp in transaction__c object if otp matches amount will be deducted from Customer.
Eg: Customer1 has 10000/-  balance if  5000/- are transfered to  customer2, customer1 should have 5000 in balance
In Account object there is a checkbox IsPrimary__c, and in Contact there is PickList Status__c(values: 'IsPrimary', 'IsSecondery').
for an account record if two contact record are created with one as Status__c = IsPrimary and another Status__c = IsSecondery.
1. If in Account IsPrimary__c checkbox is checked then.
Account Discription = Discription in contact having Status__c = IsPrimary. 
2. If in Account IsPrimary__c checkbox is Unchecked then.
Account Discription = Discription in contact having Status__c = IsSecondery.
Please Provide Trigger Using Map
I Have customer obj with field IsPrimary(checkbox) and addrText(textarea)
I also have an obj Addresses with field Addr_type(picklist with valuse 'Primery' and 'Secondery') and Addr_Line_1
if IspPrimary is checked, addrText should get populated with Addresses record Addr_Line_1 having  having picklist value as primary 
else adresses record with secondery value of addressLine_1
I want to create Visualforce Page in which their is a timer for Hour,Minute,Seconds which should start when we click on 'START' button and stop When 'STOP' button is clicked
Account and Contact One Custom fiedl - "Status"
one Account having multiple contact - if all contact Status fiedl is Active then only update "Active" in Account page. Even if 1 contact inactive then Account also inactive - 
I have written trigger. but it working fine only with 1 record. I mean when user insert new contatc at that whatever status I have given based on that it update on contact. but how to check for All contact ? 
I have customer__c object with FirstName_c, LastName_c, DOB_c fields.
First VF page has  FirstName_c, LastName_c, DOB_c  InputFields and a "save" button which save record in Object
And "List" Button show that record fields with that values of input field in Second VF page.
 

Hi developers,
Please fix th issue for thisUser-added imagetrigger TotalAmt_Child_paraent on Child__c (after insert,after update, after delete,after undelete) {
    set<id> idSet = new  set<id>();
    List<Child__c> cList = new List<Child__c>();
    List<Parent__c> pList = new List<Parent__c>();
    if(trigger.isinsert ||trigger.isupdate ||trigger.isundelete){
        for(Child__c c : trigger.new){
            if(c.ParentMD__c != null)
                idSet.add(c.ParentMD__c);
        }
    }
    if(trigger.isdelete){
        for(Child__c c : trigger.old){
            if(c.ParentMD__c != null)
                idSet.add(c.ParentMD__c);
        }
    }    
    if(idSet.size()>0){
    decimal amt = 0;
    cList = [Select id, ParentMD__c from Child__c where ParentMD__c in: idSet];
    Map<id,List<Child__c>> prMap = new Map<id,List<Child__c>>();
    for(Child__c c : cList){
        prMap.put(c.ParentMD__c, new List<Child__c>());
        prMap.get(c.ParentMD__c).add(c);
    }
    pList = [Select id,TotalAmt__c from Parent__c where id in: prMap.keySet()];
        for(Parent__c p : pList){
            for(Child__c ch : prMap.get(p.id)){
                if(ch.MyAmt__c != null)
                    amt +=  ch.MyAmt__c; 
            }
            p.TotalAmt__c = amt;
        }
        update pList;
    }
    }
Write a trigger to auto calculate sum of amount when ever record is inserted update deleted in opportunity object using rollup summary fields
1.customer__c(master obj) and address__c(detail obj).
address__c has has 2 checkbox field Nagpur__c and Pune__c and customer__c has TextField Hometown__c 
if Nagpur__c is checked, Hometown__c = 'nagpur';
if Pune__c is checked, Hometown__c = 'pune';
2. is it true, that master-detail relation trigger like above wont require query ?
 
Please Help Me With Code.
I want to create a page in which,
we use <apex:inputField> or <apex:inputText> for FirstName, LastName, DateOfBirth,Gender(PickList).
There will be a button on page, after insert value in each field and clicking on button, next page will get display, wich will show list of output. which we have entered in inputField or input text.
please give me a code using following methods,
PageReference Px = page.PageName;
    Px.getParameters().put();
ApexPages.currentPage().getParameters().get();
 
help me with trigger code.
An object has FirstName and LastName field, if we try to create a record with same FristName and LastName, record should not create(throws error).
 
Whenever a new transaction is performed successfully then update the customer object balance field based on 
     If Transaction Type=Deposit, Balance= balance +amount ;  withdraw balance= balance-amount;
     Note: Customers and Transaction has lookup Detail Relation.