• Swayam Arora
  • SMARTIE
  • 518 Points
  • Member since 2015

  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 81
    Replies
<apex:page standardController="Account">

    <apex:pageBlock title="My Content">

        <apex:pageBlockTable value="{!account.Contacts}" var="item">

            <apex:column value="{!item.name}"/> 

            <apex:column value="{!item.name1}"/>

        </apex:pageBlockTable> 

    </apex:pageBlockTable> 

</apex:page>
I have a PageBlockTable which is inside repeat, and eache pageBlockTable have only one row, so i want to display my table vertically.

Any ways to achieve it ?
  • March 19, 2015
  • Like
  • 0
This is my controller class in which I am directly inserting my queryl 
 
public class WBSDataTableController {
    public List<Tasks__c> WBSList {
        get {
            if (WBSList == null) {
                WBSList = [SELECT Task_Name__c, Start_Date__c, Project__r.Name FROM Tasks__c WHERE Project__r.Name = 'P-005'];
            }
            return WBSList;
        }
        set;
    }
}


Now when I call my Start_Date__c field which is a Date type field, in HTML like this : 

<apex:repeat value="{!WBSList}" var="tasks">
                    <tr>
                        <td>{!tasks.Task_Name__c}</td>
                       <td>{!tasks.Start_Date__c}</td>
                
                    </tr>
                </apex:repeat>
 



It shows me this value : 
Tue Feb 17 00:00:00 GMT 2015

whereas I only want the value like this : 
17 Feb 2015 

 

I know that there is an option to break it down in using date time instance but I want to add the formatted date straight into my WBSList variable. 

Any quick fixes for this?

Hi All. How to query for accounts in child territories? I can't seem to find any documentation for this 

Currently I'm able to query for the accounts in the current logged-in user's territrry only, but not from the sibling territories.

Following is my code...
 
public class TrackingPartners{

    public List<orders__c> orders {get; set;}
    public TrackingPartners() {   
    }
    
    
    public list<orders__c> getstart() {

    Map<Id,UserTerritory> UserTerritoryCurrentUserMap = new  Map<Id,UserTerritory>([Select u.UserId, u.TerritoryId, u.IsActive, u.Id  From UserTerritory u Where u.isActive=true and u.userId =: UserInfo.getUserId()]);

    
    
    set<Id> TerritoryIdSet = new set<Id>();
	
    for(UserTerritory ut:UserTerritoryCurrentUserMap.values())
    {
          TerritoryIdSet.add(ut.TerritoryId);
    }    

      list<Group> map_group = [Select Id, RelatedId from Group where (Type='Territory' OR Type='TerritoryAndSubordinates') AND RelatedId IN : TerritoryIdSet];


    List<SYSTEMS__c> lst_PartnersAcc = [SELECT CUST_NUM__c,Account__c
                                                 FROM SYSTEMS__c WHERE Account__c IN                                                  
                                                 (Select  AccountId from AccountShare where ( UserOrGroupId IN : map_group OR  UserOrGroupId =:UserInfo.getUserId()) AND RowCause IN ('Territory', 'TerritoryManual', 'TerritoryRule'))
                                                 ];

                                                 
    Set<String>tempList = new Set<String>();

    for(SYSTEMS__c s : lst_PartnersAcc) {
        tempList.add(s.CUST_NUM__c);

        
    }
    
    List<orders__c> orders =[SELECT Orders__c,id FROM orders__c   
                                 WHERE  Bill_to__c IN: tempList OR
                                        Payer__c IN: tempList OR 
                                        Ship_To__c IN: tempList OR
                                        Sold_to__c IN: tempList
                                     ]; 
                                    

     return orders;                                
  }                                
  
}

How to query accounts from the child territory? Any reference would be great. Thanks in advance! 
  • February 20, 2015
  • Like
  • 0
