• naga kiran 2
  • NEWBIE
  • 8 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
I am trying to insert 11 attachments through a single insert button in a custom object through VF page but getting view state error.

Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 146.86KB


<apex:page controller="GLADDDExtPortalCC"  sidebar="false">
 <apex:pagemessages />
 <apex:sectionHeader title="Questionnaire" subtitle="Step 8 of 8"/>
  <APEX:form >
   <apex:pageBlock mode="edit">
    <apex:pageBlockButtons >
     <apex:commandButton value="Previous" action="{! step6}" style="background:#0070d2 !important; width:100px; color:white; padding: 5px;"/>
     <apex:commandButton value="Save" action="{! save}" style="background:#0070d2 !important; width:100px; color:white; padding: 5px;"/>
     <apex:commandButton value="Save and Next" action="{! step7}" style="background:#0070d2 !important; width:100px; color:white; padding: 5px;"/>
      </apex:pageBlockButtons>
       <apex:pageBlockSection title="References" columns="1">
     <body>
            <h1><u>GLADDD: Submission Document Checklist</u></h1>
        <br></br>
        <br></br> 
            <h1><u>Mandatory</u></h1>
        <br></br>
            <input type="checkbox"> GTS-BIS711
            </input>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="File" for="file"/>
            <apex:inputFile value="{! attachBis711.body}" filename="{! attachBis711.name}" id="file" accept=".pdf"/>
            
            </apex:pageBlockSectionItem>
            <!-- <apex:commandButton value="Upload Required Documents" action="{! upload}"/> -->

        <br></br>
            <input type="checkbox"> CMP-Certification of Complaince
            </input>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="File" for="file"/>
            <apex:inputFile value="{! attachCertComp.body}" filename="{! attachCertComp.name}" id="file1" accept=".pdf"/>
                        </apex:pageBlockSectionItem>
            <!-- <apex:commandButton value="Upload Required Documents" action="{! upload}"/> -->


        <br></br>
             <input type="checkbox"> FN_DD Certification
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachDDcerti.body}" filename="{! attachDDcerti.name}" id="file2" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

        <br></br>
        <br></br>
             <h1><u>If Yes selected(A/D Questionnaire)</u></h1>
         <br></br>
             <input type="checkbox"> CMP-Anti-Corruption Policy
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachAntiCorr.body}" filename="{! attachAntiCorr.name}" id="file3" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

         <br></br>
             <input type="checkbox"> CMP-Code of Conduct
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachCodeCond.body}" filename="{! attachCodeCond.name}" id="file4" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

         <br></br>
         <br></br>
              <h1><u>Non Mandatory</u></h1>
         <br></br>
             <input type="checkbox"> FN-Tax License
             </input>
             <apex:pageBlockSectionItem >
            <apex:outputLabel value="File" for="file"/>
            <apex:inputFile value="{! attachTaxLicen.body}" filename="{! attachTaxLicen.name}" id="file5" accept=".pdf"/>
            </apex:pageBlockSectionItem>
            <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

         <br></br>
             <input type="checkbox"> FN-Bank Statement(Bank Reference Letter)
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachBankState.body}" filename="{! attachBankState.name}" id="file6" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

         <br></br>
             <input type="checkbox"> FN-Medical Device Business Permit
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachMedicalDe.body}" filename="{! attachMedicalDe.name}" id="file7" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

         <br></br>
            <input type="checkbox"> FN-Company Registration Certificate
            </input>
            <apex:pageBlockSectionItem >
            <apex:outputLabel value="File" for="file"/>
            <apex:inputFile value="{! attachCompReg.body}" filename="{! attachCompReg.name}" id="file8" accept=".pdf"/>
            </apex:pageBlockSectionItem>
            <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

         <br></br>
             <input type="checkbox"> FN-Financial Statement
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachFinanStat.body}" filename="{! attachFinanStat.name}" id="file9" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

          <br></br>
             <input type="checkbox"> FN-Other Required Licenses or Permits
             </input>
             <apex:pageBlockSectionItem >
             <apex:outputLabel value="File" for="file"/>
             <apex:inputFile value="{! attachOtherreq.body}" filename="{! attachOtherreq.name}" id="file10" accept=".pdf"/>
             </apex:pageBlockSectionItem>
             <!--apex:commandButton value="Upload Required Documents" action="{! upload}"/-->

          <br></br>
          <br></br>
             <apex:commandbutton value="Upload Required Documents" action="{! upload}"/>
             <apex:commandButton value="Complete & Sign Required Documents"/>
          </body>
   
       </apex:pageBlockSection>

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



Controller

