• Code+1
  • NEWBIE
  • 115 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 25
    Questions
  • 43
    Replies
I am trying to insert opportunities using data loader. I have mapped all the fields correctly and all my accountid and ownerid are correct. Now when I am inserting, the job is failed and I am getting the error as "insufficient access rights on cross-reference id: 001j000000E7xlw

I have the system administer profile.

Any insights would be appreciated.

Thank you.
Hi All,
 Please let me know the steps what should be done for the below :
1) To send a Webservice Outbound call to another system.
2) Receive the response in XML Format
3) Parse the XML Response
4) Store the values in the system.
  • April 16, 2016
  • Like
  • 0
Hi All,
 I have a string whose value will be like
String a = abc_12345; or
String a= a_1234; or
String a= abcd_23;

In String b = I need to capture the values only after the underscore.
Like b=12345
or b=1234
or b=23
Please let me know how it can be achieved.
 
  • April 16, 2016
  • Like
  • 0
Hi Team,
 I have a custom field on task object.
 Whenever, there is a change in Case custom field, i would like to update the custom field in task.
 Please let me know, to achieve it through trigger ..
  • March 04, 2016
  • Like
  • 0
Hi Team,
 I need help in building test class for the below Apex Class

@RestResource(urlMapping='/Cortx/CancelOrderService/*')
global class CortxCancelOrderService {
   
    @HttpPost
    global static List<WebResponse> cancelOrders(List<OrderDetail> lstOrderDetail) {
   
        Integration_Log__c LogObj = new Integration_Log__c(Request__c = JSON.serialize(lstOrderDetail));
        insert LogObj;
        Set<String> set_OrderIds = new Set<String>();
        LogObj = [Select Id, Name, Response__c from Integration_Log__c WHERE Id=:LogObj.Id];
        try{
            List<WebResponse> Response = new List<WebResponse>();
            List<Order> lst_Order =  new List<Order>();
            Schema.DescribeSObjectResult r = Order.sObjectType.getDescribe();
            String keyPrefix = r.getKeyPrefix();
           
            for(OrderDetail var :  lstOrderDetail){       
                if(var.Order_Id != null && var.Order_Id.startsWith(keyPrefix) && (var.Order_Id.length() == 15 || var.Order_Id.length() == 18)){
                    set_OrderIds.add(var.Order_Id);
                }
            }  
            Map<Id, Order> map_Orders = new Map<Id, Order>([Select Id, Status, Cancel_Reason__c from Order Where Id IN:set_OrderIds]);
            List<Services_and_Equipment__c> lst_SE = [ Select Id, Order__c, Cortx_Service_Id__c from Services_and_Equipment__c WHERE Order__c  != null AND Order__c IN:map_Orders.keySet()];
            Map<Id, List<Services_and_Equipment__c>> map_Order2lstSE = new Map<Id, List<Services_and_Equipment__c>> ();
            for(Services_and_Equipment__c var : lst_SE ){
                if(map_Order2lstSE.containsKey(var.Order__c)){
                    map_Order2lstSE.get(var.order__c).add(var);
                }else{
                    List<Services_and_Equipment__c> lst_tmp = new List<Services_and_Equipment__c>{var};
                    map_Order2lstSE.put(var.order__c, lst_tmp);
                }
            }
            List<Services_and_Equipment__c> lst_SE_ToUpdate = new List<Services_and_Equipment__c>();
            Set<String> OrderIdsToUpdate = new Set<String>();
            for(OrderDetail var :  lstOrderDetail){       
                if(var.Order_Id != null && var.Order_Id.startsWith(keyPrefix)){
                    if(var.Order_Id.length() == 18 && map_Orders.containsKey(var.Order_Id)){
                        // Here We need to put data validation before update the Order status as Cancelled
                       
                       
                        if(var.CancelReason != null){
                            Order Order_Obj = new Order(Id=var.Order_Id, Cancel_Reason__c = var.CancelReason, status='Cancelled');
                            for(Services_and_Equipment__c se_var : map_Order2lstSE.get(var.Order_Id)){
                                se_var.Order__c = null;
                                se_var.Cortx_Service_Id__c = null;
                                lst_SE_ToUpdate.add(se_var);
                            }
                            OrderIdsToUpdate.add(var.Order_Id);
                            lst_Order.add(Order_Obj);
                        }else{
                            WebResponse Response_Obj = new WebResponse();
                            Response_Obj.Order_Id = var.Order_Id;
                            String ErrorMsg = 'CancelReaon is mandatory to cancel Order "'+ var.Order_Id ;
                            Response_Obj.Status = 'Failure';
                            Response_Obj.StatusDescription = ErrorMsg;
                            Response.add(Response_Obj);
                        }                    
                    }else{
                        WebResponse Response_Obj = new WebResponse();
                        Response_Obj.Order_Id = var.Order_Id;
                        String ErrorMsg = 'Order Record with Id "'+ var.Order_Id +'" not found in System';
                        Response_Obj.Status = 'Failure';
                        Response_Obj.StatusDescription = ErrorMsg;
                        Response.add(Response_Obj);
                    }
                }else{
                    WebResponse Response_Obj = new WebResponse();
                    Response_Obj.Order_Id = var.Order_Id;
                    String ErrorMsg = 'Order_Id field can not be null';
                    Response_Obj.Status = 'Failure';
                    Response_Obj.StatusDescription = ErrorMsg;
                    Response.add(Response_Obj);
                }
            }
            Database.SaveResult[] SR_OrderUpdate = Database.update(lst_Order, false);    
            Database.SaveResult[] SR_SE_Update = Database.update(lst_SE_ToUpdate, false);    
           
            for (Database.SaveResult sr : SR_OrderUpdate ) {
                WebResponse Response_Obj = new WebResponse();
                if (sr.isSuccess()) {
                    Response_Obj.Order_Id = sr.getId();
                    Response_Obj.Status = 'Success';
                    Response_Obj.StatusDescription = 'Order cancelled successfully. SFDC log number - '+ LogObj.Name;
                }
                else {                       
                    Response_Obj.Order_Id = sr.getId();
                    String ErrorMsg = 'The following error has occurred.';              
                    for(Database.Error err : sr.getErrors()) {
                        ErrorMsg = ErrorMsg +' '+ err.getStatusCode() + ': ' + err.getMessage();
                    }
                    Response_Obj.Status = 'Failure';
                    Response_Obj.StatusDescription = ErrorMsg + ' SFDC log number - '+ LogObj.Name;
                }
                Response.add(Response_Obj);
            }      
            LogObj.Response__c = JSON.serialize(Response);
            LogObj.Is_Success__c = true;
            update LogObj;
            System.debug('--------WebResponse---- '+ Response);
            return Response;
        }catch(Exception ex){
            WebResponse ExceptionResponse_Obj = new WebResponse();
            ExceptionResponse_Obj.Status = 'Failure';
            ExceptionResponse_Obj.StatusDescription = ex.getMessage();
            LogObj.Response__c = JSON.serialize(ExceptionResponse_Obj);
            LogObj.Is_Success__c = false;
            update LogObj;
            System.debug('--------WebResponse---- '+ ExceptionResponse_Obj);
            return new List<WebResponse>{ExceptionResponse_Obj};
        }
    }

    global class OrderDetail{
        global String Order_Id;          // SFDC Order Id 18 digit
        global String CancelReason;
        global OrderDetail(){}
    }
    global class WebResponse{
        global String Order_Id{get;set;}     // SFDC Order Id 18 digit
        global String Status{get;set;}             // Success or Failure
        global String StatusDescription{get;set;}  // Detail of Failure, In case of success it will have default value “Record Updated Successfully”
    }

}

 
  • February 12, 2016
  • Like
  • 0
