• Sandeep123
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 7
    Questions
  • 8
    Replies
Hello guys, i need to create a report which will show existed values per month.

For example, I have picklist field (Assessment)which have values as 0,1,2,3,8,9 on Contact object.

Contact had 0 value in Januay,2 value in February,3 in March, ....

So my report should show every past existed value in each months per contact.

Thanks,

 
Hey all,
I have crated VF page to show google map and markers on it.Currently google map markers are shown without border.
I want to apply thick outside border to google map markers.
Hi,

From a force.com site, I am updating a record and once record is updated using a workflow and on the record update I am sending an email.
Therefore, the email which is send is have from as the Site's user name and email address. Instead of that we want to add a different name as From there in the email.

Please note, we don't want to use Org wide email address as this is going to static for all this type of email address. Instead I'd like to assign the user who previously modified the record before the Site user modified it or may be i want to assign From as one of Lookup(User) field. 

If that is not possible with standard email alert workflow then please suggest any apex solution. 

Hi All,

 

To Login into Customer Portal from our custom page login page, we are using below Login URL .

 

"https://na9.salesforce.com/secur/login_portal.jsp?orgId=XXXXXXX&portalId=XXXXXX&loginType=3&startUrl=&loginUrl=&useSecure=true&un=XXXXXX&pw=XXXXX ".

 

when we pass working "UserName" and "Password", it take me to the"Customer portal login page", and enter Same password again allow me to login.

 

Is this problem with my URL, it was working before 2 days ... Facing this problem from last two days...

 

Is any Update in "Winter 14" effect on this URL ? ... 

Hi All,

 

Can any one help me come out from this situation,

 

I have one object "Purchase Order", and i have set it as Private using OWD, hence it will display only that is owned by that particular user.

 

Now in my situation, I am using Approval process on this object, hence on purchase order list view, it is not displaying that record that is come for Approval.

 

I want to display only that record that is owned by that user and come to Approval for that record and i am also using custom "Reassing" functionality of approval process, hence while Reassign the record should also display to Both user.

 

Note : in "Purchase Order" approval process, User1(normal full license user ) who send this record to User2 ( Customer Portal User).

 

Please help me to come out from this big situation, i hope i am not confusing to you

Hi

 

i have functionality like, i click on "Edit" link, it just renderd new section at the bottom of the table, edit appropriate value and click on Save

 

once click on Save, i am rerendering table to update changed value. but it is rendering all column with 0 value.

 

 

 

Please help me
, Thanks In advance

Hi

 

I am in big trouble, please help me out.

 

I have one batch class, in which i am using UPSERT in Start method only 4 time.

 

It is executing only 4 time, still showing this error.


So any idea for the same, Thanks in advance.

 

 

Hello guys, i need to create a report which will show existed values per month.

For example, I have picklist field (Assessment)which have values as 0,1,2,3,8,9 on Contact object.

Contact had 0 value in Januay,2 value in February,3 in March, ....

So my report should show every past existed value in each months per contact.

Thanks,

 
Hi,

From a force.com site, I am updating a record and once record is updated using a workflow and on the record update I am sending an email.
Therefore, the email which is send is have from as the Site's user name and email address. Instead of that we want to add a different name as From there in the email.

Please note, we don't want to use Org wide email address as this is going to static for all this type of email address. Instead I'd like to assign the user who previously modified the record before the Site user modified it or may be i want to assign From as one of Lookup(User) field. 

If that is not possible with standard email alert workflow then please suggest any apex solution. 

The size of the internal view state increases dramatically when custom components are used. Only the internal view state size increases. Other view state sizes are small. Are there any ways to take care of this issue? I want to display children and grand children records using custom components.

 

 

<apex:dataTable value="{!mainRecord.childRecords}"
                var="childRecord" 
		width="100%">
    <apex:column >
        <c:ChildRecordView id="idChild1" 
	               dataRecord="{!childRecord}"
			/> 
    </apex:column>
</apex:dataTable>	

The size increases even when the mainRecord.childRecords is empty.

  • May 31, 2011
  • Like
  • 0

Hi.

 

I am trying to save a record into a custom object from a picklist that I generated for a list of fields. When i try to click the save action, the picklist is resetting and I am not able to get the value from selected picklist. Please let me know what is that I am doing wrong with the code. 