trigger newTrg on Opportunity (before insert) {
for(opportunity opp:trigger.new)
{
Set<Id> s1 = new Set<Id>();
if(opp.accountId != null){
s1.add(opp.accountid);
}
if(s1.size()>0)
{
Map<Id,Id> m1 = new Map<id,Id>();
for(Account acc : [Select id, ownerId from Account where id in:s1])
{
m1.put(acc.id,acc.ownerId);
}
for(Opportunity opp1:trigger.new){
//Custom Field
opp1.TestUser__c = m1.get(opp.accountId);
}
}
}
}
Morning Everyone,

Thank you in advance for the insights to this problem.
I posted a related question here: https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AxSXIA0
Where i thought i would be able to get the list of IDs through 1 query. After going back and forth all week i have come to the realization that i cannot query at once since the relationships do not align.

But I do think i can query 2 lists through Product__c and do some comparing to create the third list for emailing. Problem is I cannot find the right code to do it.

List 1: List of Promotion Id and related Product Id (based on criteria of the promotion)
List 2: List of Product Id and related Product Contact Id (based on criteria of the Product Contact Role ' Manager' or 'Rep')

I would like to do a comparison between List 1 & 2.
If the Product ID in L2 exists in L1, add the Promotion ID and Product Contact ID together in L3.

So List 3 would be: Promotion ID | Product Contact ID

Thoughts on the best practice to tackle this?

Thanks!

 
in a custom object there are 2 fields 'A' and 'B' and there are 2 workflows . In 1st workflow when value a=1 then field update b=1 and in 2nd work flow when b=1 then field update a=1. what will be the ouput???? whether we will get any error.
 
  • February 19, 2015
  • Like
  • 0
Hi all
I worked with save and new functionality.Whn i click save and new button the record get saved but the field doesn't get blank.
I need after i click save and new button,the record need to get saved and field need to blank. so we can enter another record.

This is my code
<apex:page standardController="Bank__c" extensions="custom">
<apex:form >
<apex:pageblock id="pb" >
<apex:pageblocktable value="{!Bank__c}" var="ban" >
<apex:column headerValue="ifsc code">
<apex:inputfield value="{!ban.IFSC_Code__c}"/>
</apex:column>
</apex:pageblocktable>
</apex:pageblock>
<apex:commandButton action="{!savenew}" value="Save and New" rerender="pb"/>

</apex:form>
</apex:page>


===Controller===
public with sharing class custom {
public Bank__c ban { get; private set; }

private ApexPages.StandardController sController;  
    private String queryString;  
              public custom (ApexPages.StandardController controller) {  
        sController = controller;  
        ban = (Bank__c)controller.getRecord();  
 

    }  
 public Pagereference SaveNew()
 {
 
   upsert ban;

   string s = '/' + ('' + ban.get('Id')).subString(0, 3) + '/e?';
   return new Pagereference(s);
   
 
 }}
What's wrong with my code.????
note:
Record  get saved but field doesn't get blank
Hi,

On the Order object I have a requirement to create custom button to check if the custom field(check box) in object Account object is check or not. Can I do this using Javascript only if yes, can anybody show me? if no  and i need to do a VF and controller on this please let me know

Example of displaying custom field in an order:
alert('{!Order.SAP_Status__c}');

but if i want to display using the standard fields like Accountname, accountNumber, how will get these value.


Thanks,
Smurfet

 
 

Hello,

I followed blog below to display two dependent picklist
https://www.sundoginteractive.com/sunblog/posts/displaying-dependent-picklist-fields-on-a-visualforce-page

public with sharing class locationController{
 
    public list<location__c> locationList{get;set;}
 
    public locationController(){
        locationList = [Select ID, Country__c, State__c, City__c
                From Location__c];
    }
     
}



<apex:page controller="locationController"> 
  Location Table
  <apex:messages style="color:red"></apex:messages>
   
    <apex:form>
        <apex:pageblock>
            <apex:pageblocktable value="{!locationList}" var="locItem">
                <apex:column headervalue="Country">
                    <apex:inputfield value="{!locItem.Country__c}">
                     </apex:inputfield>
               </apex:column>
             
              <apex:column headervalue="State/Province">
                    <apex:inputfield value="{!locItem.State__c}">
                    </apex:inputfield>
               </apex:column>
             
              <apex:column headervalue="City">
                    <apex:inputfield value="{!locItem.City__c}">
                    </apex:inputfield>
               </apex:column>
            </apex:pageblocktable>
        </apex:pageblock>
    </apex:form>
   