Hi All,
 I would like to develop a vf page, which displays three columns from one object. 

 Field Name | Help Text | Description . This help text and description are entered while creating the fields.

 I would like to capture these above mentioned details in a visualforce page.
 Kindly help. I tried the below code and it does not suit my requirement

 <apex:page standardController="Account">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection > 
    <apex:pageBlockSectionItem >
        <apex:outputLabel value="{!$ObjectType.Account.Fields.Active__c.inlineHelpText}"/>
        <apex:inputField value="{!Account.Active__c}"/>
    </apex:pageBlockSectionItem>
</apex:pageBlockSection> 
</apex:pageBlock>
</apex:form>
</apex:page>
  • December 08, 2015
  • Like
  • 0
Hi Team,

 I have a requirement, where i need to populate all the related contacts in Account Object Detail Page with comma seperated.
 For Example :
  If I have Account1 and Contact1 and Contact2 are related to Account1.
  Then, in account object detail page, i have a text box named "Related Contacts" which will display Contact1, Contact2.

 Below is the trigger for that --
 trigger totalContacts on Contact (after insert,after update) {
    Set<ID> setAccountIDs = new Set<ID>();
    for(Contact c : Trigger.new){
        setAccountIDs.add(c.AccountId);
    }
  
    List<Account> accounts = [Select ID, Name,(Select Name From Contacts)  From Account WHERE ID IN :setAccountIDs];
    for(Account a : accounts){
        String contactName = '';
        for(Contact c : a.Contacts){
            contactName +=c.Name+ ' ,';                      
        }
        a.Associated_Contacts__c =contactName;
    }
    update accounts;
  
}

