• Shailendra Singh Parmar
  • NEWBIE
  • 255 Points
  • Member since 2015
  • Senior Consultant
  • Appirio


  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 78
    Replies
I am doing a task where i want to store a logo on a visualforce page. in this i can choose one of the image from storage space and will display it as a logo. While doing this task we need to keep in mind that we can't directly display image in visualforce page in salesforce. It should be stored at some place like in document folder in our salesforce organization. i am stuck with this code i am getting error at  this line in visualforce page <apex:inputFile value="{!Document.body}" filename="{!Document.name}" />  . here i m getting error in String.name.. plz help me to solve this


public class showimage {

    public String document { get; set; }

    public showimage() {

   
    }
 public boolean showimage{set;get;}  
        public final document t;  
   private ApexPages.StandardController stdcontroller;  
   public showimage(ApexPages.StandardController stdcontroller) {  
   t = (Document) stdcontroller.getRecord();  
     t.folderid = UserInfo.getUserId(); //this saves record in My Personal Documents  
     this.stdcontroller=stdcontroller;  
     }    
  public pagereference save(){  
   this.stdcontroller.save();// this method implements the standard save method.  
   pagereference pg=new pagereference('/apex/vfpageimageupload');  
   showimage=true;  
   return pg;  
   }   
   List<document> d;  
   public id doc{set;}  
   public id getdoc()  
   {  
   d=[select id from document order by id desc limit 1]; //gets id of document inserted last in sobject  
   return d[0].id;// returns id value of list d  
   }   
   
}



VF page:

<apex:page controller="showimage">
<apex:form>
<apex:pageBlock>
 <apex:pageBlockSection title="Upload Photo" collapsible="false" columns="1" >  
 <apex:image url="https://c.ap1.content.force.com/servlet/servlet.FileDownload?file={!doc}" height="100"    
    width="100" rendered="{!showimage}" /> /*contains the url of documents,{!doc} gives the image dynamically */  
  <apex:inputFile value="{!Document.body}" filename="{!Document.name}" />  
 <center><apex:commandButton value="Upload" action="{!save}" /></center>  
  </apex:pageBlockSection> 
  </apex:pageBlock>
  </apex:form> 
</apex:page>
Hi
In Account object, therre is a duplicate management rule for account name. We override the edit page of account. The problem is  when the user try to create a duplicate record it throwing the error like "Update failed. First exception on row 0 with id 001Q0000010c9osIAA; first error: DUPLICATES_DETECTED, You may be creating a duplicate record. If so, we recommend you use the existing record instead.: []
Error is in expression '{!CustomSave}' in component <apex:commandButton> in page customsavepage: Class.CustomControllerSaveofAccount.CustomSave: line 21, column 1".
But i wan to show like this
User-added image
Can anyone help me out to solve this issue.
Can anyone tellme why this below changes happening. If i create a datetime instance with date 2016-06-16 and time 12:00 then the debug shows different datetime like i have mentioned below. Thanks in advance.

Datetime dTime1 = Datetime.newInstance(2016, 06, 16, 12, 00, 00);   2016-06-16 12:00:00
Datetime dTime2 = Datetime.newInstance(2016, 06, 16, 1, 00, 00);     2016-06-16 01:00:00
system.debug('dTime1  '+dTime1);
system.debug('dTime2  '+dTime2);

|DEBUG| dTime1 -->  2016-06-16 06:30:00
|DEBUG| dTime2 -->  2016-06-15 19:30:00
Hi,
I need to override the "Opportunity Product Multi-Line Layout" page(Shown Below) with custom VisualForce Page. 
Product Multi Line Layout

For this I need to Add a new custom button(New Button) on the "Product Selection" page layout and Hide the existing Select Button on the Layout.
Product Selection Page

The Challenge is , I'm not getting from where to create a new Custom Button (New Button) to add on the Product Selection Page and how can I Hide the Existing Select Button from this page.

Or do I have to Override the "Product Selection" Page with a new Custom VF Page as well?

How Can I achieve this?

Any help on this would be appreciated.