</apex:page>
 

How can this example be modified to use "pageBlockSection",  or is there any better way to display picklist and dependent picklist like a pageBlockSection fashion.

 

  • February 17, 2015
  • Like
  • 0
Hi,

While updating data via data laoder and it will trigger the operation. If the 3rd record enters in custom validation condition, the update fails and the all the records displaying same validation message. Please clear it.

Thanks,
Vetri
The Marketing Coordinator and Account Manager both require access to view and update Account Records, but only the Account Manager should be able to see and edit certain fields. Specifically, only the Account Manager should be able to see and edit the Rating field. The Marketing Coordinator should not be able to see or edit the Rating field. Create one profile and one permission set with the appropriate field-level security to solve for this use case. The profile must be named 'Basic Account User' and result in an API name of 'Basic_Account_User'. It should use the 'Salesforce' user license type. The permission set must be named ‘Account Rating’ and result in an API name of 'Account_Rating'.
Hello, can anyone help me please.
I'm looking for a code that when I change a value from the picklist in the same time it will appear a field on the vfpage without saving yet.
I created a vfpage that has 3 picklist with field dependencies.
and I want to know if :
For example:
If the picklist Series = 001-001
the field #Pre_Impreso_001_001__c has to appear on the vfpage and
the field #Pre_Impreso_002_001__c has to desappear
and
If the picklist Series = 001-002
the field #Pre_Impreso_001_001__c has to desappear of the vfpage and
the field #Pre_Impreso_002_001__c has to appear

Is it posible to do that?

User-added image

<apex:page controller="PruebaController" tabStyle="Pre_Factura__c">
<apex:sectionHeader title="Paso 5 de 5" subtitle="Factura"/>
<apex:form >
    <apex:pageBlock mode="edit" title="Paso 5 de 5">
        <apex:pageBlockButtons location="bottom" >
               <apex:commandButton action="{!PPagina4}" value="Anterior"/>
               <apex:commandButton action="{!PPagina6}" value="Siguiente"/>
                <apex:commandButton action="{!cancel}" value="Cancel" onclick="return confirmCancel()" immediate="true"/>
       </apex:pageBlockButtons>
      <apex:pageBlockSection title="Información Basica" columns="1">
               <apex:inputField value="{!factura.Sucursal__c}"/>
               <apex:inputField value="{!factura.Caja__c}"/>
                <apex:inputField value="{!factura.Serie__c}"/>
         </apex:pageBlockSection>
         <apex:pageBlockSection title="Confirmar Factura" columns="1">
                 <apex:inputField value="{!factura.Fecha__c}"/>
                 <apex:inputField value="{!factura.Pre_impreso_001_001__c}"/>
                 <apex:inputField value="{!factura.Pre_impreso_002_001__c}"/>
                 <apex:inputField value="{!factura.Esta_seguro__c}"/>
      </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi,

My trigger clones an opportunity when it is set to closed won or when the account program status is set to on Program. It works fine, but my problem is in data loader bulk update,  I am adding the values in list and inserting outside the loop. what it does is adding all opportunities to all the account all the accounts. All the opportunities in the list is inserted in all account for update made. How to associate an opportunity to corresponding account. Below is my code:

Opportunity[] oppsToClone = new Opportunity[]{};
List<Opportunity> opptsToInsert = new List<Opportunity>();
List<Opportunity> oppMap = new List<Opportunity>();
Set<Opportunity> oppSet = new Set<Opportunity>();  

for (Opportunity acc:record) 
        {
    Validatios takes place;
     And valid records added to 
    oppsToClone.add(acc);
    if (oppsToClone.size() > 0 )
                        { 
                            for (Opportunity record1:oppsToClone)
                            {
                                Opportunity theClone = record1.clone(false,false); 
                  Values are assigned
                  and inserted in list
                    opptsToInsert.add(theClone); 
             }
         }
        }