I wrote the below test class and it covers only 60%, please guide me to cover 100% of the code

@isTest 
public class testtotalContacts{
    static testMethod void insertnewContact(){
       
    Account accountToCreate = new Account();
    accountToCreate.Name = 'Test Account';
    accountToCreate.AW_Expiration_date__c = System.today();
    insert accountToCreate;
 
    Contact contactToCreate1 = new Contact();
    contactToCreate1.FirstName = 'Test 1';
    contactToCreate1.LastName = 'Trigger test class 1';
    contactToCreate1.Email = 'krishnakumar1@gmail.com';
    contactToCreate1.Account = accountToCreate;
    insert contactToCreate1;
    
    Contact contactToCreate2 = new Contact();
    contactToCreate2.FirstName = 'Test 2';
    contactToCreate2.LastName = 'Trigger test class 2';
    contactToCreate2.Email = 'krishnakumar@gmail.com 2';
    contactToCreate2.Account = accountToCreate;
    insert contactToCreate2;
    
        
    }
}
  • December 02, 2015
  • Like
  • 0
Hi All,

 I have a requirement, wherein the user will click on a hyperlink.
 Then on clicking of the hyperlink, it should open a shared folder.
 Datatype of the hyperlink is URL and the data will be like C:\Users

 Please let me know a.s.a.p

Thanks ..
  • November 02, 2015
  • Like
  • 0
Hello All,

 I have a requirement to update the mobile number of Salesforce User.
 I created a user 'XXXX' with the mobile number 12345
 Then, when i try to edit / Change the mobile number of user 'XXXX' with 9999. It is not getting recognized and updated.
 Please guide if there is something needs to be done...

Thanks !

 
  • October 14, 2015
  • Like
  • 0

Hi thisisnotapril,

Please delete this post -
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BULtIAO 
It would be very helpful.
Kindly update me once deleted.

Thanks !
  • September 16, 2015
  • Like
  • 0
Hello All,
 I have a requirement to upload an attachment through Visual Force Page.
 Attachment should reside in Custom Object.
 
 On creation of record, user will fill some details and upload attachment from local machine.
 Details and Attachment should be captured as record in custom object.
 Please let me know for any sample code.

Thanks !
  • September 14, 2015
  • Like
  • 0
Hello All,
This is an email service class.. 
 Please find my test class below. Kindly help me in writing the test class for this.
 
 Email Service Class

Thank You !!
  • August 24, 2015
  • Like
  • 0
Hello All,

I need to upload files whose sizes are more than 5 MB.
I am planning to achieve it by using JavaScript, Pls share me with the sample code snippet of VF Page and Controller


Thanks !
  • August 18, 2015
  • Like
  • 0
Hello All,

 On Checkbox field check, I need to display a Date Field and File Upload section.
 When the checkbox is unchecked, i need to remove the Date Field and File Upload Section..

 I have written the below code, which works perfectly when the checkbox is checked.
 When I uncheck the checkbos, it throws the error - "Visualforce Error Help for this Page
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute."

VF Page
<apex:page standardController="Associate__c" extensions="AttachmentUploadController">
<apex:form >

<apex:pageBlock id="tBlock">  
   <apex:outputLabel value="Active" />  
  
   <apex:inputField value="{!Associate__c.Active__c}">  
      <apex:actionSupport event="onchange" rerender="tBlock"/>  
   </apex:inputField>  

   <br></br>
 Date of Joining <apex:inputField value="{!Associate__c.DOJ__c}" rendered="{!(Associate__c.Active__c == true)}"/>  
     <br></br>
     
     <apex:actionregion >
 <apex:outputLabel value="File" for="file"/>
 <apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file" rendered="{!(Associate__c.Active__c == true)}"/>  
 </apex:actionregion>
     
</apex:pageBlock>  

Apex Class