Thanks,
Sagar
Hello All,

My query is ::
select id , name from account where name IN : NameList AND email IN : EmailList

Scenario ::
I am inserting data via dataloader with below details.
Name 1   xxx@yyy.com
Name 2   sss@rrr.com
Name 3   fff@uuu.com

I am trying to check in system on account object before insert whether any account record exists with the name and email combination.
Let me know whether two IN parameters as list in where clause will look for the data in the combination i gave ?
Ex :: Name 1 with only xxx@yyy.com and not with sss@rrr.com & fff@uuu.com

Thanks
User-added image

When i click on the preview button the id of the associated record id should get passed to the controller. Its urgent
Hi, 

Can somebody help me with the logic on the following: 

Account List name is existing, but the ownerid is not existing (Different user)  -> insert ok
Account List name is not existing, but owner id is existing in db - insert ok 

Account List name is existing, owner id is existing (Avoid duplicate record with the same Account List name with the same owner)  -> No insert

Basically, I just want to prevent the record to be inserted if the account list name is duplicate and also the same owner, but if the account list has a match in the database, but it's owner is different, it's should be inserted.


Here is my current code: 
 
public with sharing class InsertAccountListRec_TEST_cls {
    
    List<User> usersIdList;
    Set<Id> usersIdSet = new Set<Id>();
    Set<Id> AffFromAcctSet = new Set<Id>();
    Set<Id> xAcctListOidSet = new Set<Id>();
    Set<String> xAcctListNameSet = new Set<String>();
    List<Affiliation_vod__c> allAffParentRecs = new List<Affiliation_vod__c>();
    List<Account_List_vod__c> newAccListRecList = new List <Account_List_vod__c>();
    List<Account_List_vod__c> xAcctListRecs = new List <Account_List_vod__c>();
    List<Account_List_vod__c> InsertedAccList = new List <Account_List_vod__c>();
    
    
    
    //Creation a list of all Parent Affiliation Records, then add to allParentRecsSet (SET).
    //Start of 1st Block
    public InsertAccountListRec_TEST_cls(){
        allAffParentRecs = new List<Affiliation_vod__c>([SELECT Id, OwnerId, From_Account_vod__c, From_Account_Value__c, To_Account_vod__c
                                                         FROM Affiliation_vod__c
                                                         WHERE (From_Account_vod__r.Id = '0011200001GNrb0AAD' 
                                                         AND Parent_vod__c = True)
                                                         AND OwnerId IN: getActiveUsers()]);
        
        System.debug('Parent Affiliation Record Count '+ allAffParentRecs.size());
        
        
        for(Account_List_vod__c xAcctListRecs  : [Select OwnerId, Name FROM Account_List_vod__c 
                                                  WHERE Name LIKE 'HO_%'
                                                  AND OwnerId IN: getActiveUsers()]){
                                                                      xAcctListOidSet.add(xAcctListRecs.OwnerId);
                                                      				  xAcctListNameSet.add(xAcctListRecs.Name);
                                                                  }
        
        System.debug('Account List Record Count '+ xAcctListRecs);
        
        for(Affiliation_vod__c allParentAffRecs: allAffParentRecs){
            if(!AffFromAcctSet.contains(allParentAffRecs.From_Account_vod__c)){
                Account_List_vod__c AccListRec = new Account_List_vod__c();    
                AccListRec.Name = 'HO_' + allParentAffRecs.From_Account_Value__c; 
                AccListRec.Icon_Name_vod__c = '0';	
                AccListRec.OwnerId = allParentAffRecs.OwnerId;
                AffFromAcctSet.add(allParentAffRecs.From_Account_vod__c);
                newAccListRecList.add(AccListRec); 
            }
        }
               
         for(Account_List_vod__c acctListToCreate : newAccListRecList){
             if(xAcctListNameSet.contains(acctListToCreate.Name) && !xAcctListOidSet.contains(acctListToCreate.OwnerId)){
                       InsertedAccList.add(acctListToCreate);
             }     
         }	
               
               insert InsertedAccList ;
               System.debug('New Account List Records: ' + InsertedAccList);
	}//end of 1st block
    
    
    public Set<Id> getActiveUsers(){
    
            usersIdList = new List<User>([SELECT Id
                                     FROM User
                                     WHERE (Profile_Name_vod__c LIKE '%Eisai_Epilepsy%' 
                                     OR Profile_Name_vod__c LIKE '%Eisai_PrimaryCare%') 
                                     AND IsActive = TRUE]); 
        
            for(User users : usersIdList){
                    usersIdSet.add(users.Id);  
            }
        return usersIdSet;
    }
}// End of Class
The logic which is not working is in line 47 to 51