if(opptsToInsert.size() > 0) 
{
    insert opptsToInsert;
}
using bcc to salesforce, and i have to create a new task when mail comes with specified subject. I had written a trigger on Task. In case when i am sending bcc to lead its working fine but in case of Contact whoId is always coming as null, i tried with both after insert and after update.

This is trigger I had written:
trigger bccTrigger on Task (after insert, after update) {

    //TaskTriggerHelper.createNewTask(Trigger.new);
    List<Task> tnew=trigger.new;
    List<Task> tc=[Select Id,Subject,Dummy_Number__c,WhoId from Task where id in:tnew];
    List<Task> tk=new List<Task>();
    If(Trigger.isInsert){
        if(Trigger.isAfter){
        for(Task t:tc){
        system.debug('............Insert.......'+t.WhoId+'.....'+t.Id);
            if((t.Subject).equals('Email: GroupBy / Searchandiser Introduction')){
                t.Dummy_Number__c=t.Dummy_Number__c+1;
                }
            }
            update tc;
        }
    }

    if(Trigger.isUpdate){
        if(Trigger.isAfter){
            for(Task t:tc){
            system.debug('............Update.......'+t.WhoId+'.....'+t.Id);
            if((t.Subject).equals('Email: GroupBy / Searchandiser Introduction')){
                Task tadd=new Task();
                tadd.Subject='Test1';
                tadd.WhoId=t.WhoId;
                tk.add(tadd);
                }
            }
            insert tk;
        }
    }

}


 
Hello,
My Opportunity Detail page is Visualforce page which can come data from Custom setting using dynamic SOQl. I couldnt add InlineEdit functionality into my custom visualforce page.In my Visualforce page there section & custom field comes from Custom Setting data. Please give me solution as early as possible.

Thanks.
 
How to dynamically get values of options we select from PICKLIST . For example I have an account picklist on my VF page which has all the account names as pick list option values. Whenever I select account name from pick list , respective account details like accountname, contact name, oppty name should populate dynamically on the same VF page.

Detailed Description of the requirement :
1. A drop down on Accounts
2. On selecting a particular Account need to get following details:
      A. Opportunities associated with that account
      B. Contact Person for that opportunity- Name if one contact person, number with embedded hyperlink in case of more than one( Hyperlink                should lead to all contact with following information  : Name, Account , Email id)
      C. Lead Name if opportunity has originated from Lead Conversion    
      ​D. Lead Owner of that particular lead.


I can able to dynamically get account values from controller class to Account picklist in VF page, but I don’t know how to display account details(each account we select in picklist) in the same VF page of other section.

Please check my below incomplete VF page and Controller class:
<---VF Page to To get Account PickList and to display each account details: --->

<apex:page controller="AccountDetails">

  <apex:form >
  <apex:pageblock title="AccountDetails" id="camps_list">
  <table style="width: 100%"><tr>
  <td>

          <apex:outputLabel value="Account Name:"/>
          <apex:selectList value="{!filterid}" size="1">
          <apex:actionSupport event="onchange" action="{!fetchRecords}"  rerender="cases_table"/>
          <apex:selectOptions value="{!AccountList}"></apex:selectOptions>
          </apex:selectList>
 </td>
 
 <td>
  No Of Records Displayed:
<apex:selectList value="{! PageSize }" size="1" id="sl">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>

 </td>
</tr>
</table>
</apex:pageBlock>

<apex:pageBlock >

<h1>AccountRelated List records</h1>

</apex:pageblock>
 
  </apex:form>
</apex:page>

<----Controller Class--->

public without sharing class AccountDetails 
{

    public String results { get; set; }

    public String filterid { get; set; }

    public String fetchRecords { get; set; }
    public String PageSize { get; set; }
    public List<Account> accts = new List<Account>();
    public List<Contact> listContacts {get;set;}
    public List<Case> listCases {get;set;}
    public List<Opportunity> listOpptys {get;set;}
    public String selectedAcctId {get;set;}

    public AccountDetails()
    {
    
    }
    
    public List<SelectOption> AccountList
    {
        get
        {
            accts = [Select u.name, u.Id From Account u];
            
            AccountList = new List<SelectOption>();
            
            for(Account tempacct: accts)
            {
                AccountList.add(new SelectOption(tempacct.Id, tempacct.Name));
            }
            return AccountList;
        }
        set;
    }
    
   public void fetchRecords() {
        
    }
    
}
Please can someone help me on it
 