public with sharing class AttachmentUploadController {

    public AttachmentUploadController(ApexPages.StandardController controller) {

    }


public Attachment attachment {
  get {
      if (attachment == null)
        attachment = new Attachment();
      return attachment;
    }
  set;
  }

  public PageReference upload() {

    attachment.OwnerId = UserInfo.getUserId();
//    attachment.ParentId = '00190000015ZVLm'; // the record the file is attached to
    attachment.ParentId = ApexPages.currentPage().getParameters().get('id'); 
    attachment.IsPrivate = true;

    try {
      insert attachment;
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
      return null;
    } finally {
      attachment = new Attachment(); 
    }

    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
    return null;
  }

}


Please help.. 
Thanks!
Hello All,
 
 I would like to get a sample code to identify "How many times a Visual force page has been opened / hit " by the user.
 Please guide me with the code (Visualforce remoting way / apex:variable way / best possible solution) which we can propose to customer.
 
Thanks !

 
Hello All,

 I am capturing the Record ID in a custom text field using a trigger.
 I would like to remove last three digits from the Record ID captured in the field.

 Please find the trigger below.
 
trigger captureID on Multi__c (before update) {
    for( Multi__c mul : Trigger.new){
        mul.Capture_Record_ID__c = mul.id;
    }
}

For the Record - "a0f9000000AHZCr"
Value captured in mul.Capture_Record_ID__c = "a0f9000000AHZCrAAP"

I need to remove AAP from this field.
Please let me know how i should do.

Thanks !

 
Hello All,

 I would like to do an hands on with a working solution using SOAP API and REST API.
 Simple practical scenario for SOAP and REST will help with example.
 Could you please provide me with a best source code sample to learn with and explore this integration stuff.

Thanks !!
 
Hello All,

 After save of the record, I would like to redirect my Visual force page to custom object created..
 Save is happening ... But the page is not getting redirected to the custom object...
 I am using the below code

 PageReference reference=new PageReference('https://cs18.salesforce.com/a0U/o');
 reference.setRedirect(true);
 return reference;
 

Below is the Full Code ..
VF Page - 
<apex:page standardcontroller="BIA__c" extensions="BIAcontroller" sidebar="false"> 
<apex:messages style="color:blue"></apex:messages>
    <apex:form id="theform">
   
    <apex:pageblock mode="edit">
    <apex:pageBlockSection title="Business Impact Analysis Information">

          <apex:inputField id="opportunityName" value="{!account.name}" />
          <apex:inputField id="opportunityName1" value="{!account.Date_of_BIA_Meeting__c}"/>
          <apex:inputField id="opportunityName2" value="{!account.Manager__c}"/>
          <apex:inputField id="opportunityName3" value="{!account.Department_BC_Coordinator__c}"/>
          <apex:inputField id="opportunityName4" value="{!account.Backup_BC_Coordinator__c}"/>
          <apex:inputField id="opportunityName5" value="{!account.Custodian__c}"/>
          <apex:inputField id="opportunityName6" value="{!account.Prepared_by__c}"/>
          <apex:inputField id="opportunityName7" value="{!account.Endorsed_by__c}"/>
          <apex:inputField id="opportunityName8" value="{!account.Approved_by__c}"/>
      </apex:pageBlockSection>
                <apex:pageblockSection title="Team Search" >
                   <apex:inputfield value="{!objAct.CoE__c}" />
                   <apex:inputfield value="{!objAct.Department__c}" />
                   <apex:inputfield value="{!objAct.OpCo__c }" />
                </apex:pageblockSection>

                <center>    <apex:commandButton value="Search" action="{!search}" rerender="theform" /> </center>
                
            </apex:pageblock>
            <apex:pageBlock >
                <apex:pageBlockButtons >
                  <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table" /> 
                </apex:pageBlockButtons>
                <apex:pageBlockTable value="{!MSAWrapperList}" var="obj" id="table">
                     <apex:column >
                        <apex:inputCheckbox value="{!obj.selected}"/>
                    </apex:column>
                    <apex:column value="{!obj.msaObj.Name}" />
                </apex:pageBlockTable>
           </apex:pageBlock>
            
    </apex:form>
</apex:page>