<apex:page controller="testobjfields">
   <apex:form>
   <apex:pageBlock>
   <apex:commandButton value="Save" action="{!save}" />
   <apex:PageBlockSection columns="3" >     
               
            <apex:pageBlockSectionItem >                  
                <apex:outputPanel layout="block" styleClass="requiredInput" >
                <apex:outputPanel layout="block" styleClass="requiredBlock" />  
                  <apex:SelectList value="{!savedsearchFields.Fieldname__c}" size="1" >
                     <apex:selectOptions value="{!objfields}"></apex:selectOptions>

                  </apex:SelectList>
                </apex:outputPanel>            
             </apex:pageBlockSectionItem>
     
         <apex:pageBlockSectionItem >
            <apex:outputPanel layout="block" styleClass="requiredInput" >
            <apex:outputPanel layout="block" styleClass="requiredBlock" />  
               <apex:inputField value="{!savedsearchFields.Operator__c}" style="border:{!nameErr};"/>
            </apex:outputPanel>
         </apex:pageBlockSectionItem>
       
         <apex:pageBlockSectionItem >
           <apex:outputPanel layout="block" styleClass="requiredInput" >
            <apex:outputPanel layout="block" styleClass="requiredBlock" />  
               <apex:inputField value="{!savedsearchFields.DefaultValue__c}" style="border:{!nameErr};"/>
            </apex:outputPanel>
          </apex:pageBlockSectionItem>
           
                
       </apex:PageBlocksection> 
       </apex:pageBlock>
       </apex:form>
</apex:page>

 My controller is 

 

public with sharing class testobjfields{

    public SavedSearchField__c savedsearchfields{get;set;} 
    
    public List<SavedSearchField__c> multisavedfields{get;set;} 
    
    public String listObject{get;set;}
    public String fieldname{get;set;}
    
    //CSS error formatting vars
    
     public string nameErr{get;set{this.nameErr=value;}}
    public string visibilityErr{get;set{this.visibilityErr=value;}}
    
    public testObjfields() {   
     
   // initialize the objects for inserts

        savedsearchFields = new SavedSearchField__c();
     
        multisavedfields = new List<SavedSearchField__c>();
        multisavedfields.add(new SavedSearchField__c());        
        
          }
    
        
        
   
    public void addrow(){
        system.debug('Fieldname: ' + savedsearchFields.name);
        multisavedfields.add(savedsearchFields);
        
       }
        
    public PageReference save() { 

        try {
       insert savedSearchFields;
       system.debug('fieldname' + savedsearchfields.fieldname__c);
       system.debug('operator' + savedsearchfields.operator__c);
       /*  for (Integer i = 0 ; i<multisavedfields.size(); i++) {
        multisavedfields[i].SavedSearch__c = selectedsearch.Id;
        system.debug('Field Name' + multisavedfields[i].Name);
         }
         insert multisavedfields;
      
      /*   selectedList.addAll(selectedNames);
         for (Integer i = 0 ; i<selectedList.size(); i++) {
           system.debug('selected' + selectedList[i]);  
           SavedSearchColumn__c savedColumn = new SavedSearchColumn__c();
           savedColumn.name = selectedList[i];
           savedColumn.SequenceNumber__c = i;
           savedColumn.SavedSearch__c = selectedsearch.Id;
           multisavedcolumns.add(savedColumn);       
         }
        insert multisavedcolumns; */
       
        }
        catch(Exception e){
        system.debug('No record inserted');
        
        return null;
        }
        return null;}
    
     
    public List<SelectOption> getObjfields() { 
   
      List<SelectOption>  options = new List<SelectOption>();
       options.add(new SelectOption('','--Select Field --'));
        Map<String, Schema.SobjectField> fields =
        Schema.SobjectType.Location__c.fields.getMap();
        for (String s : fields.keySet()) {
            Schema.SobjectField so = fields.get(s);
            DescribeFieldResult f = so.getDescribe();
            if (s != 'Name') { // name is always displayed       
            options.add(new SelectOption('',f.getlabel())); 
        }
    }
            return options;
 }  
         
 }

 Any help is appreciated. 

 

Thanks.

Kartik

 

 

 

I am batching the data loader to do upserts to five objects, using external IDs that need to be unique so that I can make sure to reference the same salesforce records every time I run the upsert, since each time, some of the records will have some different values.

 

The problem I'm having is that sometimes the records are updated when a match is found that already exists, and sometimes it gives me the error "duplicate value found". It's about a 50/50 split between the outcome that I want and the error messages. In theory, I shouldn't ever get any error messages when I re-run the upsert, since it should just update the records to the new values.

 

Removing the unique restriction on the external ID is not an option for me, as it just defeats the purpose of me using one completely if more than one record can have it.

 

I haven't been able to find anything so far, so any help on this would be greatly appreciated.

Hi All,

 

I need to re-assign Approval to some one else via apex code , when an object is already submitted for approval and status is pending.

 

Any help ?

 

Deepak

 

When developing a Visualforce page for overiding view page for any object, one problem that creeps up is to display the History details of a record. The standard related list Component doesn't works for History.

 