<apex:page standardController="Account">

    <apex:pageBlock title="My Content">

        <apex:pageBlockTable value="{!account.Contacts}" var="item">

            <apex:column value="{!item.name}"/> 

            <apex:column value="{!item.name1}"/>

        </apex:pageBlockTable> 

    </apex:pageBlockTable> 

</apex:page>
I have a PageBlockTable which is inside repeat, and eache pageBlockTable have only one row, so i want to display my table vertically.

Any ways to achieve it ?
  • March 19, 2015
  • Like
  • 0
hi all I was getting following error "System.TypeException: Invalid decimal: opp.Plan_Number__c: Trigger.OpportunityTrigger: line 10, column 1" for the below trrigger when tried creating a record in opportunity. my trigger was :

trigger OpportunityTrigger on Opportunity (after insert, after update){

if(Trigger.isInsert){

    List<AccountManagement__c> am = new List <AccountManagement__c>();
   
    
    for(Opportunity opp : trigger.new){

        AccountManagement__c a = new AccountManagement__c
        
        
(Planholder__c = opp.Planholder_Name__c,
        Plan_Number__c = decimal.valueof ('opp.Plan_Number__c') ,
        Name='');
         
           
                      
                 am.add(a);
                 
    }
    
    if(am != null && am.size() > 0){
insert am;}


}
}
Hi All,
           How to create the New  Report for the below condition  
"same Amount and  same Record Name". Is it possible to create a filter logic?

Please advice me

Regards,
Bala
Hello,

I need an Apex Trigger to update a date field on a Contact Record with the date field from the related Account Record. Will also need Apex Class. The Contact Record is not always edited so a workflow or process doesn't cut it.

Thank you
-Heather
 