Controller --
public class BIAcontroller
    {

    public BIAcontroller(ApexPages.StandardController controller) {
        account=new BIA__c();
        bia=new BIA__c();
    //contact=new SOC__c();
    opportunity=new Team__c();
    records=new List<Team__c>();
    objAct=new Team__c();
    msawrapperlist=new List<MSAWrapper>();
    }


        public BIA__c account{set;get;}
        public BIA__c bia{get;set;}
        //public SOC__c contact{set;get;}
       public Team__c opportunity{set;get;}
            
        public List<Team__c> records{get;set;}
        public Team__c objAct{get;set;}
        public List<MSAWrapper> MSAWrapperList {get; set;}
                  
       public     List<Team__c > selectedMSA = new List<Team__c >();
       public     List<Team__c > TeamssToUpdate = new List<Team__c >{};
        
 
        
        public BIA__c getAccount() {
        if(account == null) account = new BIA__c ();
        return account;
        }
        
    
        
        
        public pagereference search()
        {
            MSAWrapperList.clear();
            records=[Select ID,Name,CoE__c,BIA__c,Department__c,OpCo__c from Team__c where CoE__c=: objAct.CoE__c and Department__c=: objAct.Department__c];
            for(Team__c obj : records)
            {
                MSAWrapperList.add( new MSAWrapper(obj) );
            }
           return null;
        }

        public PageReference processSelected() 
        {
        
          account.Name = account.Name;
          account.Date_of_BIA_Meeting__c= account.Date_of_BIA_Meeting__c;
          account.Manager__c= account.Manager__c;
          account.Department_BC_Coordinator__c= account.Department_BC_Coordinator__c;
          account.Backup_BC_Coordinator__c= account.Backup_BC_Coordinator__c;
          account.Custodian__c= account.Custodian__c;
          account.Prepared_by__c= account.Prepared_by__c;
          account.Endorsed_by__c= account.Endorsed_by__c;
          account.Approved_by__c= account.Approved_by__c;

          insert account;

            for(MSAWrapper cCon: MSAWrapperList ) 
            {
                if(cCon.selected == true) 
                {
                    selectedMSA.add(cCon.msaObj);
                }
            }
            for(Team__c msa: selectedMSA) 
            {
                    system.debug(msa);
                    msa.BIA__c= account.id;
                    TeamssToUpdate.add(msa);
            }
            update TeamssToUpdate;
       //     return null;
            
            system.debug('11111');
            PageReference reference=new PageReference('https://cs18.salesforce.com/a0U/o');
                    system.debug('22222');
        reference.setRedirect(true);
        system.debug('33333');
        return reference;
        }

        
        
        public class MSAWrapper 
        {
            public Team__c msaObj {get; set;}
            public Boolean selected {get; set;}
            public MSAWrapper(Team__c c) {
                msaObj = c;
                selected = false;
            }
        }
        
       
         
    }


Please help..


Thanks..
Hello All,

I have two custom objects Project__c and Task__c.
Task__c is having a lookup to Project__c object.
When New tasks are created and tasks are assigned to Task Executioner(Email Field)...  via workflow alert, we are sending mails to Task Executioner.
So this, if 10 tasks are created --- It triggers 10 email alerts.
Client needs only one consolidated mail to be sent.

Please let me know if there are any solution to this..
I have created a vf template and facing issues...

Thanks ! 
 
Hello All,

 I am trying to pass the Input field value from Visualforce page to apex controller class.
 Please let me know how to capture the value.

 Below is the code.

<apex:page standardController="Activity_Tracker__c" extensions="dependentPicklistController"> 
  <apex:messages style="color:red"></apex:messages>
    <apex:form >
        <apex:pageblock >
            <apex:pageblockSection >
               <apex:inputField value="{!Activity_Tracker__c.Category__c}" />
               <apex:inputField value="{!Activity_Tracker__c.Sub_Customers__c}" />
            </apex:pageblockSection>
        </apex:pageblock>
        

         <apex:commandButton action="{!search}" value="search"/>
         <apex:pageBlock >
         <apex:pageBlockTable value="{!records}" var="item">
                <apex:column value="{!item.Category__c}"/>
                <apex:column value="{!item.Sub_Customers__c}"/>
                <apex:column value="{!item.Status__c }"/>
           </apex:pageBlockTable>
         </apex:pageBlock>
    </apex:form>
</apex:page>


Controller --
public with sharing class dependentPicklistController{
    public List<Activity_Tracker__c> records{get;set;}
    public Activity_Tracker__c  Category__c{get; set;}
 
    public pagereference search()
    {
       records=[Select ID, Category__c, Sub_Customers__c, Status__c From Activity_Tracker__c   ];
       system.debug('11111' +Query);
       return null;
    }
}

In this I am trying to capture Category__c, Sub_Customers__c (Dependent Picklists) in the Apex Class.

