• Gunners_23
  • SMARTIE
  • 633 Points
  • Member since 2011

  • Chatter
    Feed
  • 24
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 137
    Replies
Hi, I am doing bulk insert in custom object from visualforce page using controllers.. In that custom object I have two fields called startdate__c ,enddate__c. I fired some validation rule on that i.e enddate__c < startdate__c. while I am entering data from visualforce page if I enter endate less than start date its showing error in visualforce page.. and after I correct and click save button it is showing System.ListException: Before Insert or Upsert list must not have two identically equal elements error. I am not aware of that.. can any one knows about this.. Here is my Controller :- public class ProjectMileStonesCon { /* public List wrappers {get; set;} public static Integer toDelIdent {get; set;} public static Integer addCount {get; set;} private Integer nextIdent=1; public Customobj1__c cusob; public List mls = new List(); public ProjectMileStonesCon(ApexPages.StandardController controller) { wrappers=new List(); cusob = (Customobj1__c)controller.getRecord(); for (Integer idx=1; idx<=1; idx++) { wrappers.add(new PTeamWrapper(nextIdent++,cusob)); } } public void delWrapper() { Integer toDelPos=-1; for (Integer idx=0; idx

Hi,

 

I'm trying to simulate the alphabet search functionality available in standard list views. I have been able to get most of the work done by using an SOQL query with filters for field1 like '%A'

 

 

But I do not know how to work the 'Other' filter on the alphabet search. This filter will present you all the records that start with a number or special character. How can we issue a SOQL query which does something similar?

hi ,

i'm getting objects from schema

based on the user selection of object ,it has to display all the child objects of the selected master object which has master detail relationship .

 

i'm using getChildRelationships() function to get the child relationship

but how to restrict it to get only childs with master detail relaationship

 

thanks in advance

i have multi select picklist feild in account. the no of opportunities should be created that are equals to values selected in multi select picklist feild

 

i wrote below code . by using this iam able to create one opportunty at a time

 

trigger:

=========================

  trigger OppIns on Account (after insert) {

list<Opportunity> oppts =new list<Opportunity>();
 for(account acc:trigger.new)
 {
 oppts =new list<Opportunity>();
oppts.add(new Opportunity(name=acc.products__c,accountid=acc.id,StageName='Prospecting',Closedate=date.today()));

  }

   insert oppts;

}

 

 

for example i select  two values in picklist two opportunity should be created

 
trigger UpdateContactNo on Contact (after insert) { list<Account> acc = new list<Account>();        
for(Contact c:trigger.new)
{ 
  list<Account> ac =[select id,No_of_Contacts__c from Account where id =: c.AccountId]; 
    for(Account a : ac)
           {
               if (a.No_of_Contacts__c != null){   
             a.No_of_Contacts__c = a.No_of_Contacts__c+1;
                    acc.add(a); 
              }
             else{
                a.No_of_Contacts__c = 1;
                    acc.add(a); 
              }
       } 
}
try
{
   if(!acc.isEmpty)
    update acc;
}
catch(Exception e)
{
e.getMessage();
}

}
Error is coming in if (a.No_of_Contacts__c != null)line...

I'm trying to write a Trigger that will automatically populate a lookup field with the Partner User's account when the partner creates a new record in a custom object. The Trigger I tried is thus:

 

trigger UpdateAccountName on Change_Request__c (after update) {
    for(Change_Request__c a : Trigger.old)
{a.Customer_Name__c = a.CreatedBy.Contact.AccountID; }
}

 I've tried various combinations of "old" and "new" and "before", "after", "update" and "insert", but I either get the error message below, when attempting to actually utilise the Trigger (there are no compiling errors), or the Trigger simply does nothing, but with no error message. Can anyone offer any guidance? Thanks!

 

Apex trigger UpdateAccountName caused an unexpected exception, contact your administrator: UpdateAccountName: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.UpdateAccountName: line 8, column 1

Hi

   I want to create portal user . when I create new user then Role profile and Licence auto populated . 

   I want these value should not be auot populated.. I want to select licence  and profile as

   

Authenticated WebsiteHigh Volume Customer PortalCustomer Portal Manager StandardCustomer Portal Manager Custom

 

But Unfortunately these value will not be avialable in profile and Licence picklist ....

Auto populated value...

ROLE:CEO

PROFILE : Force.com free user

Licence:Force.com free user ..

 

I want toavoid this scenario ... please helpme as soon as possible...

 

 

Thanks

asish

HI everyone

 

i have one validation rule like below

 

MONTH(CloseDate) < MONTH(TODAY())

 

it works fine but i need it to fire only for a new opportunities not for old.

 

for that purose i did this

 

AND( 
Id =='0', 
MONTH(CloseDate) < MONTH(TODAY()) 

)

 

but it not work .

 

please guide me what can i do to achieve this.

 

 

Thanks.

 

Hi, I have created a VF page "AddMultipleOppy" which adds Multiple opportunities related to a custom Object "Project__c".I want this Vf page to be displayed as list button in related list of opportunities on "Project__c" object So,I have created the custom list button on "Project__c " object and tried to add this button on related list properties of "Opportunity" object in page layout but I could find this button. Am I missing out on anything?? Thanks Regards, Prasanna

Hi

I want to get the Objectname by using The Id ="a0190000003LIVw"

and i  want to get the field of that spefic object .

cn  u please help me to get this

  • August 14, 2012
  • Like
  • 0

From within my apex controller, how do set PageReference to redirect to an object's list view page?

 

The only documented way of doing this is through visualforce:

 

<apex:page action="{!URLFOR($Action.Account.List, $ObjectType.Account)}"/>

 However, I want to be able to do this from the controller instead:

public PageReference confirm()
{
	// Do prep data
	
	PageReference ref = new PageReference();
	
	// ??? redirect to object's list view

	return ref;
}

 

REQUIREMENT :- Need to be able to delete Opportunities via data loader. 
i.e when i'm trying to delete some opportunites through DATA LOADER i'm getting the below ERROR :-


Getting the following message: 
tgrOpportunityBefore: execution of BeforeDelete 
caused by: System.NullPointerException: Attempt to de-reference a null object 
Trigger.tgrOpportunityBefore: line 379, column 1 

 

 

 

TRIGGER :-

 

 // --- This is used since most of the triggers are for Insert and Update on Opportunity.
    if(trigger.isInsert || trigger.isUpdate) {  
      //#101OICD - Variable Declaration -- Start    
      StaticVariables.setAccountDontRun(true); // stop account trigger from running
      List<Id> accIds = new List<Id>();
      Set<id> accidset = new set<id>();
      //#101OICD - Variable Declaration -- End
      
   
 
      //#101OICD -- Loop Through Opp records  and assign values -- Start
      for(Opportunity o:Trigger.new) {
        
        system.debug('Originator EIN ' + o.Originator_EIN__c);
        allCampaignIds.add(o.CampaignId);//CR2180        
        //if(o.Opportunity_Owner_EIN__c == '802558891') o.ABR_Count__c =1;  
        
     
        
        if(o.CloseDate ==null)o.CloseDate = (Date.today()+ 365);
        
        if(o.AccountId != null && o.Auto_Assign_Owner__c)accIds.add(o.accountId);
        
        if(o.OwnerId != null)o.owner__c = o.OwnerId;
        
        //add flag for org to org
        if (
        (o.Routing_Product__c == 'Engage IT' || o.Product_Family__c == 'ENGAGE IT') 
        && o.CreatedDate >= (date.newinstance(2011, 11, 19))  
        //    || ((trigger.newmap.get(o.id).Routing_Product__c != trigger.oldmap.get(o.id).Routing_Product__c)
        //    || (trigger.newmap.get(o.id).Product_Family__c != trigger.oldmap.get(o.id).Product_Family__c ))
        ){
            o.s2s_Link__c = 'BTB to Engage IT';  
        }
        

    //#101OICD -- Part of 101OICD Trigger to Modify Opportunit Owner By Account -- End
     
     //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- Start
        //Added by GS to update account last call date.
        //Update the account last call date field for these accounts      
        list<account> updateCallDate = new list<account>();          
        updateAccountLastContacted updateAccountCallDate = new updateAccountLastContacted();                     
        //updateCallDate = updateAccountCallDate.updateAccount(accidset);
        String objName='Opportunities';
        updateCallDate = updateAccountCallDate.updateAccount(accidset, objName);           
        update updateCallDate;               
    //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- End
    }
     
    //Set RAG Status to None if Leasing History has 0 records -- Start
   LINE 379 :- for(Opportunity o : trigger.new){
    Integer i = [SELECT count() FROM Leasing_History__c WHERE Opportunity__c =: o.Id LIMIT 1];
    if(i < 1){
      o.Finance_Available__c = 'None';
     }
    }    
    //Set RAG Status to None if Leasing History has 0 records -- End   
}

Hi,

I created a VF page where, checkbox appears dependent on the value of the picklist. For Example

Picklist vlaues are: Meets Best Practices, Partially Meets Best Practices, Doesnot Meet Best Practices. For each Picklist value a checkbox appears. My Problem here is when the picklist value is "none" then all the checkbox appear. I want then to appear only when picklist value is selected and hide all checkbox when the picklist value is none.

Here is the code: 
<apex:pageBlockSection collapsible="false" columns="1" title="Instructional Material">
<apex:inputField value="{!Class__c.QC_Material_Observation__c}" required="false">
<apex:actionsupport event="onchange" rerender="null,best,partial,doesnot"/>
</apex:inputField>
<apex:outputPanel >

</apex:outputPanel>
<apex:outputPanel id="best" >
<apex:pageBlockSection rendered="{!Contains(Class__c.QC_Material_Observation__c,'Meets Best Practices')}" >
<apex:inputCheckbox value="{!Class__c.QC_IM_Fine__c}"/>
<apex:inputCheckbox value="{!Class__c.QC_IM_Fine_Multimedia__c}"/>
</apex:pageBlockSection> 
</apex:outputPanel>

<apex:outputPanel id="partial" >
<apex:pageBlockSection rendered="{!Contains(Class__c.QC_Material_Observation__c,'Partially Meets Best Practice')}" >
<apex:inputCheckbox value="{!Class__c.QC_IM_Fine_Multimedia__c}"/>
</apex:pageBlockSection> 
</apex:outputPanel>

<apex:outputPanel id="doesnot" >
<apex:pageBlockSection rendered="{!Contains(Class__c.QC_Material_Observation__c,'Does not Meet Best Practices')}" >
<apex:inputCheckbox value="{!Class__c.QC_Third_Party_Material__c}"/>
<apex:inputCheckbox value="{!Class__c.QC_No_Lectures__c}"/>
</apex:pageBlockSection> 
</apex:outputPanel>
</apex:outputPanel> 

<apex:inputTextarea value="{!Class__c.QC_Material_Comments__c}" required="false" rows="10" cols="50" />
<apex:inputField value="{!Class__c.QC_Material_Score__c}" required="false"/>
</apex:pageblocksection>

 

Hi Guys,

I have this code that should disable a two fields, the phone and the fax. However, only the phone is getting disabled when i click the checkbox. Could someone help me with this? thanks!

 

Regards,

Del

 

 

==============================

<script language="javascript">
            function ToggleInput(theId)
            {
                var e = document.getElementById(theId);

                if(e != null)
                {
                    e.disabled = (e.disabled ? false : "disabled");
                }
            }

            window.onload = function () { document.getElementById('{!$Component.phone}','{!$Component.fax}').enabled= "enabled"; }

        </script>
        <apex:inputCheckbox onchange="ToggleInput('{!$Component.phone}','{!$Component.fax}');" value="{!Lead.Copy__c}"/>
        <apex:inputText id="phone" value="{!Lead.phone}"/>
        <apex:inputText id="fax" value="{!Lead.fax}"/>

Hi

I have created a custom object with 4 fields out of 1 is datetime field. I need to display the records from this object to a VF page. But the condition is that only the time from the datetime field should be displayed. I have done the code to get only time from the datetime field but I am not able to display the time on the Vf page using datatable or pageblocktable. 

 

Can anybody help me to solve this problem. 

 

Thanks

Anu

We can assign leads through the lead assignment rule but I want to show unassigned leads in visualforce using  a button

(This visualforce page will  show a list of any unassigned leads just above a button)

 

Could anyone help me to get above requirment.

Hi All,

 

This is something of an issue for me at the minute as it's making me pull my hair out.

 

I want all new Contacts to default to a "Public" Account and I've written this trigger:

 

trigger PopulateAccountNameForNewContact on Contact (before insert, before update){
    system.debug(' ************ WORKING HERE ************ ');
    for (Contact contact: Trigger.new){
        try{
            for (Account a :[select id, Name from account where Name = 'Public' LIMIT 1]){
                if (contact.Account == null){
                    contact.Account = a;    
                    system.debug('DEBUG: Update Contact setting Account to ' + a);
                }else{
                    system.debug('DEBUG: The contact is not null - nothing to do');
                }
            }          
        }catch (DMLException e){
            system.debug('contact execution failed: '+ e);
        }    
    }
}

 

It's not working though... any ideas what I'm doing wrong?

 

Cheers in advance,

 

Dom

Hi,

 

I have a requirement for which i require to dispaly related list dynamically using visualforce pages.

The related lists to dispaly will be known only on runtime and there order to display(i.e. which related appears first, second and so on..) will also be decided on runtime.

Can any one help me with this?

 

Is there any way that I can call  <apex:repeat>   from a command button (that sits within a <apex:pageBlockButtons> tag ) in order to store the output in an Excel spreadsheet? How do I associate the command button with this reapeat tag? Here is the code segment where I am having problems using the repeat tag. (variable lstwrapper is a List<Wrapper> amd wrapper is a class). Thanks much for your help and advice.:

 

 

 

<apex:pageBlock title="Subscription Issues">
    
    <apex:pageBlockButtons >
       <div style="display:inline; padding-left:10%; " id="SubscriptionSpacer1"></div>
            <apex:commandButton value="Get Subscriptions!" action="{!GetQuerySubscriptions}"  status="status"  />
           <apex:commandButton value="Decrement Subscriptions!" action="{!decrementAllIssues}" />
           <apex:commandButton value="Export to Excel" action="{!ExportToExcel}">            
               <apex:pageBlockTable>
                 <apex:repeat value="{!lstwrapper}" var="w">
                     <apex:outputText value="{!w.sid}" />
                     <apex:outputText value ="{!w.acctId}" />
                     <apex:outputText value="{!w.mAttention}"/>
                     <apex:outputText value="{!w.Street1}" />
                     <apex:outputText value="{!w.Street2}" />
                     <apex:outputText value="{!w.Street3}" />
                     <apex:outputText value="{!w.state}" />
                     <apex:outputText value="{!w.zip}" />
                     <apex:outputText value="{!w.name}" />
                     <apex:outputText value="{!w.productName}" />
                     <apex:outputText value="{!w.description}" />
                     <apex:outputText value="{!w.qty}" />
                     <apex:outputText value="{!wlrdate}" />
                     <apex:outputText value="{!w.numissues}" />
                     <apex:outputText value="{!w.lissuessent}" />
                  </apex:repeat>
               </apex:pageBlockTable>
         </apex:commandButton>
    </apex:pageBlockButtons>

 

 

 

Hi,

 

i'm pretty much newbie to "integration" and i was trying to make a callout using WSDL method and got the following error.

 

FATAL_ERROR System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'

 

Searched the board but coudn't find any concrete answers. Any pointers on this why this might happen?

 

Thanks in advance

 

Hi,

 

In Opportunites object, i have to create a VR on "Opportunity Name" field such that Opportunity name should be 'X Account Name'. I tried using Begins and Contains, its not working.

 

Need some Help!

 

Thanks,

Hi all,

I have written a trigger on ContentVersion object. Pls find the code below 

 

trigger docupload on ContentVersion (after insert) {
    List<Task> lstTask = new List<Task>();
    Task newTask;
    List<ContentVersion> lstcon = Trigger.new;
    for(ContentVersion c : lstcon) {
    
        newTask = new Task();
       
       //Here i've added the task status,subject,assigned To and other fields

      //But there is one custom field on contentversion which is checkbox while uploading time i'll set that checkbox and after i will assign that to task custom field

 

      newTask.somefield__c = c.somefield__c; 
        
        lstTask.add(newTask);
     }  
    }
    insert lstTask;
}

 

Eventhough i've assigned that custom fields value to task custom fields its not taking that value even i checked with other data types too its not also not working, my assumption is its firing before the value is set.

 

what am i missing? kindly help

 

 

thank you

HI all, 

I'm trying to create a trigger on Task object, in that i want that task to be circulated to everyone ( All internal Users). How to make it to assign to everyone in org???

 

Is there any workaround apart from fetching User Ids from User records then assigning ID to ownerID field. 

Hi all,

I want to pass the id of the standard field to VF page. How to fetch the id of standard field?

HI all,

I have created a VF page which is having account standard controller and an extension, please find the below code

 

<apex:page standardController="Account" sidebar="false" showHeader="false" extensions="Report">
<apex:form id="thisForm" >

<apex:inputField value="{!account.CustomerPriority__c}" /><br/><br/>
<apex:inputField value="{!account.SLASerialNumber__c}"/><br/><br/>


<apex:commandButton value="Search" action="https://ap1.salesforce.com/00O90000002Gcja?getSearch()"/>


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

 

 

Here is the extension class,

 

public class Report {




public Report(ApexPages.StandardController controller) {


}

Public String getSearch()
{

// Here i want to return a string which will be address but that address should contain

the values passed from the page

 

I tried to access using this {!account.CustomerPriority__c}, but its not working


}

}

 

Please help me out ASAP

 

Thanks & Regards,

Hi,

I have uploaded a image file using document and now i want to use that image in VF page. How to reference an image uploaded in document in VF Page?

I'm trying to create a set of picklists. The first list displays a list of record names (duplicate names are not listed), and the second picklist is supposed to display all the records related to the record selected in the first list (duplicate names are not listed). However, I cannot get the second picklist to populate correctly. I've looked into the examples provided by Salesforce, and I cannot see what I'm doing wrong. Any help would be greatly appreciated, thanks!

 

VisualForce Page:

<apex:page controller="FieldUpdaterController">
<apex:form >
    <apex:pageBlock title="Field Update Module">
        <apex:pageBlockSection columns="1">
        {!selectedDDP}
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Invoice Statement"/>
                <apex:selectList value="{!selectedInvoice}" size="1">
                    <apex:selectOptions value="{!availableInvoices}" />
                    <apex:actionSupport event="onchange" rerender="itemPicklist" />
                </apex:selectList>              
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem >
                <apex:outputLabel value="Line Item" />
                    <apex:selectList id="itemPicklist" value="{!selectedItem}" size="1">
                        <apex:selectOptions value="{!availableItems}" />
                    </apex:selectList>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:form>
</apex:page>

 

 

 

APEX:

public class FieldUpdaterController {

    public String selectedItem {get; set;}
    
    public string selectedInvoice {get; set;}
    
    public List<selectOption> getAvailableInvoices() {
    
        List<selectOption> optionalInvoices = new List<selectOption>();
        
        List<Invoice_Statement__c> allInvoices = [SELECT Name, Id FROM Invoice_Statement__c ORDER BY Name];
            
        string prevInvoice;
        
        for (Invoice_Statement__c i : allInvoices) {
            if(i.Name != prevInvoice) {
                optionalInvoices.add(new selectOption('',i.Name));
            }
            prevInvoice = i.Name;
        }
        
        if (optionalInvoices.size() == 0) {
        optionalInvoices.add(new selectOption('', 'No Invoices Available'));
        return optionalInvoices;
        }
        else{
        return optionalInvoices;
        }
        
    }
    
    public List<selectOption> getAvailableItems() {
        
        List<selectOption> availableItems = new list<selectOption>();
        
        string prevItem;              
 
        for(Line_Item__c li : [SELECT Name, Id FROM Line_Item__c WHERE Invoice_Statement__r.Name = :selectedInvoice]) {
            if(li.Name != prevItem) {
                availableFields.add(new selectOption('', li.Name));
            }
            prevItem = li.Name;
        }
               
        return availableItems;
    }
    
}

 

Hi everybody, 

 

lets see if I'm missing anything or something because I think this might be a salesforce bug.

 

I am developing a REST webservice, see the following code snippet.

 

...
        returned.signatures = new List<Map<String,String>>();
        for(Attachment att : [
            SELECT
                Body,
                ParentID
            FROM
                Attachment
            WHERE 
                ParentID IN :new Map<ID,Order__c>(returned.orders).keyset() AND
                Name like 'Signature%']){
                

                System.debug(att.id);
                System.debug(att.parentID);
                system.debug(EncodingUtil.base64Encode(att.body));

                returned.signatures.add(new Map<String,String>{'Id'=>String.valueOf(att.parentID),'signatureBody'=>EncodingUtil.base64Encode(att.body)});        
        }
...

 

 

The thing is that if I go to the debug logs, 

I see the attachment ID and the parentID properly, but the att.body is from another file :S (if I navigate to the AttachmentID and click on View, I see the good one)

 

Is there anything that I am doing wrong?

  • February 13, 2013
  • Like
  • 0
Hi, I am doing bulk insert in custom object from visualforce page using controllers.. In that custom object I have two fields called startdate__c ,enddate__c. I fired some validation rule on that i.e enddate__c < startdate__c. while I am entering data from visualforce page if I enter endate less than start date its showing error in visualforce page.. and after I correct and click save button it is showing System.ListException: Before Insert or Upsert list must not have two identically equal elements error. I am not aware of that.. can any one knows about this.. Here is my Controller :- public class ProjectMileStonesCon { /* public List wrappers {get; set;} public static Integer toDelIdent {get; set;} public static Integer addCount {get; set;} private Integer nextIdent=1; public Customobj1__c cusob; public List mls = new List(); public ProjectMileStonesCon(ApexPages.StandardController controller) { wrappers=new List(); cusob = (Customobj1__c)controller.getRecord(); for (Integer idx=1; idx<=1; idx++) { wrappers.add(new PTeamWrapper(nextIdent++,cusob)); } } public void delWrapper() { Integer toDelPos=-1; for (Integer idx=0; idx

Hi , how to display ascending order and descending order set of values in visualforce page......

apex class

===========

public class SetPrimitiveDatatype
{
public set<String> fstName{get;set;}
public set<String> lstName{get;set;}

public SetPrimitiveDatatype()
{
fstName=New set<String>();


fstName.add('Rama');
fstName.add('Anil');
fstName.add('Srinu');
fstName.add('Kumar');
fstName.add('Prasad');
fstName.add('Devaraju');
fstName.add('Murali');
fstName.add('Balu');
fstName.add('Chaitu');
fstName.add('Tanuja');

}
}

 

page

============

<apex:page controller="SetPrimitiveDatatype">
<apex:form >
<apex:pageBlock title="Display The Set of values">
<apex:pageBlockSection title="FirstName">
<apex:pageblockTable value="{!fstName}" var="fn">
<apex:column value="{!fn}"/>
</apex:pageblockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

please help me .............

  • October 09, 2012
  • Like
  • 0

Hi,

 

I'm trying to simulate the alphabet search functionality available in standard list views. I have been able to get most of the work done by using an SOQL query with filters for field1 like '%A'

 

 

But I do not know how to work the 'Other' filter on the alphabet search. This filter will present you all the records that start with a number or special character. How can we issue a SOQL query which does something similar?

I have a Trigger on FeedItem.I have inseted an Custom Object record in that trigger.After that custom object insertion when i use feed.addError('Block'); the inserted custom object will be RollBacked.Any idea how to Stop RollBack when we use addError in Trigger??

 

Please help me.Its urgent

 

Thanks

Anil 

I see the following line in production debug log   first line

15.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO

 

And in sandbox the following  - first line

24.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;

 

Why there is a difference? when I check the version setting both of them has same - Salesforce API 24.0

 

  • September 25, 2012
  • Like
  • 0

Hi all,

 

 

I cannot create a Roll-Up Summaryfield on Contats to see the total of close cases in the contact detail page.

 

Any sample code for this?

 

Tank you

  • September 25, 2012
  • Like
  • 0

hi ,

i'm getting objects from schema

based on the user selection of object ,it has to display all the child objects of the selected master object which has master detail relationship .

 

i'm using getChildRelationships() function to get the child relationship

but how to restrict it to get only childs with master detail relaationship

 

thanks in advance

I am creating a login page where some of my customers can access a small amount of data.  I have created a login page and after it verifies the username and password of the user based on a username and password field on the account, it then sends them to a second page where the info will be displayed.  I have a field on the account called Logged In that gets checked when they log in and then unchecked after a period of time to log them out.  I have created the following visualforce page and extension.  What happens is that it never flags it as not logged in.  So the if else statement never seems to run. Here is the code.

Visualforce Page:

<apex:page standardController="account" extensions="CustomerPageExt" showHeader="false">
<apex:outputPanel rendered="alreadyLoggedIn()">
<script>
window.top.location='http://pccaresupport.sandbox.cs17.force.com/login';
</script>
</apex:outputPanel>

<apex:outputField value="{!Account.name}" />
<apex:outputField value="{!Account.Logged_In__c}" />


</apex:page>

 

Extension:

public class CustomerPageExt {

public account currentAcctID {get;set;}

public CustomerPageExt(ApexPages.StandardController controller) {
currentAcctID = (Account) controller.getrecord();
}

public boolean alreadyLoggedIn(){
Account a = [select id, Logged_In__c from Account where id = :currentAcctID.id];
if(a.Logged_In__c = True){
return True;
}
Else{
return False;
}
}
}

i have multi select picklist feild in account. the no of opportunities should be created that are equals to values selected in multi select picklist feild

 

i wrote below code . by using this iam able to create one opportunty at a time

 

trigger:

=========================

  trigger OppIns on Account (after insert) {

list<Opportunity> oppts =new list<Opportunity>();
 for(account acc:trigger.new)
 {
 oppts =new list<Opportunity>();
oppts.add(new Opportunity(name=acc.products__c,accountid=acc.id,StageName='Prospecting',Closedate=date.today()));

  }

   insert oppts;

}

 

 

for example i select  two values in picklist two opportunity should be created

 
trigger UpdateContactNo on Contact (after insert) { list<Account> acc = new list<Account>();        
for(Contact c:trigger.new)
{ 
  list<Account> ac =[select id,No_of_Contacts__c from Account where id =: c.AccountId]; 
    for(Account a : ac)
           {
               if (a.No_of_Contacts__c != null){   
             a.No_of_Contacts__c = a.No_of_Contacts__c+1;
                    acc.add(a); 
              }
             else{
                a.No_of_Contacts__c = 1;
                    acc.add(a); 
              }
       } 
}
try
{
   if(!acc.isEmpty)
    update acc;
}
catch(Exception e)
{
e.getMessage();
}

}
Error is coming in if (a.No_of_Contacts__c != null)line...

Hi I´m new in salesforce and I need to do a rollup summary in a custom object, it should call the value from a formula field of the child object, but when I try to do the sum it does not show the field that I need. Could I create a code or trigger or something to do it manually? Thank you.

Hai,

 

     I applied 'Like' Operator on number field in the SOQL query.But it Showing an error that Like operator will not work on Number field types.

 

 I had the Number type field in database and also i Dont want to change the type here.

 

Then how to aplly 'Like' operator on number field in SOQL.Is there any other way to check the number starting with,like the functionality of 'Like' Operator.

Hi 

   Can anybody tell me how to  migrate the custom objects fields etc into a dev env from sandbox.

Thanks 

Anu

HI,

 

 i declared the class as well as the variables as global still i am unable to view my page. 

 

The code,

 

 

VisualForce:

 

<apex:page Controller="newpage1">
<apex:pageBlock >

<apex:pageBlockSection >

<Apex:pageblocktable value="{!leadrec}" var="l">
<apex:column value="{!l.Name}" />
<apex:column value="{!l.Email}" />
</apex:pageblocktable>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:page>

 

apex:

 

global class newpage1 {

global list<lead> leadrec{get;set;}
global newpage1()

{
leadrec=[select Name,Email from lead limit 10 ];

}
}