With the help of some code from Community ( I now can't find the link to it :( ), I wrote my own code  then to display the history of an object. It mimics the standard list as far as possible.  

 

Heres the code. It is for the Case object but it can be used for any other object.

 1.Component Code

 

<apex:component controller="CaseHistoriesComponentController">
<!-- Attribute Definition -->
<apex:attribute name="CaseId" description="Salesforce Id of the Case whose Case History needs to be rendered" type="Id" required="true" assignTo="{!caseId}" />

<!-- Case History Related List -->
<apex:pageBlock title="Case History">
<apex:pageBlockTable value="{!histories}" var="History" >
<apex:column headerValue="Date" value="{!History.thedate}"/>
<apex:column headerValue="User"> <apex:outputLink value="/{!History.userId}"> {!History.who} </apex:outputLink></apex:column>
<apex:column headerValue="Action"><apex:outputText escape="false" value="{!History.action}"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:component>

 

 

 

 

2. Apex Code

 

public class CaseHistoriesComponentController {

public Id caseId {get; set;}
public cHistories[] histories;

// Variables
public Static final Map<String, Schema.SObjectField> CaseFieldmap = Schema.SObjectType.Case.fields.getMap();
public Static final List<Schema.PicklistEntry> fieldPicklistValues = CaseHistory.Field.getDescribe().getPicklistValues();

public List<cHistories> getHistories()
{
list<cHistories> histories = new list<cHistories>();
String prevDate = '';
for(CaseHistory cHistory : [Select CreatedDate, CreatedBy.Name, CreatedBy.Id, Field, NewValue, OldValue from CaseHistory where CaseId = :caseId order by CreatedDate desc])
{
if((cHistory.newValue == null && cHistory.oldValue == null)
|| (cHistory.newValue != null && !(string.valueOf(cHistory.newValue).startsWith('005') || string.valueOf(cHistory.newValue).startsWith('00G')))
|| (cHistory.oldValue != null && !(string.valueOf(cHistory.oldValue).startsWith('005') || string.valueOf(cHistory.oldValue).startsWith('00G'))))
{
cHistories tempHistory = new cHistories();
// Set the Date and who performed the action
if(String.valueOf(cHistory.CreatedDate) != prevDate)
{
tempHistory.theDate = String.valueOf(cHistory.CreatedDate);
tempHistory.who = cHistory.CreatedBy.Name;
tempHistory.userId = cHistory.CreatedBy.Id;
}
else
{
tempHistory.theDate = '';
tempHistory.who = '';
tempHistory.userId = cHistory.CreatedBy.Id;
}
prevDate = String.valueOf(cHistory.CreatedDate);

// Get the field label
String fieldLabel = CaseHistoriesComponentController.returnFieldLabel(String.valueOf(cHistory.Field));

// Set the Action value
if (String.valueOf(cHistory.Field) == 'created') { // on Creation
tempHistory.action = 'Created.';
}
else if(cHistory.OldValue != null && cHistory.NewValue == null){ // when deleting a value from a field
// Format the Date and if there's an error, catch it and re
try {
tempHistory.action = 'Deleted ' + Date.valueOf(cHistory.OldValue).format() + ' in <b>' + fieldLabel + '</b>.';
} catch (Exception e){
tempHistory.action = 'Deleted ' + String.valueOf(cHistory.OldValue) + ' in <b>' + fieldLabel + '</b>.';
}
}
else{ // all other scenarios
String fromText = '';
if (cHistory.OldValue != null) {
try {
fromText = ' from ' + Date.valueOf(cHistory.OldValue).format();
} catch (Exception e) {
fromText = ' from ' + String.valueOf(cHistory.OldValue);
}
}

String toText = '';
if (cHistory.OldValue != null) {
try {
toText = Date.valueOf(cHistory.NewValue).format();
} catch (Exception e) {
toText = String.valueOf(cHistory.NewValue);
}
}
if(toText != '')
tempHistory.action = 'Changed <b>' + fieldLabel + '</b>' + fromText + ' to <b>' + toText + '</b>.';
else
tempHistory.action = 'Changed <b>' + fieldLabel;
}

// Add to the list
histories.add(tempHistory);
}
}

return histories;
}

// Function to return Field Label of a Case field given a Field API name
public Static String returnFieldLabel(String fieldName)
{
if(CaseHistoriesComponentController.CaseFieldmap.containsKey(fieldName))
return CaseHistoriesComponentController.CaseFieldmap.get(fieldName).getDescribe().getLabel();
else
{
for(Schema.PicklistEntry pickList : fieldPicklistValues)
{
if(pickList.getValue() == fieldName)
{
if(pickList.getLabel() != null)
return pickList.getLabel();
else
return pickList.getValue();
}
}
}
return '';
}
// Inner Class to store the detail of the case histories
public class cHistories {

public String theDate {get; set;}
public String who {get; set;}
public Id userId {get; set;}
public String action {get; set;}
}
}

  Let me know your views on the code or if you have any questions

 

Hi.

 

I am trying to save a record into a custom object from a picklist that I generated for a list of fields. When i try to click the save action, the picklist is resetting and I am not able to get the value from selected picklist. Please let me know what is that I am doing wrong with the code. 

<apex:page controller="testobjfields">
   <apex:form>
   <apex:pageBlock>
   <apex:commandButton value="Save" action="{!save}" />
   <apex:PageBlockSection columns="3" >     
               
            <apex:pageBlockSectionItem >                  
                <apex:outputPanel layout="block" styleClass="requiredInput" >
                <apex:outputPanel layout="block" styleClass="requiredBlock" />  
                  <apex:SelectList value="{!savedsearchFields.Fieldname__c}" size="1" >
                     <apex:selectOptions value="{!objfields}"></apex:selectOptions>

                  </apex:SelectList>
                </apex:outputPanel>            
             </apex:pageBlockSectionItem>
     
         <apex:pageBlockSectionItem >
            <apex:outputPanel layout="block" styleClass="requiredInput" >
            <apex:outputPanel layout="block" styleClass="requiredBlock" />  
               <apex:inputField value="{!savedsearchFields.Operator__c}" style="border:{!nameErr};"/>
            </apex:outputPanel>
         </apex:pageBlockSectionItem>
       
         <apex:pageBlockSectionItem >
           <apex:outputPanel layout="block" styleClass="requiredInput" >
            <apex:outputPanel layout="block" styleClass="requiredBlock" />  
               <apex:inputField value="{!savedsearchFields.DefaultValue__c}" style="border:{!nameErr};"/>
            </apex:outputPanel>
          </apex:pageBlockSectionItem>
           
                
       </apex:PageBlocksection> 
       </apex:pageBlock>
       </apex:form>
</apex:page>

 My controller is 

 

public with sharing class testobjfields{

    public SavedSearchField__c savedsearchfields{get;set;} 
    
    public List<SavedSearchField__c> multisavedfields{get;set;} 
    
    public String listObject{get;set;}
    public String fieldname{get;set;}
    
    //CSS error formatting vars
    
     public string nameErr{get;set{this.nameErr=value;}}
    public string visibilityErr{get;set{this.visibilityErr=value;}}
    
    public testObjfields() {   
     
   // initialize the objects for inserts

        savedsearchFields = new SavedSearchField__c();
     
        multisavedfields = new List<SavedSearchField__c>();
        multisavedfields.add(new SavedSearchField__c());        
        
          }
    
        
        
   
    public void addrow(){
        system.debug('Fieldname: ' + savedsearchFields.name);
        multisavedfields.add(savedsearchFields);
        
       }
        
    public PageReference save() { 

        try {
       insert savedSearchFields;
       system.debug('fieldname' + savedsearchfields.fieldname__c);
       system.debug('operator' + savedsearchfields.operator__c);
       /*  for (Integer i = 0 ; i<multisavedfields.size(); i++) {
        multisavedfields[i].SavedSearch__c = selectedsearch.Id;
        system.debug('Field Name' + multisavedfields[i].Name);
         }
         insert multisavedfields;
      
      /*   selectedList.addAll(selectedNames);
         for (Integer i = 0 ; i<selectedList.size(); i++) {
           system.debug('selected' + selectedList[i]);  
           SavedSearchColumn__c savedColumn = new SavedSearchColumn__c();
           savedColumn.name = selectedList[i];
           savedColumn.SequenceNumber__c = i;
           savedColumn.SavedSearch__c = selectedsearch.Id;
           multisavedcolumns.add(savedColumn);       
         }
        insert multisavedcolumns; */
       
        }
        catch(Exception e){
        system.debug('No record inserted');
        
        return null;
        }
        return null;}
    
     
    public List<SelectOption> getObjfields() { 
   
      List<SelectOption>  options = new List<SelectOption>();
       options.add(new SelectOption('','--Select Field --'));
        Map<String, Schema.SobjectField> fields =
        Schema.SobjectType.Location__c.fields.getMap();
        for (String s : fields.keySet()) {
            Schema.SobjectField so = fields.get(s);
            DescribeFieldResult f = so.getDescribe();
            if (s != 'Name') { // name is always displayed       
            options.add(new SelectOption('',f.getlabel())); 
        }
    }
            return options;
 }  
         
 }

 Any help is appreciated. 

 

Thanks.

Kartik