public PageReference upload() {
            //id1= ApexPages.CurrentPage().getParameters().get('id');
            id1= complaince.id;
            system.debug('## id' +id1);
            Boolean errorOccured=false;

                if(attachBis711 != null && String.isNotBlank(attachBis711.name)){
                        attachBis711.OwnerId = UserInfo.getUserId();
                    attachBis711.ParentId = +id1; // the record the file is attached to
                    attachBis711.IsPrivate = true;

                    try {
                    insert attachBis711;
                    } catch (DMLException e) {
                    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading GTS-BIS711'));
                    errorOccured = true;
                    }
                }

Please help
<apex:page >
<script type="text/javascript">
function validate()
{
document.getElementById('demo').innerhtml='hello js'
}
</script>

  <html>
  <body>
  <h1>Congratulations</h1>
  <p id="demo">This is your new Page: js1</p>
  <apex:form >
       <apex:commandButton value="Insert" onclick="validate();"/>
       </apex:form>
  </body>
  </html>
  
</apex:page>
I have an error  while firing a trigger i need create a user record from custom object below is the code pls resolve it ASAP...

trigger createportaluser on Compliance_Diligence_Association__c (after insert) {

list<user> userList = new list<user>();
    for(Compliance_Diligence_Association__c objcustom : [SELECT GLD_Submit_Case__c ,GLD_Business_Contact__r.Id,GLD_Business_Contact__r.FirstName,GLD_Business_Contact__r.LastName,GLD_Business_Contact__r.Email FROM Compliance_Diligence_Association__c where id in: trigger.new]){
          if( objcustom.GLD_Submit_Case__c == true){
   
    User u = new User();
             u.ContactId=objcustom.GLD_Business_Contact__r.Id;  
         u.username=objcustom.GLD_Business_Contact__r.Email;
         u.firstname=objcustom.GLD_Business_Contact__r.FirstName;
         u.lastname=objcustom.GLD_Business_Contact__r.LastName;
         u.email=objcustom.GLD_Business_Contact__r.Email;
         u.TimeZoneSidKey='America/Los_Angeles';
         u.LocaleSidKey = 'en_US';
         u.EmailEncodingKey='UTF-8';
         u.LanguageLocaleKey = 'en_US';
         u.alias = string.valueof(objcustom.GLD_Business_Contact__r.FirstName.substring(0,1) + objcustom.GLD_Business_Contact__r.LastName.substring(0,1));
         u.profileid = '00e61000000ndg3'; 
         u.CommunityNickname=string.valueof(objcustom.GLD_Business_Contact__r.FirstName.substring(0,1) + objcustom.GLD_Business_Contact__r.LastName.substring(0,1));

  
        userList.add(u);

             
           }
        }
        insert(userList);
        }

Thanks,
Naga
<apex:page >
<script type="text/javascript">
function validate()
{
document.getElementById('demo').innerhtml='hello js'
}
</script>

  <html>
  <body>
  <h1>Congratulations</h1>
  <p id="demo">This is your new Page: js1</p>
  <apex:form >
       <apex:commandButton value="Insert" onclick="validate();"/>
       </apex:form>
  </body>
  </html>
  
</apex:page>
I have an error  while firing a trigger i need create a user record from custom object below is the code pls resolve it ASAP...

trigger createportaluser on Compliance_Diligence_Association__c (after insert) {

list<user> userList = new list<user>();
    for(Compliance_Diligence_Association__c objcustom : [SELECT GLD_Submit_Case__c ,GLD_Business_Contact__r.Id,GLD_Business_Contact__r.FirstName,GLD_Business_Contact__r.LastName,GLD_Business_Contact__r.Email FROM Compliance_Diligence_Association__c where id in: trigger.new]){
          if( objcustom.GLD_Submit_Case__c == true){
   
    User u = new User();
             u.ContactId=objcustom.GLD_Business_Contact__r.Id;  
         u.username=objcustom.GLD_Business_Contact__r.Email;
         u.firstname=objcustom.GLD_Business_Contact__r.FirstName;
         u.lastname=objcustom.GLD_Business_Contact__r.LastName;
         u.email=objcustom.GLD_Business_Contact__r.Email;
         u.TimeZoneSidKey='America/Los_Angeles';
         u.LocaleSidKey = 'en_US';
         u.EmailEncodingKey='UTF-8';
         u.LanguageLocaleKey = 'en_US';
         u.alias = string.valueof(objcustom.GLD_Business_Contact__r.FirstName.substring(0,1) + objcustom.GLD_Business_Contact__r.LastName.substring(0,1));
         u.profileid = '00e61000000ndg3'; 
         u.CommunityNickname=string.valueof(objcustom.GLD_Business_Contact__r.FirstName.substring(0,1) + objcustom.GLD_Business_Contact__r.LastName.substring(0,1));

  
        userList.add(u);

             
           }
        }
        insert(userList);
        }

Thanks,
Naga