Thanks for the help..
 
<apex:page controller="tt">
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:pageBlockTable value="{!wrapper}" var="wrap">
                <apex:column headerValue="Account Name" value="{!wrap.accRec.Name}"/>
                <!-- you can add related fields here   -->
                <apex:column headerValue="Contact Name" value="{!wrap.conRec.Name}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>



Controller:

public class tt
{
    public List<Account> accLst {get; set;}
    public List<Contact> conLst {get; set;}
    public List<MyWrapper> wrapper {get; set;}

    public tt()
    {
        accLst = [select id,name from account   ] ;
        conLst = [select id,name from contact   ] ;
        wrapper = new List<MyWrapper>() ;
        for(Integer i=0 ;i<20;i++)
            wrapper.add(new MyWrapper(accLst[i] , conLst[i])) ;
    }
    
    public class MyWrapper
    {
        public Account accRec {get; set;}
        public Contact conRec {get; set;}
        
        public MyWrapper(Account acc , Contact con)
        {
            accRec = acc ;
            conRec = con ;
        }
    }
}
Hi,
  I am new to Salesforce and it would be great, if community can give me some idea to create FAQs. Do I have to treat FAQ as knowledge article and proceed to create custom object for the same?
Hi there, currently struggling with this slight problem:

I have created a custom object called "List", with a child custom object nested within that called "Person Accounts" (the name field is set to be an auto number on that one). Other than the master-detail relationship it has to "List" it also has a master detail relationship to Accounts (with a filter to limit it to person accounts only), enabling me to add person accounts to specific lists.
I now want to create a custom button that should sit on the account view that enables me o bulk add several people to a list of my choosing. Is that possible? 
Hi everyone,

I would like to create a web form to feed the contact standard object and a couple of custom objects.

I've been looking everywhere and all I can find is how to build an App, which is not what I want. 

Can anyone direct me to a tutorial that shows me how to do that?

All I really need is to understand how to create a new page based on the Contacts object.

Thanks
Nitzan
Hi,

I need to refresh the whole VF Page once my delete method executes. I have wriiten the below code. When I delete a particular record, the record is getting deleted but the page is not refreshing to show the updated records. Please help. 

VF Page:

<apex:page controller="viewdept_con" showHeader="false " id="mypage">
 <apex:form >
  <apex:pageBlock >
   <apex:pageblockTable value="{!deptlist}" var="item"> 
     <apex:column headerValue="Action">
     <apex:commandLink value="Detail" action="{!deptdetail}"/><b> | </b>
     <apex:commandLink value="Del" action="{!deptdelete}" reRender="mypage">
     <apex:param name="deptid" value="{!item.id}" assignTo="{!deptid}"/>
     </apex:commandlink>
     </apex:column>
     <apex:column value="{!item.name}"/>
   </apex:pageblockTable>
  </apex:pageBlock>
 </apex:form>
</apex:page>

Controller:

public class viewdept_con {

   public list<department__c> deptlist { get; set; }
   public id deptid {get; set;}
   public department__c dept {get; set;}
   
   public viewdept_con()
   {
   deptlist = [select id, name from department__c];
   }
   
   public pagereference deptdetail()
   {
     pagereference pg = new pagereference('/apex/DepartmentDetail?deptid=' + deptid);
     return pg;
   }
   
   public pagereference deptdelete()
   {
     dept = [select id, name from department__c where id = :deptid];
     delete dept;
     return null;
   }
}

Thank you,
Satya