public with sharing class empdepExtensionNew
{

    public Contact[] Availabledeps {get;set;}
    public dep__c[] shoppingCart{get; set;}
    //public dep__c[] total{get; set;}
    public emp__c theemp {get; set;}
    public String tonSelect{get; set;}
    public String toUnselect{get; set;}
    public String searchString{get; set;}
    //public String value{get; set;}
    public Boolean AccountRT{get; set;}
    public Boolean ContactRT{get; set;}
    public Boolean LeadRT{get; set;}
    public Boolean OpportunityRT{get; set;}
    public String UserID {get; set;}

    private dep__c[] forDeletion = new dep__c[]{};
    private ApexPages.StandardController controller;

    //Constructor

    public empdepExtensionNew (ApexPages.StandardController controller)
    {
        this.controller= controller;
        if(controller.getrecord() == null)
        system.debug(controller.getrecord().id);

        //UserID = UserInfo.getname(); 

        //emping Custom Setting object for Recordtypes in emp object

        Record_Type_Name__c Accrt = Record_Type_Name__c.getValues('AccRecordTypeID');
        Record_Type_Name__c Conrt = Record_Type_Name__c.getValues('ConRecordTypeID');
        Record_Type_Name__c Leart = Record_Type_Name__c.getValues('LeaRecordTypeID');
        Record_Type_Name__c Opprt = Record_Type_Name__c.getValues('OppRecordTypeID');

        //Condition to check the record type for emp object 

        if(ApexPages.currentPage().getParameters().get('RecordType') == Accrt.Record_Type__c){
            AccountRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Conrt.Record_Type__c){
            ContactRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Leart.Record_Type__c){
            LeadRT = TRUE;
        }
        if(ApexPages.currentPage().getParameters().get('RecordType') == Opprt.Record_Type__c){
            OpportunityRT = TRUE;
        }

      { 
            //String value = ApexPages.currentPage().getParameters().get('Id');

            //total =[Select id,name,empId__c,Contact_Id__c,emp_Date__c,dep__c.Contact_Id__r.Name from dep__c ];
            shoppingCart = [Select id,name,empId__c,Contact_Id__c,emp_Date__c,dep__c.Contact_Id__r.Name from dep__c where id =: tonSelect]; 

       }
       updateAvailableList();
     }

    public void updateAvailableList() 
    {

        UserID = UserInfo.getUserId(); 
        String qString =  'select id, Name, Title, Contact.MailingCity,Contact.MailingState,Contact.Account.Name from Contact  where User_Id__c not in (select ID from User where id =: UserID )' ;
        system.debug(qString);

        if(searchString!=null)

        {          
            qString+= ' and ( Contact.Name like \'%' + searchString + '%\' or Contact.RACFID__c like \'%' + searchString + '%\' or Contact.Officer_Code__c like \'%' + searchString + '%\') ';                       
        }

       Set<Id> selectedEntries = new Set<Id>();
       if(tonSelect!=null)
        for(dep__c d : shoppingCart){
            selectedEntries.add(d.Contact_Id__c);
        }

        if(selectedEntries.size()>0){
            String tempFilter = ' and id not in (';
            for(id i : selectedEntries){
                tempFilter+= '\'' + (String)i + '\',';
            }
            String extraFilter = tempFilter.substring(0,tempFilter.length()-1);
            extraFilter+= ')';

            qString+= extraFilter;
        } 

        qString+= ' order by Name';
        qString+= ' limit 12';
        system.debug('qString:' +qString );               
        Availabledeps = database.query(qString);
        system.debug(Availabledeps);

    } 

    public void addToShoppingCart()

    // This function runs when a user hits "select" button next to a dep

    { 
      for(Contact part : Availabledeps)
       {
        if((String)part.id==tonSelect)
            {

                shoppingCart.add(new dep__c (Contact_Id__c =part.id));
                system.debug(shoppingCart);
                system.debug(shoppingCart.size());
                break;

            }          

        }
         updateAvailableList();

    }  

      public PageReference removeFromShoppingCart(){

        // This function runs when a user hits "remove" on "Selected dep" section

        Integer count = 0;

        for(dep__c del : shoppingCart){
            if((String)del.Contact_Id__c==toUnselect){

                if(del.Id!=null)
                    forDeletion.add(del);

                shoppingCart.remove(count);
                break;
            }
            count++;
        }

        updateAvailableList();

        return null;
    }

     // This function runs when user hits save button

     public PageReference onSave(){

        try{

            PageReference pageRef = controller.save();
            system.debug(controller.getrecord().id);

                if(shoppingCart.size()>0) 

                  for (dep__c partmember : shoppingCart ){
                     partmember.empId__c=controller.getrecord().id;
                     System.debug(partmember.empId__c);
                  }

                  System.debug('size' +shoppingCart.size());
                  insert(shoppingCart);
                }


            catch(Exception e){
            ApexPages.addMessages(e);
            return null;
        }  
           System.debug('completed');

        // After save return the user to the emp
       return new PageReference('/' + controller.getrecord().id);  
    }     
}
Test class:
@istest(seealldata=true)
Public class Test_empdepExtensionNew
{
Public static testmethod void empdepExtensionNew_test()
{
    Record_Type_Name__c opprt =[select  ID,name,Record_Type__c from Record_Type_Name__c where name ='OppRecordTypeID']; 
    PageReference nextpage = new PageReference('/apex/empCustomNew?id='+opprt.Id);
    nextpage.setredirect(true);
    emp__c  c = new emp__c(Subject__c = 'TestdepExtension',emp_Type__c = 'BD Monthly Update',emp_Date__c = system.today(),
    Status__c = 'DONE',OpportunityId__c='006q0000004QWR7',RecordtypeId=opprt.Record_Type__c);
    insert c;
    empdepExtensionNew e = new  empdepExtensionNew(new ApexPages.StandardController(c));
    contact con = new contact(LastName='test',Contact_Type__c='Business contact',AccountId='001q000000BDufL');
    insert con;
        e.updateAvailableList();
        e.addToShoppingCart();
        e.removeFromShoppingCart();
        e.onSave(); 
        dep__c p1 = new dep__c(empId__c=c.id,Contact_Id__c='003q000000CrgjD');
        dep__c p2 = new dep__c(empId__c=c.id,Contact_Id__c='003q000000CvPct');
        List<dep__c> part = new List<dep__c>();
        part.add(p1);
        part.add(p2);
        insert part; 
        //System.assertEquals(3, [select count() from dep__c where empId__c=:c.id]);
    }    
}