Thanks... 
Hi Team,
 I have a custom field on task object.
 Whenever, there is a change in Case custom field, i would like to update the custom field in task.
 Please let me know, to achieve it through trigger ..
  • March 04, 2016
  • Like
  • 0
Hi All,

 I have a requirement, wherein the user will click on a hyperlink.
 Then on clicking of the hyperlink, it should open a shared folder.
 Datatype of the hyperlink is URL and the data will be like C:\Users

 Please let me know a.s.a.p

Thanks ..
  • November 02, 2015
  • Like
  • 0
Hi
Pls provide a basic example to start with soap api.
actually I need to execute it on my terminal & see the result.
I am not familiar with web services but yes I will brush up ​​​on that.
I request the people to be elaborate while replying.
a) In what type of scenario we use soap api
b) advantages and disadvantages of soap api compared to other api's.
c) what errors occur when we use soap api and how to resolve


sonali verma
​Hi all
I have 2 departments. hr_dept and finance_dept. User_A from hr_dept wants to share records to user_B   of finance dept.
How to do this?

I know in profiles for hr_dept object should have VIEW all permission.​ so user_A belonging to hr_dept object can share records.
Pls correct my understanding if wrong and if I am missing anything concrete pls do let me know

sonali verma​
Hello All,

 I have a requirement to update the mobile number of Salesforce User.
 I created a user 'XXXX' with the mobile number 12345
 Then, when i try to edit / Change the mobile number of user 'XXXX' with 9999. It is not getting recognized and updated.
 Please guide if there is something needs to be done...

Thanks !

 
  • October 14, 2015
  • Like
  • 0
Hello All,
 I have a requirement to upload an attachment through Visual Force Page.
 Attachment should reside in Custom Object.
 
 On creation of record, user will fill some details and upload attachment from local machine.
 Details and Attachment should be captured as record in custom object.
 Please let me know for any sample code.

Thanks !
  • September 14, 2015
  • Like
  • 0
HI ,

I need to delete the post in the community , could anyone help me.

this is the link

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BVjIIAW

Thanks in advance
Hello,

When i try to test email sending for Emauil templates, i never receive any email,
I laos include a record id in the email.

How can i test
  • August 31, 2015
  • Like
  • 0
Hello All,
This is an email service class.. 
 Please find my test class below. Kindly help me in writing the test class for this.
 
 Email Service Class

Thank You !!
  • August 24, 2015
  • Like
  • 0
Hello All,

 On Checkbox field check, I need to display a Date Field and File Upload section.
 When the checkbox is unchecked, i need to remove the Date Field and File Upload Section..

 I have written the below code, which works perfectly when the checkbox is checked.
 When I uncheck the checkbos, it throws the error - "Visualforce Error Help for this Page
apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute."

VF Page
<apex:page standardController="Associate__c" extensions="AttachmentUploadController">
<apex:form >

<apex:pageBlock id="tBlock">  
   <apex:outputLabel value="Active" />  
  
   <apex:inputField value="{!Associate__c.Active__c}">  
      <apex:actionSupport event="onchange" rerender="tBlock"/>  
   </apex:inputField>  

   <br></br>
 Date of Joining <apex:inputField value="{!Associate__c.DOJ__c}" rendered="{!(Associate__c.Active__c == true)}"/>  
     <br></br>
     
     <apex:actionregion >
 <apex:outputLabel value="File" for="file"/>
 <apex:inputFile value="{!attachment.body}" filename="{!attachment.name}" id="file" rendered="{!(Associate__c.Active__c == true)}"/>  
 </apex:actionregion>
     
</apex:pageBlock>  

Apex Class

public with sharing class AttachmentUploadController {

    public AttachmentUploadController(ApexPages.StandardController controller) {

    }


public Attachment attachment {
  get {
      if (attachment == null)
        attachment = new Attachment();
      return attachment;
    }
  set;
  }

  public PageReference upload() {

    attachment.OwnerId = UserInfo.getUserId();
//    attachment.ParentId = '00190000015ZVLm'; // the record the file is attached to
    attachment.ParentId = ApexPages.currentPage().getParameters().get('id'); 
    attachment.IsPrivate = true;

    try {
      insert attachment;
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
      return null;
    } finally {
      attachment = new Attachment(); 
    }

    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
    return null;
  }

}


Please help.. 
Thanks!

Hi,

 

Can anyone tell me where to find some quality documention on parsing XML with apex. I have no experience in parsing XML, so some detailed walkthrough's would be very helpful.

 

Thanks!

  • March 13, 2013
  • Like
  • 0