At present code coverage is 66%.Kindly help me out to increae my code coverage. thanks
hi all...here we need to write a trigger. we need to create a contact on contact object for a particular account. when we give the value in phone field of contact, the phone field of parent account of this contact should get updated with the phone field value given in contact object.
am a beginner so not understanding.
here is my coding

trigger tgr_fieldupdate on Contact (after update) {
   list<contact> ls= [select id,phone from contact];
    contact con= trigger.new[0];
    account acc = new account();
        for(contact c:ls){
            c.phone= acc.phone;
            update acc;
        }
    
We're a couple of developers who are very new to the Salesforce ecosystem but understand relational database design very well. We're having some difficulty creating a particular report. Here's the scenario:

Tables Involved:
  • Account
  • Donations
  • Ticketable Events
  • Orders
  • Order Line Items

Functionality Requirements:
  • User enters a date range
  • User selects an event from Ticketable Events drop down
  • Users runs report (or presses button) and the following is displayed:
    • List of accounts
    • Whether or not they purchased the selected Ticketable Event (based on the existence of an Order Line Item with keys from both Accounts and Ticketable Event)
    • Aggregated amount of Donations (if any) made by each Account within the selected date range
    • User is given the ability to export the list as a CSV with additional account information such as email address, etc. If this information needs to be in the list presented, that's fine.
We're not afraid of diving into some Apex or Visualforce, we'd just like to get this done as cleanly as possible. We've already tried a Joined Report but that didn't seem to cut it. We figured we'd leverage best practices from all you awesome people.

Thanks for your time. :)
Hi All, 

I have a problem, where im calling a method in a controller from a button on a visual force page. The controller updates some records but the trigger that i have which is an after update doesnt fire (well acutally it seems like its firing at random there are a good few hundred records) has anyone else had this problem and know how to solve the issue? thanks.
Hi,
I have the following jscript button. It checks the users permission set and work accordingly but it requies user to have "View Setup and Configuration" permission at the user level. We have users without that permission and not able to submit the records. Can someone please assist how to make this button work without assigning "View Setup and Configuration" permission to users? I am getting the following error.
User-added image
 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")}
try {
    var result = 
        sforce.connection.query(
            "SELECT Id " +
            "FROM PermissionSetAssignment " +
            "WHERE PermissionSetId = '0PSK00000004T11' " +
            "AND AssigneeId = '{!$User.Id}'"
        );

    var psAssignment = result.getArray("records");
    if (
        "{!Pims__c.Status__c}" !== "Under Review" &&
        psAssignment.length === 1
    ) {
        var isContinue = confirm("Are you sure you want to submit ? Click OK to continue or Cancel to remain on the screen.");

        if (isContinue) {
            var PimstoUpdate = new sforce.SObject("Pims__c");

            PimstoUpdate.Id = "{!Pims__c.Id}";
            PimstoUpdate.Status__c = "Under Review";

            var result = sforce.connection.update([PimstoUpdate]);

            if (result[0].success === "true") {
                location.reload();
            } else {
                alert(
                    "An Error has Occurred. Error: \r\n" +
                    result[0].errors.message
                );
            }
        }
    } else {
        alert(
            "Nopes"
        );
    }
} catch (e) {
    alert(
        "An unexpected Error has Occurred. Error: \r\n" +
        e
    );
}

 
  • March 03, 2015
  • Like
  • 0
Need help with creating a custom button: I'd like to create a quote from the opportunity related list and auto populate the quote name with the opportunity name and also the current date.

Thanks in Advanced.

joe
Hi,

While updating data via data laoder and it will trigger the operation. If the 3rd record enters in custom validation condition, the update fails and the all the records displaying same validation message. Please clear it.

Thanks,
Vetri