-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
32Questions
-
27Replies
I am unable to preview word document (.docx) and text files (.txt) using lightning filecard in production org but I am able to view them same in sandbox can anyone let me know what is the issue?
An I missing any permissions for files or content settings. Any help is greatly appreciated. Thanks
- mahesh p 54
- April 17, 2019
- Like
- 0
where am i going wrong in my test method?
@AuraEnabled public static void sendAnEmailAndActivity(String oppId,Id attachId){ try{ //DocumentItem doc = new DocumentItem(); List<String> toAddress = new List<String> (); List<String> fileList = new List<String>(); Verification_Documents__c lId = [select Id from Verification_Documents__c where Attachmentid__c=:attachId]; ContentDocumentLink att = [select Id, LinkedEntityId, ContentDocumentId, ContentDocument.ParentId from ContentDocumentLink where ContentDocument.Id = :attachId and LinkedEntityId=:lId.Id]; //Verification_Documents__c associatedVd = [select Id,Approved__c,Reviewed__c,docType__c from // Verification_Documents__c where Id = :att.LinkedEntityId]; //ContentDocument att = [select Id, ParentId from ContentDocument where Id = :attachId]; Verification_Documents__c vd = [SELECT Id,Name,docType__c,Approved__c,Document_Master__r.Document_Name__c,Document_Master__r.User__c,Comment__c, Document_Master__r.Stages__c,Opportunity__r.customer__r.email,Opportunity__r.OwnerId,Opportunity__r.Sales_Contractor__r.Id, Opportunity__r.Sales_Contractor__r.Email FROM Verification_Documents__c where Opportunity__c =: oppId AND Id =: att.LinkedEntityId]; system.debug('approvalVal*****'+vd.Approved__c); if(vd.Approved__c == False){ if(vd.Document_Master__r.User__c == 'Contractor'){ toAddress.add(vd.Opportunity__r.Sales_Contractor__r.Email); }else if(vd.Document_Master__r.User__c == 'Customer'){ toAddress.add(vd.Opportunity__r.customer__r.Email); } } EmailTemplate emailTemp = [SELECT Id, Name, Body, HtmlValue FROM EmailTemplate where name='Documents Rejection']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(toAddress); email.setSenderDisplayName('OakStar Team'); if(vd.Document_Master__r.User__c == 'Contractor'){ email.setTargetObjectId(vd.Opportunity__r.Sales_Contractor__r.Id); }else if(vd.Document_Master__r.User__c == 'Customer'){ email.setTargetObjectId(vd.Opportunity__r.customer__r.Id); } email.setWhatId(vd.Id); email.setTemplateId(emailTemp.id); if(email != null){ Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); if(vd.Approved__c == False){ if(vd.Document_Master__r.User__c == 'Customer'){ //Creation of Task Task tsk = new Task(); tsk.Subject = 'Follow up with Customer'; tsk.WhatId = [select Id from Opportunity WHERE Id =: oppId].Id; system.debug('WhatId****'+tsk.WhatId); tsk.OwnerId = vd.Opportunity__r.OwnerId; tsk.WhoId = vd.Opportunity__r.Sales_Contractor__r.Id; system.debug('WhoId****'+tsk.WhoId); tsk.Status = 'New'; tsk.Type = 'Other'; if(tsk.Type == 'Other' || tsk.Type == Null){ tsk.TaskSubtype = 'Task'; insert tsk; system.debug('tsk****'+tsk); } //tsk.Public = true; //insert tsk; //system.debug('tsk****'+tsk); } } system.debug('in email****'); } }catch(Exception ex){ System.debug('****Exception in SendEmail Method***'+ex.getMessage()+ex.getLineNumber()); } }My Test Method:
static testMethod void sendAnEmailAndActivityTest(){ Opportunity oppty = TestDataBuilderClass.createOpportunity('Verification'); TypeWiseDocument__c docs = TestDataBuilderClass.createdocuMaster(); Verification_Documents__c vdFiles = TestDataBuilderClass.createverificationRecs(oppty.Id,docs.Id); ContentVersion contentVersion = new ContentVersion( Title = 'Penguins', PathOnClient = 'Penguins.jpg', VersionData = Blob.valueOf('Test Content'), ContentLocation = 'S' ); insert contentVersion; ContentDocument documents = [SELECT Id, Title, ParentId, LatestPublishedVersionId FROM ContentDocument]; //create ContentDocumentLink record ContentDocumentLink cdl = New ContentDocumentLink(); cdl.LinkedEntityId = vdFiles.id; cdl.ContentDocumentId = documents.Id; cdl.shareType = 'I'; insert cdl; //Attachment att = [select Id, ParentId from Attachment ];//where Id = :attachId Test.startTest(); VerificationFilesControllerCD.sendAnEmailAndActivity(oppty.Id,cdl.Id); system.assertEquals(oppty.StageName, 'Verification'); Test.stopTest(); }
- mahesh p 54
- April 13, 2019
- Like
- 0
Can anyone provide me the test class for this method where i am unable to find the mistake?
My Method:
@AuraEnabled public static void sendAnEmailAndActivity(String oppId,Id attachId){ try{ //DocumentItem doc = new DocumentItem(); List<String> toAddress = new List<String> (); List<String> fileList = new List<String>(); Verification_Documents__c lId = [select Id from Verification_Documents__c where Attachmentid__c=:attachId]; ContentDocumentLink att = [select Id, LinkedEntityId, ContentDocumentId, ContentDocument.ParentId from ContentDocumentLink where ContentDocument.Id = :attachId and LinkedEntityId=:lId.Id]; //Verification_Documents__c associatedVd = [select Id,Approved__c,Reviewed__c,docType__c from // Verification_Documents__c where Id = :att.LinkedEntityId]; //ContentDocument att = [select Id, ParentId from ContentDocument where Id = :attachId]; Verification_Documents__c vd = [SELECT Id,Name,docType__c,Approved__c,Document_Master__r.Document_Name__c,Document_Master__r.User__c,Comment__c, Document_Master__r.Stages__c,Opportunity__r.customer__r.email,Opportunity__r.OwnerId,Opportunity__r.Sales_Contractor__r.Id, Opportunity__r.Sales_Contractor__r.Email FROM Verification_Documents__c where Opportunity__c =: oppId AND Id =: att.LinkedEntityId]; system.debug('approvalVal*****'+vd.Approved__c); if(vd.Approved__c == False){ if(vd.Document_Master__r.User__c == 'Contractor'){ toAddress.add(vd.Opportunity__r.Sales_Contractor__r.Email); }else if(vd.Document_Master__r.User__c == 'Customer'){ toAddress.add(vd.Opportunity__r.customer__r.Email); } } EmailTemplate emailTemp = [SELECT Id, Name, Body, HtmlValue FROM EmailTemplate where name='Documents Rejection']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(toAddress); email.setSenderDisplayName('OakStar Team'); if(vd.Document_Master__r.User__c == 'Contractor'){ email.setTargetObjectId(vd.Opportunity__r.Sales_Contractor__r.Id); }else if(vd.Document_Master__r.User__c == 'Customer'){ email.setTargetObjectId(vd.Opportunity__r.customer__r.Id); } email.setWhatId(vd.Id); email.setTemplateId(emailTemp.id); if(email != null){ Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); if(vd.Approved__c == False){ if(vd.Document_Master__r.User__c == 'Customer'){ //Creation of Task Task tsk = new Task(); tsk.Subject = 'Follow up with Customer'; tsk.WhatId = [select Id from Opportunity WHERE Id =: oppId].Id; system.debug('WhatId****'+tsk.WhatId); tsk.OwnerId = vd.Opportunity__r.OwnerId; tsk.WhoId = vd.Opportunity__r.Sales_Contractor__r.Id; system.debug('WhoId****'+tsk.WhoId); tsk.Status = 'New'; tsk.Type = 'Other'; if(tsk.Type == 'Other' || tsk.Type == Null){ tsk.TaskSubtype = 'Task'; insert tsk; system.debug('tsk****'+tsk); } //tsk.Public = true; //insert tsk; //system.debug('tsk****'+tsk); } } system.debug('in email****'); } }catch(Exception ex){ System.debug('****Exception in SendEmail Method***'+ex.getMessage()+ex.getLineNumber()); } }My Test Method:
static testMethod void sendAnEmailAndActivityTest(){ Opportunity oppty = TestDataBuilderClass.createOpportunity('Verification'); TypeWiseDocument__c docs = TestDataBuilderClass.createdocuMaster(); Verification_Documents__c vdFiles = TestDataBuilderClass.createverificationRecs(oppty.Id,docs.Id); //vdFiles.Approved__c = False; //update vdFiles; //Contact con = TestDataBuilderClass.createContactForContractor(); //User us=TestDataBuilderClass.createUser('Partner Community Login User','Contractor',con.Id); ContentVersion contentVersion = new ContentVersion( Title = 'Penguins', PathOnClient = 'Penguins.jpg', VersionData = Blob.valueOf('Test Content'), ContentLocation = 'S' ); insert contentVersion; List<ContentDocument> documents = [SELECT Id, Title, ParentId, LatestPublishedVersionId FROM ContentDocument]; //create ContentDocumentLink record ContentDocumentLink cdl = New ContentDocumentLink(); cdl.LinkedEntityId = vdFiles.id; cdl.ContentDocumentId = documents[0].Id; cdl.shareType = 'I'; insert cdl; Test.startTest(); VerificationFilesControllerCD.sendAnEmailAndActivity(oppty.Id,cdl.Id); system.assertEquals(oppty.StageName, 'Verification'); Test.stopTest(); }I am Unable to cover the code from ContentDocumentLink in my method can anyone help me.
- mahesh p 54
- April 07, 2019
- Like
- 0
How to send a single mail with List of Strings as a merge field
/** * @description To send an Email when Additional Documents are added * @param valueSet * @param oppId * @param stageName */ @AuraEnabled public static void additionalDocumentsEmailIntimation(List<String> valueSet, Id oppId, String stageName){ List<String> fileList = new List<String>(); List<String> toAddress = new List<String> (); List<Verification_Documents__c> vd = new List<Verification_Documents__c> ([SELECT Id,Name,docType__c,Document_Name__c,Approved__c,Document_Master__r.Document_Name__c,Document_Master__r.DocumentType__c,Document_Master__r.User__c,Comment__c, Document_Master__r.Stages__c,Opportunity__r.customer__r.email,Opportunity__r.OwnerId,Opportunity__r.Sales_Contractor__r.Id, Opportunity__r.Sales_Contractor__r.Email FROM Verification_Documents__c where Opportunity__r.Id = :oppId AND Document_master__r.Stages__c =: stageName AND Document_Master__r.DocumentType__c = 'Additional']); Map<String, Verification_Documents__c> mapDocNameVsVerificationDoc = new Map<String, Verification_Documents__c>(); for(Verification_Documents__c vdc: vd){ toAddress.clear(); if(valueSet.contains(vdc.Document_Master__r.Document_Name__c) && vdc.Document_Master__r.User__c == 'Customer' && vdc.Document_Master__r.DocumentType__c == 'Additional'){ system.debug('selectedVal'+valueSet.contains(vdc.Document_Master__r.Document_Name__c)); System.debug('****For Customer '); toAddress.clear(); toAddress.add(vdc.Opportunity__r.customer__r.Email); system.debug('vdc.Opportunity__r.customer__r.Email***'+vdc.Opportunity__r.customer__r.Email+'vdc.em'+vdc.Document_Name__c); System.debug('****In Email'+vdc.Opportunity__r.customer__r.Email); EmailTemplate emailTemp = [SELECT Id, Name, Body, HtmlValue FROM EmailTemplate where name='AdditionalDocumentsIntimation']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(toAddress); email.setSenderDisplayName('OakStar Team'); if(vdc.Document_Master__r.User__c == 'Customer'){ email.setTargetObjectId(vdc.Opportunity__r.customer__r.Id); } email.setWhatId(vdc.Id); email.setTemplateId(emailTemp.id); system.debug('vdc'+email); if(email != null){ Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); } } else if(valueSet.contains(vdc.Document_Master__r.Document_Name__c) && vdc.Document_Master__r.User__c == 'Contractor' && vdc.Document_Master__r.DocumentType__c == 'Additional'){ system.debug('selectedVal'+valueSet.contains(vdc.Document_Master__r.Document_Name__c)); System.debug('****for Contractor '); toAddress.add(vdc.Opportunity__r.Sales_Contractor__r.Email); system.debug('vdc.Opportunity__r.Sales_Contractor__r.Email***'+vdc.Opportunity__r.Sales_Contractor__r.Email+'vdc.em'+vdc.Document_Name__c); System.debug('****In Email'+vdc.Opportunity__r.Sales_Contractor__r.Email); EmailTemplate emailTemp = [SELECT Id, Name, Body, HtmlValue FROM EmailTemplate where name='AdditionalDocumentsIntimation']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(toAddress); email.setSenderDisplayName('OakStar Team'); if(vdc.Document_Master__r.User__c == 'Contractor'){ email.setTargetObjectId(vdc.Opportunity__r.Sales_Contractor__r.Id); } email.setWhatId(vdc.Id); email.setTemplateId(emailTemp.id); system.debug('vdc'+email); if(email != null){ Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); } } //} } }I have a master-detail relationship between Verification Documents and Document Master custom objects,master-detail relationship between Verification Documents and Opportunity.What i am doing through my code is when ValueSet contains 2 values 2 emails are sent.If ValueSet Contains the previous 2 values and if an additional value is added it is sending email to the previous 2 values and new additional value.Is there any possibility of sending a single mail with all the List of values in the email to be sent through code.
- mahesh p 54
- March 30, 2019
- Like
- 0
How to display List<String> in Email Template through apex class
/*Send an email to Contractor / customer when Additional documents are Uploaded by Underwriter */ @AuraEnabled public static void AdditionalDocumentsEmailIntimation(List<String> valueSet, Id oppId, String StageName){ List<String> fileList = new List<String>(); List<String> toAddress = new List<String> (); List<Verification_Documents__c> vd = new List<Verification_Documents__c> ([SELECT Id,Name,docType__c,Document_Name__c,Approved__c,Document_Master__r.Document_Name__c,Document_Master__r.DocumentType__c,Document_Master__r.User__c,Comment__c, Document_Master__r.Stages__c,Opportunity__r.customer__r.email,Opportunity__r.OwnerId,Opportunity__r.Sales_Contractor__r.Id, Opportunity__r.Sales_Contractor__r.Email FROM Verification_Documents__c where Opportunity__r.Id = :oppId AND Document_master__r.Stages__c =: StageName AND Document_Master__r.DocumentType__c = 'Additional']); Map<String, Verification_Documents__c> mapDocNameVsVerificationDoc = new Map<String, Verification_Documents__c>(); for(Verification_Documents__c vdc: vd){ toAddress.clear(); if(valueSet.contains(vdc.Document_Master__r.Document_Name__c) && vdc.Document_Master__r.User__c == 'Customer' && vdc.Document_Master__r.DocumentType__c == 'Additional'){ system.debug('selectedVal'+valueSet.contains(vdc.Document_Master__r.Document_Name__c)); System.debug('****For Customer '); toAddress.clear(); toAddress.add(vdc.Opportunity__r.customer__r.Email); system.debug('vdc.Opportunity__r.customer__r.Email***'+vdc.Opportunity__r.customer__r.Email+'vdc.em'+vdc.Document_Name__c); System.debug('****In Email'+vdc.Opportunity__r.customer__r.Email); EmailTemplate emailTemp = [SELECT Id, Name, Body, HtmlValue FROM EmailTemplate where name='AdditionalDocumentsIntimation']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(toAddress); email.setSenderDisplayName('OakStar Team'); if(vdc.Document_Master__r.User__c == 'Customer'){ email.setTargetObjectId(vdc.Opportunity__r.customer__r.Id); } email.setWhatId(vdc.Id); email.setTemplateId(emailTemp.id); system.debug('vdc'+email); if(email != null){ Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); } } else if(valueSet.contains(vdc.Document_Master__r.Document_Name__c) && vdc.Document_Master__r.User__c == 'Contractor' && vdc.Document_Master__r.DocumentType__c == 'Additional'){ system.debug('selectedVal'+valueSet.contains(vdc.Document_Master__r.Document_Name__c)); System.debug('****for Contractor '); toAddress.add(vdc.Opportunity__r.Sales_Contractor__r.Email); system.debug('vdc.Opportunity__r.Sales_Contractor__r.Email***'+vdc.Opportunity__r.Sales_Contractor__r.Email+'vdc.em'+vdc.Document_Name__c); System.debug('****In Email'+vdc.Opportunity__r.Sales_Contractor__r.Email); EmailTemplate emailTemp = [SELECT Id, Name, Body, HtmlValue FROM EmailTemplate where name='AdditionalDocumentsIntimation']; Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); email.setToAddresses(toAddress); email.setSenderDisplayName('OakStar Team'); if(vdc.Document_Master__r.User__c == 'Contractor'){ email.setTargetObjectId(vdc.Opportunity__r.Sales_Contractor__r.Id); } email.setWhatId(vdc.Id); email.setTemplateId(emailTemp.id); system.debug('vdc'+email); if(email != null){ Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email }); } } //} } }Currently my method is sending an email using an email Template each time a document of customer or contractor is added with a merge field of document name in the template.What i am looking for is if 2 documents of customer,contractor are added i need to send a two emails with string of document names in the template one to customer and one to contractor.
- mahesh p 54
- March 14, 2019
- Like
- 0
can i get test class for the below apex class
public class DocuSignUtil { //public static Attachment docuSignTemplate ; public static Document docuSignTemplate ; public static String brandId ; public static List<String> ContactInfoList; public static Id oppId ; public class DocuSignUtilJSON { public List<Documents> documents; public recipients recipients; public String emailSubject; public String emailBlurb; public String envelopeId; public String status; public string brandId; public string envelopeIdStamping ; public CustomFields CustomFields; } public class TextCustomFields { public String name; public String show; public String required; public String value; } public class CustomFields { public List<TextCustomFields> textCustomFields; } public class Recipients { public List<Signers> signers; public string recipientId ; } public class Signers { public String name; public String email; public String recipientId; public tabs tabs; } public class tabs { public List<signHereTabs> signHereTabs; } public class signHereTabs { public String xPosition; public String yPosition; public String documentId; public String pageNumber; } public static List<DocuSignUtil.signHereTabs> getSignHereTabs() { List<DocuSignUtil.signHereTabs> lsignHereTabs = new List<DocuSignUtil.signHereTabs>(); DocuSignUtil.signHereTabs signHereTabsRec = new DocuSignUtil.signHereTabs(); signHereTabsRec.xPosition = '200'; signHereTabsRec.yPosition = '100'; signHereTabsRec.documentId = '44'; signHereTabsRec.pageNumber = '1'; lsignHereTabs.add(signHereTabsRec); return lsignHereTabs; } public static DocuSignUtil.tabs getTabs() { DocuSignUtil.tabs getTabsRec = new DocuSignUtil.tabs(); getTabsRec.signHereTabs = DocuSignUtil.getSignHereTabs(); return getTabsRec; } public static DocuSignUtil.recipients getReipients() { DocuSignUtil.Recipients recipientRec = new DocuSignUtil.Recipients(); recipientRec.signers = DocuSignUtil.getSigners(); return recipientRec; } public static List<DocuSignUtil.Signers> getSigners(){ List<DocuSignUtil.Signers> lsigners = new List<DocuSignUtil.Signers>(); DocuSignUtil.Signers sinerData = new DocuSignUtil.Signers(); sinerData.name = ContactInfoList[0]; sinerData.email =ContactInfoList[1] ; sinerData.recipientId = '1'; sinerData.tabs = DocuSignUtil.getTabs(); lsigners.add(sinerData); return lsigners; } public static DocuSignUtil.CustomFields getCustomFields(){ DocuSignUtil.CustomFields customfields = new DocuSignUtil.CustomFields(); List<DocuSignUtil.textCustomFields> textCustomFieldsList = new List<DocuSignUtil.textCustomFields>(); DocuSignUtil.textCustomFields textCustomField = new DocuSignUtil.textCustomFields(); textCustomField.name = 'LoanApp_RecordID' ; textCustomField.show = 'false'; textCustomField.required ='false'; textCustomField.value =String.valueOf(oppId); textCustomFieldsList.add(textCustomField); customfields.textCustomFields = textCustomFieldsList; return customfields; } public class Documents { public String name; public String documentBase64; public String fileExtension; public String documentId; } public static List<DocuSignUtil.Documents> getAttachment() { List<DocuSignUtil.Documents> ldocuments = new List<DocuSignUtil.Documents>(); DocuSignUtil.Documents doc = new DocuSignUtil.Documents(); doc.documentBase64 = EncodingUtil.base64Encode(docuSignTemplate.Body); doc.name ='Test Document'; doc.fileExtension ='jpeg'; doc.documentId = '44'; ldocuments.add(doc); return ldocuments; } //Method used to structure the JSON format and return the Serialized JSON public static String getJsonPayload(){ String ActionemailBlrb ='Requesting for your electronic signature.\n\n'; String ActionemailBlrbSub ='Please help us in pulling your confidential credit information to process you Loan Application'; ActionemailBlrb=ActionemailBlrb + ActionemailBlrbSub; DocuSignUtil.DocuSignUtilJSON payload = new DocuSignUtil.DocuSignUtilJSON(); payload.recipients = DocuSignUtil.getReipients(); payload.emailSubject = 'Signature for fetching credit info'; payload.emailBlurb = ActionemailBlrb; payload.envelopeIdStamping = 'false'; payload.documents = DocuSignUtil.getAttachment(); payload.customFields = DocuSignUtil.getCustomFields(); payload.status ='sent'; payload.brandId = brandId; system.debug('serialized json '+JSON.serialize(payload)); return JSON.serialize(payload); } }Please help me in writing the test class
- mahesh p 54
- March 14, 2019
- Like
- 0
how to show lightning:dualListbox in modal box after clicking on a button
<aura:component controller="VerificationFilesController" Implements="flexipage:availableForRecordHome,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:handler event="force:refreshView" action="{!c.doInit}" /> <aura:attribute name="recordError" type="String" access="private"/> <aura:attribute name="isMultiSelectOpen" type="boolean" /> <aura:attribute name="options" type="List" default="[]"/> <aura:attribute name="values" type="List" default="[]"/> <lightning:button variant="brand" label="Request for Additional Documents" title="Request for Additional Documents" onclick="{!c.openMultiSelectModel}"/> <aura:if isTrue="{!v.isMultiSelectOpen}"> <!--###### MODAL BOX Start From Here ######--> <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open "> <div class="slds-modal__container"> <!-- ###### MODAL BOX HEADER Part Start From Here ######--> <div class="slds-modal__header"> <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeReviewer}"> X <span class="slds-assistive-text">Close</span> </button> <h2 id="header99" class="slds-text-heading--medium">Review Document</h2> </div> <!--###### MODAL BOX BODY Part Start From Here ######--> <div class="slds-modal__content slds-p-around--medium slds-is-relative slds-scrollable"> <aura:if isTrue="{!v.showSpinner}"> <div class="demo-only" style="height:6rem;"> <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand"> <span class="slds-assistive-text">Loading</span> <div class="slds-spinner__dot-a"></div> <div class="slds-spinner__dot-b"></div> </div> </div> <aura:set attribute="else"> <div class="slds-form-element slds-p-around--medium"> <lightning:dualListbox aura:id="selectOptions" name="multipleOptions" label= "Select Options" sourceLabel="Available Options" selectedLabel="Selected Options" options="{!v.options}" value="{!v.values}" onchange="{!c.handleChange}"/> </div> </aura:set> </aura:if> </div> <button class="slds-button slds-button--neutral" onclick="{!c.closeReviewer}" >Cancel</button> </div> </div> </div> <div class="slds-backdrop slds-backdrop--open"></div> <!--###### MODAL BOX Part END Here ######--> </aura:if>
({ doInit: function(component, event, helper) { var action1 = component.get('c.getTypeWiseDocuments'); //var typewisedocument = component.find("selectOptions"); action1.setCallback(this, function(response1) { var state = response1.getState(); if (component.isValid() && state == 'SUCCESS') { var documents = response1.getReturnValue(); var options = []; documents.forEach(function(document) { console.log(document); options.push({ value: document.Document_Name__c, label: document.Document_Name__c}); }); component.set("v.options", options); component.get("v.values"); alert(JSON.stringify(component.get("v.options"))); } else { console.log('Failed with state: ' + state); } }); $A.enqueueAction(action1); }, handleChange: function (cmp, event) { // This will contain an array of the "value" attribute of the selected options var selectedOptionValue =event.getParam("value"); alert("Option selected with value: '" + selectedOptionValue.toString() + "'"); }, openMultiSelectModel: function(component, event, helper) { // for Hide/Close Model,set the "isOpen" attribute to "Fasle" component.set("v.isMultiSelectOpen", true); alert(component.get("v.isMultiSelectOpen")); }, closeMultiSelectModel : function(component, event, helper) { component.set("v.isMultiSelectOpen", false); } })
public class VerificationFilesController { @AuraEnabled public static List<TypeWiseDocument__c> getTypeWiseDocuments(){ system.debug('getTypeWiseDocuments Controller'); List<TypeWiseDocument__c> twList = [SELECT ID,Document_Name__c FROM TypeWiseDocument__c where DocumentType__c = 'Additional']; return twList; } }
- mahesh p 54
- February 21, 2019
- Like
- 0
how to fetch stage picklist values of Opportunity in lightning component
<aura:component implements="force:hasRecordId, flexipage:availableForAllPageTypes"> <div class="slds-grid"> <div class="slds-tabs--path" role="application"> <ul class="slds-tabs--path__nav" role="tablist"> <li class="slds-tabs--path__item slds-is-complete" role="presentation"> <a class="slds-tabs--path__link" id="tabs-path-1" aria-controls="content-path-1" aria-selected="false" tabindex="-1" role="tab" href="javascript:void(0);" aria-live="assertive"> <span class="slds-tabs--path__stage"> <lightning:icon iconName="utility-sprite:check" alternativeText="Approved" /> <span class="slds-assistive-text">Stage Complete</span> </span> <span class="slds-tabs--path__title">Contacted</span> </a> </li> <li class="slds-tabs--path__item slds-is-complete" role="presentation"> <a class="slds-tabs--path__link" id="tabs-path-1" aria-controls="content-path-1" aria-selected="false" tabindex="-1" role="tab" href="javascript:void(0);" aria-live="assertive"> <span class="slds-tabs--path__stage"> <lightning:icon iconName="utility-sprite:check" alternativeText="Approved" /> <span class="slds-assistive-text">Stage Complete</span> </span> <span class="slds-tabs--path__title">Open</span> </a> </li> <li class="slds-tabs--path__item slds-is-current" role="presentation"> <a class="slds-tabs--path__link" id="tabs-path-1" aria-controls="content-path-1" aria-selected="false" tabindex="-1" role="tab" href="javascript:void(0);" aria-live="assertive"> <span class="slds-tabs--path__stage"> <lightning:icon iconName="utility-sprite:check" alternativeText="Approved" /> </span> <span class="slds-tabs--path__title">Unqualified</span> </a> </li> <li class="slds-tabs--path__item slds-is-incomplete" role="presentation"> <a class="slds-tabs--path__link" id="tabs-path-1" aria-controls="content-path-1" aria-selected="false" tabindex="-1" role="tab" href="javascript:void(0);" aria-live="assertive"> <span class="slds-tabs--path__stage"> <lightning:icon iconName="utility-sprite:check" alternativeText="Approved" /> </span> <span class="slds-tabs--path__title">Nurturing</span> </a> </li> <li class="slds-tabs--path__item slds-is-incomplete" role="presentation"> <a class="slds-tabs--path__link" id="tabs-path-1" aria-controls="content-path-1" aria-selected="false" tabindex="-1" role="tab" href="javascript:void(0);" aria-live="assertive"> <span class="slds-tabs--path__stage"> <lightning:icon iconName="utility-sprite:check" alternativeText="Approved" /> </span> <span class="slds-tabs--path__title">Closed</span> </a> </li> </ul> </div> </div> </aura:component>Without providing Contacted like this and without using lightning:picklistpath,lightning:path i need to get the picklist values and display the stageName in the path.
- mahesh p 54
- November 27, 2018
- Like
- 0
Trigger to throw an error for community users when clicked on few stages in opportunity path-how?
When the community user logs in he needs to click the stages until Verification but when he clicks on Documents Review stage the trigger should throw an error.The internal user can be able to click on all the stages.
Any help would be greatly appreciated.
- mahesh p 54
- November 27, 2018
- Like
- 0
How to perform Aadhaar e-KYC in salesforce lightning app
Is there any simple way to integrate Aadhaar e-KYC with salesforce. For example when i enter Aadhar number and click on Proceed to KYC it should send an OTP to registered mobile number and authenticate it. Any quick response is highly appreciated.
<div class="slds-section slds-p-bottom_medium slds-wrap" > <h3 class="slds-section__title slds-theme_shade" onclick="{!c.showContent}"> <span class="slds-truncate slds-p-horizontal_small" title="KYC Information">KYC Information</span> </h3> <div aria-hidden="false" class="slds-section__content"> <div class="slds-grid slds-wrap"> <!-- div class="slds-col"--> <!--div class="slds-p-horizontal_medium"--> <div class="slds-form-element slds-small-size_2-of-2 slds-medium-size_1-of-2 slds-large-size_1-of-2"> <div class="slds-form-element__control"> <span class="slds-checkbox slds-m-left--x-small slds-m-top--x-small"> <input type="checkbox" name="options" id="checkbox-69" disabled="true" checked="{!v.contact.Is_KYC_Done__c}"/> <label class="slds-checkbox__label" for="checkbox-69"> <span class="slds-checkbox_faux"></span> <span class="slds-form-element__label">E-KYC Done</span> </label> </span> </div> </div> <!--div class="slds-form-element slds-small-size_2-of-2 slds-medium-size_1-of-2 slds-large-size_1-of-2"--> <aura:renderIf isTrue="{! !v.contact.Is_KYC_Done__c}"> <div class="slds-form-element slds-m-left--x-small slds-m-top--x-small slds-small-size_2-of-2 slds-medium-size_1-of-2 slds-large-size_1-of-2"> <!--ui:outputURL value="{!v.myURL}" label="Perform KYC"/--> <ui:button label="Perform E-KYC" press="{!c.gotoURL}" /> </div> </aura:renderIf> <aura:renderIf isTrue="{!v.contact.Is_KYC_Done__c}"> <div class="slds-form-element"> <label class="slds-form-element__label slds-m-left--x-small slds-m-top--x-small slds-small-size_2-of-2 slds-medium-size_1-of-2 slds-large-size_1-of-2" for="opportunityDocumentId">Id</label> <div class="slds-form-element__control slds-m-left--x-small"> <label for="opportunityDocumentId">{!v.contact.Document_Id__c}</label> </div> </div> </aura:renderIf> <!--/div--> <!--/div--> <!--/div-->
<!--Controller--> gotoURL : function(component, event, helper) { var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "url":"https://xyz-dev-ed.my.salesforce.com/apex/AadhaarBridgeIndex" }); urlEvent.fire(); }
- mahesh p 54
- November 19, 2018
- Like
- 0
When i am in stage 1 i had a field called probability with value as 5% now when i go to stage 2 i need to change probability to 10%?
I have a path in my org which i am using it in the lightning component as lightning:picklistpath.How to change probability field value based on stage selected in the path in lightning component.
please help me in resolving this
({ handleSelect : function (component, event, helper) { var stageName = event.getParam("detail").value; testEvent.setParams({ "variant": "Success!" }); testEvent.fire(); } })how to get probability field and change the value based on the stage selected?
please help me in resolving this
- mahesh p 54
- November 13, 2018
- Like
- 0
i need to update lightning button icon variant to brand in the component if the object picklist has those values
I have a picklist called Amenities which has following values: parking,wifi,restaurant,playground,garden in the Property (custom) object.If the picklist has wifi value in property record object i need to display wifi lightning button icon variant to brand in lightning component for particular property record.
<aura:component implements="lightning:actionOverride,flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader, force:hasRecordId"> <aura:attribute name="picklistValues" type="Object"/> <aura:attribute name="propertyRecord" type="Property__c"/> <aura:attribute name="recordError" type="String"/> <!--<aura:handler name="init" value="{! this }" action="{! c.doInit }"/>--> <force:recordData aura:id="forceRecord" layoutType="FULL" recordId="{!v.recordId}" targetFields="{!v.propertyRecord}" targetError="{!v.recordError}" mode="EDIT" recordUpdated="{!c.recordUpdated}" /> <h2><lightning:icon iconName="utility:magicwand" />Amenities</h2><br/> <lightning:buttonIcon iconName="utility:travel_and_places" variant="border" alternativeText="Parking" size="medium" /> <lightning:buttonIcon iconName="utility:wifi" alternativeText="Wifi" size="medium" /> <lightning:buttonIcon iconName="utility:food_and_drink" alternativeText="Restaurant" size="medium" /> <lightning:buttonIcon iconName="utility:activity" alternativeText="PlayGround" size="medium" /> <lightning:buttonIcon iconName="utility:classic_interface" alternativeText="Garden" size="medium" /> <aura:if isTrue="{!not(empty(v.recordError))}"> <div class="recordError"> {!v.recordError}</div> </aura:if> </aura:component>
({ recordUpdated: function(component, event, helper) { var eventParams = event.getParams(); if(eventParams.changeType === "LOADED") { // record is loaded (render other component which needs record data value) console.log("Record is loaded successfully."); } else if(eventParams.changeType === "CHANGED") { // record is changed } else if(eventParams.changeType === "REMOVED") { // record is deleted } else if(eventParams.changeType === "ERROR") { // there’s an error while loading, saving, or deleting the record } } })
- mahesh p 54
- November 13, 2018
- Like
- 0
how to dynamically change variant from border to brand based on the object that possess those multi select picklist values
I had a multiselect picklist called Amenities on Property object with Parking,Wifi,Restaurant,Playground,Garden values.
I created a lightning component to display those values with lightning button icon.
I created a lightning component to display those values with lightning button icon.
<aura:component implements="flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader, force:hasRecordId"> <aura:attribute name="record" type="Object"/> <aura:attribute name="simpleRecord" type="Object"/> <aura:attribute name="recordError" type="String"/> <!--<aura:handler name="init" value="{! this }" action="{! c.doInit }"/>--> <force:recordData aura:id="recordLoader" layoutType="FULL" recordId="{!v.recordId}" targetFields="{!v.simpleRecord}" targetError="{!v.recordError}" mode="EDIT" recordUpdated="{!c.handleRecordUpdated}" /> <h2><lightning:icon iconName="utility:magicwand" />Amenities</h2><br/> <lightning:buttonIcon iconName="utility:travel_and_places" alternativeText="Parking" size="medium" /> <lightning:buttonIcon iconName="utility:wifi" alternativeText="Wifi" size="medium" /> <lightning:buttonIcon iconName="utility:food_and_drink" alternativeText="Restaurant" size="medium" /> <lightning:buttonIcon iconName="utility:activity" alternativeText="PlayGround" size="medium" /> <lightning:buttonIcon iconName="utility:classic_interface" alternativeText="Garden" size="medium" /> <!-- Display Lightning Data Service errors, if any --> <aura:if isTrue="{!not(empty(v.recordError))}"> <div class="recordError"> {!v.recordError}</div> </aura:if> </aura:component>
({ handleRecordUpdated: function(component, event, helper) { var eventParams = event.getParams(); if(eventParams.changeType === "LOADED") { // record is loaded (render other component which needs record data value) console.log("Record is loaded successfully."); } else if(eventParams.changeType === "CHANGED") { // record is changed } else if(eventParams.changeType === "REMOVED") { // record is deleted } else if(eventParams.changeType === "ERROR") { // there’s an error while loading, saving, or deleting the record } } })Now i need to achieve the task:on clicking any amenity icon its variant should toggle between brand and border. Additionally, the amenities field of the property need to be updated accordingly.
- mahesh p 54
- November 12, 2018
- Like
- 0
how to display contact details after clicking contact in lightning tree component
<!--Tree.cmp--> <aura:component controller="TreeAuraController"> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <aura:attribute name="items" type="Object"/> <!--Lightning Tree--> <div class="slds-m-around_xx-large"> <lightning:tree items="{!v.items}" onselect="{!c.handleSelect}" header="Account and Contacts"/> </div> <!--Lightning Spinner--> <div> <lightning:spinner alternativeText="Processing.." title="Processing.." aura:id="spnr" variant="brand" size="large" /> </div> </aura:component>
public class TreeAuraController { @AuraEnabled public static List<item> getAccountTree(){ List<item> items = new List<item>(); List<Account> acctList = new List<Account>(); //get list of accounts and respective contacts acctList = [SELECT Id, Name, (SELECT Id, Name From Contacts) From Account LIMIT 10]; for(Account acc: acctList){ //get contacts of current account record List<item> conitems = new List<item>(); for(Contact c: acc.Contacts){ //add contact items item conitem = new item(c.Name, String.valueOf(c.Id), false, null); conitems.add(conitem); } //add account items item accitem = new item(acc.Name, String.valueOf(acc.Id), false, conitems); items.add(accitem); } return items; } //Item Wrapper Class public class item{ @AuraEnabled public String label {get; set;} @AuraEnabled public String name {get; set;} @AuraEnabled public Boolean expanded {get; set;} @AuraEnabled public List<item> items {get; set;} public item(String label, String name, Boolean expanded, List<item> items){ this.label = label; this.name = name; this.expanded = expanded; this.items = items; } } }
({ doInit: function (component, event, helper) { var spinner = component.find("spnr"); var action = component.get('c.getAccountTree'); action.setCallback(this, function(response){ var state = response.getState(); if(state === 'SUCCESS'){ //get account and respective contact list, and initialize with items component.set('v.items', response.getReturnValue()); //hide spinner after getting data $A.util.toggleClass(spinner, "slds-hide"); }else{ $A.util.toggleClass(spinner, "slds-hide"); alert('ERROR'); } }); $A.enqueueAction(action); }, handleSelect: function (cmp, event, helper) { //return name of selected tree item var selectedName = event.getParam('name'); alert("Selected Name: " + selectedName); } })After i expand one contact its displaying list of contacts now i need to show the contact details when i click on particular contact under an account.
how could i achieve this?
- mahesh p 54
- November 06, 2018
- Like
- 0
test class for before insert
trigger Booking_5Appointments_perDay on Passport_Booking_Appointment__c (before insert) { if (Trigger.isBefore && Trigger.isInsert) { List<Id> passportSlotAvailabilities_ids = new List<Id>(); for(Passport_Booking_Appointment__c j:Trigger.new) { passportSlotAvailabilities_ids.add(j.Passport_Slot_Availability__c); } List<Passport_Booking_Appointment__c> other_bookings = [SELECT Id, CreatedDate, CreatedById,Passport_Slot_Availability__c FROM Passport_Booking_Appointment__c WHERE Passport_Slot_Availability__c IN : passportSlotAvailabilities_ids]; Map<id,integer> bookingAppointmentmap = new Map<id,integer> (); for (Passport_Booking_Appointment__c existent_record : other_bookings) { Date existent_record_created_date = existent_record.CreatedDate.date(); if (existent_record.CreatedById == UserInfo.getUserId() && existent_record_created_date == Date.today()) { if(bookingAppointmentmap.get(existent_record.Passport_Slot_Availability__c) == null) { bookingAppointmentmap.put(existent_record.Passport_Slot_Availability__c,1); } else { bookingAppointmentmap.put(existent_record.Passport_Slot_Availability__c,bookingAppointmentmap.get(existent_record.Passport_Slot_Availability__c)+1); } } } for (Passport_Booking_Appointment__c j : Trigger.new) { if(bookingAppointmentmap != null && bookingAppointmentmap.get(j.Passport_Slot_Availability__c) >=5) { j.addError('Cannot create Booking Appointment for your desired slot please come back tomorrow.'); } } } }can i get the test class for before insert trigger
- mahesh p 54
- October 24, 2018
- Like
- 0
how to redirect to another tab after clicking save button in one tab
<apex:page controller="PassportController" showHeader="false" sidebar="false" > <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js."></script> <script> $(window).load(function(){ $("#calYearPicker").html('') for(var i=1920;i<=2018;i++) { $("#calYearPicker").append("<option value'" + i +"'>" + i+ "</option>"); } }); </script> <style> * { margin: 0; padding: 0; } .tabs { list-style: none; width: 200px; float: left } .tabs a { display: block; padding: 10px 15px; text-decoration: none; background: #fff; color: #000; border-bottom: 1px solid #ccc; } .tabContent { margin-left: 200px; min-height: 300px; position:fixed; border: 1px solid #ccc; padding: 10px; } .tabs a.active { background: rgba(0,0,0,0.2); } .tabContent .tabBox { padding: -5px -5em; display: none } .tabContent .activeTab { display: block } </style> <script> $(document).ready(function(){ $('.tabs a').click(function(){ var tabId = $(this).attr('href'); $('.tabs a').removeClass('active'); $(this).addClass('active'); $('.tabContent .tabBox').removeClass('activeTab'); $(tabId).addClass('activeTab') }); }); </script> <ul class="tabs" > <li><a class="active" href="#tab1">Applicant Details</a></li> <li><a href="#tab2">Emergency Contact</a></li> <li><a href="#tab3">Identity Certificate/Passport Details</a></li> <li><a href="#tab4">Other Details</a></li> <li><a href="#tab5">Passport Details Verification</a></li> <li><a href="#tab6">Self Declaration</a></li> <li><a href="#tab7">Upload Document</a></li> <li><a href="#tab8">Book Appointment</a></li> </ul> <div class="tabContent"> <div class="tabBox activeTab" id="tab1"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Applicant Details"> <apex:inputField value="{!p.Given_Name__c}"> Firts Name + Middle Name</apex:inputField> <apex:inputField value="{!p.Surname_Max_45_Characters__c}"/> <apex:inputField value="{!p.Gender__c}"/> <apex:inputField value="{!p.Date_of_Birth_DD_MM_YYYY__c}"/> <apex:inputField value="{!p.Place_of_Birth_Village_Town_City__c}"/> <apex:inputField value="{!p.Marital_Status__c}"/> <apex:inputField value="{!p.PAN_if_available__c}"/> <apex:inputField value="{!p.Voter_Id_if_available__c}"/> <apex:inputField value="{!p.Educational_qualification__c}"/> <apex:inputField value="{!p.Aadhaar_Number_if_available__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="1" title="Family Details"> <apex:inputField value="{!p.Father_s_Name__c}"/> <apex:inputField value="{!p.Father_s_SurName__c}"/> <apex:inputField value="{!p.Legal_Guardian_s_Given_Name__c}"/> <apex:inputField value="{!p.Legal_Guardian_s_SurName__c}"/> <apex:inputField value="{!p.Mother_s_Name__c}"/> <apex:inputField value="{!p.Mother_s_SurName__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="1" title="Residential Address Details"> <apex:inputField value="{!p.Address_1__c}"/> <apex:inputField value="{!p.Address_2__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab2"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Emergency Contact Details"> <apex:inputField value="{!p.Name__c}"/> <apex:inputField value="{!p.Mobile_Number__c}"/> <apex:inputField value="{!p.Email_ID__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab6"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Self Declaration"> <table style="empty-cells:hide;" border="1" cellpadding="1" cellspacing="1"> <tr> <td> Self Declaration <br/> I owe allegiance to the sovereignty , unity & integrity of India, and have not voluntarily acquired citizenship or travel document of any other country. I have not lost, surrendered or been deprived of the the citizenship of India and I affirm that the information given by me in this form and the enclosures is true and I solely responsible for its accuracy, and I am liable to be penalized or prosecuted if found otherwise. I am aware that under the Passport Act, 1967 it is a criminal offence to furnish any false information or to suppress any material information with a view to obtaining passport or travel document. </td> </tr> </table> <apex:pageBlockSectionItem > <apex:outputLabel for="request-true" value="I Agree"/> <apex:inputCheckbox id="request-true" value="{!p.Self_declaration_I_Agree__c}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab7"> <apex:form > <apex:pageMessages /> <apex:inputFile value="{!file}" /> <apex:commandbutton action="{!upload}" value="Upload" /> </apex:form> </div> <div class="tabBox" id="tab8"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1"> <!--<apex:inputField value="{!pb.Passport_Applicant_Name__c}" />--> <apex:inputField value="{!pb.Passport_Slot_Availability__c}" /> <apex:inputField value="{!pb.Booking_Slots__c}" /> <apex:commandbutton action="{!Save}" value="SaveBookings" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </div> </div> </apex:page>
public with sharing class PassportController { public Passport_Application__c p { get; set; } public Passport_Booking_Appointment__c pb { get; set; } public ApexPages.StandardSetController stdCntrlr {get; set;} public PassportController(ApexPages.StandardSetController controller) { stdCntrlr = controller; } public Boolean Display{get;set;} public List<Passport_Application__c> ApplicantDetails { get; set; } public List<Passport_Application__c> EmergencyContactDetails { get; set; } public List<Passport_Application__c> SelfDeclaration { get; set; } //public List<Passport_Application__c> FamilyDetails { get; set; } //public List<Passport_Application__c> AddressDetails { get; set; } public List<Passport_Booking_Appointment__c> bookingappointments { get; set; } public Integer i=0; public Integer j=0; //Integer fieldNumber = Integer.ValueOf(pb.count__c.trim()); public PassportController(){ Display=false; p=new Passport_Application__c(); pb=new Passport_Booking_Appointment__c(); //pb.count__c=0; //listBookings=new list<Booking__c>(); //listBookings.add(b); } /*Public void addBookings() { Booking__c b = new Booking__c(); listBookings.add(b); } */ public PageReference save() { try { Display=true; p.Name=userInfo.getUserId(); p.Passport_Booking_Appointment__c=pb.Passport_Slot_Availability__c; p.Booking_Slots_c__c=pb.Booking_Slots__c; ApplicantDetails= [select id,Given_Name__c,Surname_Max_45_Characters__c,Gender__c,Date_of_Birth_DD_MM_YYYY__c,Place_of_Birth_Village_Town_City__c,Marital_Status__c,PAN_if_available__c,Voter_Id_if_available__c,Educational_qualification__c,Aadhaar_Number_if_available__c,Father_s_Name__c,Father_s_SurName__c,Legal_Guardian_s_Given_Name__c,Legal_Guardian_s_SurName__c,Mother_s_Name__c,Mother_s_SurName__c,Address_1__c,Address_2__c,Booking_Slots_c__c,Passport_Booking_Appointment__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id EmergencyContactDetails= [select id,Name__c,Mobile_Number__c,Email_ID__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id SelfDeclaration= [select id,Self_declaration_I_Agree__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id bookingappointments= [select id,Name,Booking_Slots__c from Passport_Booking_Appointment__c where id=:ApexPages.currentPage().getParameters().get('id') ]; //upsert p; pb.Name=p.Name; pb.Passport_Application__c=p.Id; //ApexPages.currentPage().getParameters().get('id'); upsert pb; upsert p; i=i+1; if(i==1 ) { ApexPages.AddMessage(new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Created Successfully.Thank you!')); //p=null; //PageReference pg = new PageReference('/apex/Fresh_passport?id=' + p.Id + '#tab2'); //pg.setRedirect(true); //return pg; } } catch(Exception ex){ ApexPages.addMessages(ex); } return null; } public blob file { get; set; } public PageReference upload() { ContentVersion v = new ContentVersion(); v.versionData = file; v.title = 'testing upload'; v.pathOnClient ='/somepath.jpg'; insert v; return new PageReference('/' + v.id); } }After i click save button on tab1 it should upsert into custom object which is working absolutely fine but after clicking save i need to navigate to tab2 which is emergency contact and after clicking save in that tab it should navigate to tab3 which is Identity certificate/passport details and so on.
Help me in meeting this requirement
- mahesh p 54
- October 17, 2018
- Like
- 0
There are 2 Custom objects Passport_Slot_Availability__c and Passport_Booking_Appointment__c.They both have master detail relationship. where Passport_Slot_Availability__c is master and Passport_Booking_Appointment__c is detail.
Requirement: For a day only 5 passport bookings should be created by the users for a particular Passport Slot. On the same day when the 6th user is trying to create another passport booking for the same passport slot as that of 5 users, error message should be thrown. But on the next day the user should be able to create a new passport booking for that same passport slot if available.
trigger Booking_5Appointments_perDay on Passport_Booking_Appointment__c (before insert) { if (Trigger.isBefore && Trigger.isInsert) { List<Id> passportSlotAvailabilities_ids = new List<Id>(); for(Passport_Booking_Appointment__c j:Trigger.new) { passportSlotAvailabilities_ids.add(j.Passport_Slot_Availability__c); } List<Passport_Booking_Appointment__c> other_bookings = [SELECT Id, CreatedDate, CreatedById,Passport_Slot_Availability__c FROM Passport_Booking_Appointment__c WHERE Passport_Slot_Availability__c IN : passportSlotAvailabilities_ids]; for (Passport_Booking_Appointment__c j : Trigger.new) { for (Passport_Booking_Appointment__c existent_record : other_bookings) { if (j.Passport_Slot_Availability__c == existent_record.Passport_Slot_Availability__c && j.CreatedById == UserInfo.getUserId()) { Date existent_record_created_date = existent_record.CreatedDate.date(); if (existent_record_created_date == Date.today()) { j.addError('Cannot create Booking Appointment because limit has exceeded for today.'); } } } } } }
- mahesh p 54
- October 16, 2018
- Like
- 0
after i click save on tab1 it need to insert fields in tab1 to custom object and should redirect to tab2 on same page
<apex:page controller="PassportController"> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js."></script> <script> $(window).load(function(){ $("#calYearPicker").html('') for(var i=1920;i<=2018;i++) { $("#calYearPicker").append("<option value'" + i +"'>" + i+ "</option>"); } }); </script> <style> * { margin: 0; padding: 0; } .tabs { list-style: none; width: 200px; float: left } .tabs a { display: block; padding: 10px 15px; text-decoration: none; background: #fff; color: #000; border-bottom: 1px solid #ccc; } .tabContent { margin-left: 200px; min-height: 300px; border: 1px solid #ccc; padding: 10px; } .tabs a.active { background: rgba(0,0,0,0.2); } .tabContent .tabBox { padding: -5px -5em; display: none } .tabContent .activeTab { display: block } </style> <script> $(document).ready(function(){ $('.tabs a').click(function(){ var tabId = $(this).attr('href'); $('.tabs a').removeClass('active'); $(this).addClass('active'); $('.tabContent .tabBox').removeClass('activeTab'); $(tabId).addClass('activeTab') }); }); </script> <ul class="tabs" > <li><a class="active" href="#tab1">Applicant Details</a></li> <li><a href="#tab2">Family Details</a></li> <li><a href="#tab3">Present Residential Address</a></li> <li><a href="#tab4">Emergency Contact</a></li> <li><a href="#tab5">Identity Certificate/Passport Details</a></li> <li><a href="#tab6">Other Details</a></li> <li><a href="#tab7">Passport Details Verification</a></li> <li><a href="#tab8">Self Declaration</a></li> <li><a href="#tab9">Upload Document</a></li> <li><a href="#tab10">Book Appointment</a></li> </ul> <div class="tabContent"> <div class="tabBox activeTab" id="tab1"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" > <apex:inputField value="{!p.Given_Name__c}"> Firts Name + Middle Name</apex:inputField> <apex:inputField value="{!p.Surname_Max_45_Characters__c}"/> <apex:inputField value="{!p.Gender__c}"/> <apex:inputField value="{!p.Date_of_Birth_DD_MM_YYYY__c}"/> <apex:inputField value="{!p.Place_of_Birth_Village_Town_City__c}"/> <apex:inputField value="{!p.Marital_Status__c}"/> <apex:inputField value="{!p.PAN_if_available__c}"/> <apex:inputField value="{!p.Voter_Id_if_available__c}"/> <apex:inputField value="{!p.Educational_qualification__c}"/> <apex:inputField value="{!p.Aadhaar_Number_if_available__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab2"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" > <apex:inputField value="{!p.Father_s_Name__c}"/> <apex:inputField value="{!p.Mother_s_Name__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab9"> <apex:form > <apex:inputFile value="{!file}" /> <apex:commandbutton action="{!upload}" value="Upload" /> </apex:form> </div> <div class="tabBox" id="tab10"> <apex:form > <apex:inputField value="{!pb.Passport_Slot_Holder_Name__c}" /> <apex:inputField value="{!pb.Passport_Slot_Availability__c}" /> <apex:commandbutton action="{!save}" value="Save" /> </apex:form> </div> </div> </apex:page>
public with sharing class PassportController { //Booking__c b=new Booking__c(); //public list<Booking__c> listBookings{ get; set; } public Passport_Application__c p { get; set; } public Passport_Booking_Appointment__c pb { get; set; } public ApexPages.StandardSetController stdCntrlr {get; set;} public PassportController(ApexPages.StandardSetController controller) { stdCntrlr = controller; } public Boolean Display{get;set;} public List<Passport_Application__c> samepage { get; set; } public List<Passport_Application__c> samepage1 { get; set; } public Integer i=0; public PassportController(){ Display=false; p=new Passport_Application__c(); //listBookings=new list<Booking__c>(); //listBookings.add(b); } /*Public void addBookings() { Booking__c b = new Booking__c(); listBookings.add(b); } */ public PageReference save() { try { Display=true; samepage= [select id,Given_Name__c,Surname_Max_45_Characters__c,Gender__c,Date_of_Birth_DD_MM_YYYY__c,Place_of_Birth_Village_Town_City__c,Marital_Status__c,PAN_if_available__c,Voter_Id_if_available__c,Educational_qualification__c,Aadhaar_Number_if_available__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id samepage1= [select id,Father_s_Name__c,Mother_s_Name__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id upsert p; i=i+1; if(i==1 ) { ApexPages.AddMessage(new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Created Successfully.Thank you!')); //p=null; PageReference pg = new PageReference('/apex/Fresh_passport?id=' + p.Id + '#tab2'); pg.setRedirect(true); return pg; } /*if(i==1) { ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Bookings are inserted Successfully.Thank you!')); }*/ //i=i+1; /*if(i==2) { PageReference pg = new PageReference(System.currentPageReference().getURL()); pg.setRedirect(true); return pg; }*/ } catch(Exception ex){ ApexPages.addMessages(ex); } return null; } public blob file { get; set; } public PageReference upload() { ContentVersion v = new ContentVersion(); v.versionData = file; v.title = 'testing upload'; v.pathOnClient ='/somepath.jpg'; insert v; return new PageReference('/' + v.id); } /*public PageReference saveBookings() { insert listBookings; //for(Integer i=0; i<listBookings.size(); i++) // { // insert listBookings; // } upsert c; upsert b; return Page.Allbookingssaved; }*/ }When i click save on tab1 it should insert all the fields in tab1 to custom object Passport_Application__c and need to redirect to tab2. After filling the details on tab2 the fields should get inserted into same custom object Passport_Application__c and should redirect to tab3. Is this possible? help me
- mahesh p 54
- October 16, 2018
- Like
- 0
I have a standard auto number data type in my custom object which needs to accept only 15 records per day is that possible
I have a picklist with three values
1)9.00 am to 12.00
2)12.00 to 3.00 pm
3)3.00 pm to 6.00 pm
Now I need to show 5 appointments in each slot,and once each day slot is booked then next day available slots should be seen.
I have a standard auto number data type in my custom object booking__c which needs to accept only 15 records per day.Can this be done without code
1)9.00 am to 12.00
2)12.00 to 3.00 pm
3)3.00 pm to 6.00 pm
Now I need to show 5 appointments in each slot,and once each day slot is booked then next day available slots should be seen.
I have a standard auto number data type in my custom object booking__c which needs to accept only 15 records per day.Can this be done without code
- mahesh p 54
- October 15, 2018
- Like
- 0
how to insert/save all the field values into one custom object once all the tabs in the left are filled completely
<apex:page controller="PassportController" > <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <style> * { margin: 0; padding: 0; } .tabs { list-style: none; width: 200px; float: left } .tabs a { display: block; padding: 10px 15px; text-decoration: none; background: #fff; color: #000; border-bottom: 1px solid #ccc; } .tabContent { margin-left: 200px; min-height: 300px; border: 1px solid #ccc; padding: 10px; } .tabs a.active { background: rgba(0,0,0,0.2); } .tabContent .tabBox { padding: 5px -5em; display: none } .tabContent .activeTab { display: block } </style> <script> $(document).ready(function(){ $('.tabs a').click(function(){ var tabId = $(this).attr('href'); $('.tabs a').removeClass('active'); $(this).addClass('active'); $('.tabContent .tabBox').removeClass('activeTab'); $(tabId).addClass('activeTab') }); }); </script> <ul class="tabs" > <li><a class="active" href="#tab1">Applicant Details</a></li> <li><a href="#tab2">Family Details</a></li> <li><a href="#tab3">Present Residential Address</a></li> <li><a href="#tab4">Emergency Contact</a></li> <li><a href="#tab5">Identity Certificate/Passport Details</a></li> <li><a href="#tab6">Other Details</a></li> <li><a href="#tab7">Passport Details Verification</a></li> <li><a href="#tab8">Self Declaration</a></li> <li><a href="#tab9">Upload Document</a></li> <li><a href="#tab10">Book Appointment</a></li> </ul> <div class="tabContent"> <div class="tabBox activeTab" id="tab1"> <apex:form > <apex:pageMessages /> <apex:pageBlock> <apex:pageBlockSection columns="1" > <apex:inputField value="{!p.Name}"/> <apex:inputField value="{!p.Gender__c}"/> <apex:inputField value="{!p.Date_of_Birth_DD_MM_YYYY__c}"/> <apex:inputField value="{!p.Place_of_Birth_Village_Town_City__c}"/> <apex:inputField value="{!p.Marital_Status__c}"/> <apex:inputField value="{!p.PAN_if_available__c}"/> <apex:inputField value="{!p.Voter_Id_if_available__c}"/> <apex:inputField value="{!p.Educational_qualification__c}"/> <apex:inputField value="{!p.Aadhaar_Number_if_available__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!stdCntrlr.previous}" value="Previous" rendered="{!stdCntrlr.hasPrevious}"/> <apex:commandButton action="{!stdCntrlr.next}" value="Next" rendered="{!stdCntrlr.hasNext}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab2"> <apex:form > <apex:pageMessages /> <apex:pageBlock> <apex:pageBlockSection columns="1" > <apex:inputField value="{!p.Father_s_Name__c}"/> <apex:inputField value="{!p.Mother_s_Name__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!stdCntrlr.previous}" value="Previous" rendered="{!stdCntrlr.hasPrevious}"/> <apex:commandButton action="{!stdCntrlr.next}" value="Next" rendered="{!stdCntrlr.hasNext}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab3">Tab Three</div> <div class="tabBox" id="tab4">Tab Four</div> </div> </apex:page>
public with sharing class PassportController { //Booking__c b=new Booking__c(); //public list<Booking__c> listBookings{ get; set; } public Passport_Application__c p { get; set; } public ApexPages.StandardSetController stdCntrlr {get; set;} public PassportController(ApexPages.StandardSetController controller) { stdCntrlr = controller; } public Boolean Display{get;set;} public List<Passport_Application__c> samepage { get; set; } public List<Passport_Application__c> samepage1 { get; set; } public Integer i=0; public PassportController(){ Display=false; p=new Passport_Application__c(); //listBookings=new list<Booking__c>(); //listBookings.add(b); } /*Public void addBookings() { Booking__c b = new Booking__c(); listBookings.add(b); } */ public PageReference save() { Display=true; samepage= [select id,Name,Gender__c,Date_of_Birth_DD_MM_YYYY__c,Place_of_Birth_Village_Town_City__c,Marital_Status__c,PAN_if_available__c,Voter_Id_if_available__c,Educational_qualification__c,Aadhaar_Number_if_available__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id samepage1= [select id,Father_s_Name__c,Mother_s_Name__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id //ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Record Created Successfully.Thank you!')); upsert p; if(i==0 && p.Name!=null && p.Name!='') { ApexPages.AddMessage(new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Created Successfully.Thank you!')); } if(i==1) { ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,'Bookings are inserted Successfully.Thank you!')); } i=i+1; if(i==2) { PageReference pg = new PageReference(System.currentPageReference().getURL()); pg.setRedirect(true); return pg; } return null; } }
all the fields belongs to one custom object Passport_Application__c but when tab applicant details is clicked the user need to fill all the field values which need to get inserted into Passport_Application__c next button should redirect to family details and he should fill family details fields which also need to get inserted into Passport_Application__c but without disturbing the applicant details field values.
- mahesh p 54
- October 15, 2018
- Like
- 0
can i get test class for the below apex class
public class DocuSignUtil { //public static Attachment docuSignTemplate ; public static Document docuSignTemplate ; public static String brandId ; public static List<String> ContactInfoList; public static Id oppId ; public class DocuSignUtilJSON { public List<Documents> documents; public recipients recipients; public String emailSubject; public String emailBlurb; public String envelopeId; public String status; public string brandId; public string envelopeIdStamping ; public CustomFields CustomFields; } public class TextCustomFields { public String name; public String show; public String required; public String value; } public class CustomFields { public List<TextCustomFields> textCustomFields; } public class Recipients { public List<Signers> signers; public string recipientId ; } public class Signers { public String name; public String email; public String recipientId; public tabs tabs; } public class tabs { public List<signHereTabs> signHereTabs; } public class signHereTabs { public String xPosition; public String yPosition; public String documentId; public String pageNumber; } public static List<DocuSignUtil.signHereTabs> getSignHereTabs() { List<DocuSignUtil.signHereTabs> lsignHereTabs = new List<DocuSignUtil.signHereTabs>(); DocuSignUtil.signHereTabs signHereTabsRec = new DocuSignUtil.signHereTabs(); signHereTabsRec.xPosition = '200'; signHereTabsRec.yPosition = '100'; signHereTabsRec.documentId = '44'; signHereTabsRec.pageNumber = '1'; lsignHereTabs.add(signHereTabsRec); return lsignHereTabs; } public static DocuSignUtil.tabs getTabs() { DocuSignUtil.tabs getTabsRec = new DocuSignUtil.tabs(); getTabsRec.signHereTabs = DocuSignUtil.getSignHereTabs(); return getTabsRec; } public static DocuSignUtil.recipients getReipients() { DocuSignUtil.Recipients recipientRec = new DocuSignUtil.Recipients(); recipientRec.signers = DocuSignUtil.getSigners(); return recipientRec; } public static List<DocuSignUtil.Signers> getSigners(){ List<DocuSignUtil.Signers> lsigners = new List<DocuSignUtil.Signers>(); DocuSignUtil.Signers sinerData = new DocuSignUtil.Signers(); sinerData.name = ContactInfoList[0]; sinerData.email =ContactInfoList[1] ; sinerData.recipientId = '1'; sinerData.tabs = DocuSignUtil.getTabs(); lsigners.add(sinerData); return lsigners; } public static DocuSignUtil.CustomFields getCustomFields(){ DocuSignUtil.CustomFields customfields = new DocuSignUtil.CustomFields(); List<DocuSignUtil.textCustomFields> textCustomFieldsList = new List<DocuSignUtil.textCustomFields>(); DocuSignUtil.textCustomFields textCustomField = new DocuSignUtil.textCustomFields(); textCustomField.name = 'LoanApp_RecordID' ; textCustomField.show = 'false'; textCustomField.required ='false'; textCustomField.value =String.valueOf(oppId); textCustomFieldsList.add(textCustomField); customfields.textCustomFields = textCustomFieldsList; return customfields; } public class Documents { public String name; public String documentBase64; public String fileExtension; public String documentId; } public static List<DocuSignUtil.Documents> getAttachment() { List<DocuSignUtil.Documents> ldocuments = new List<DocuSignUtil.Documents>(); DocuSignUtil.Documents doc = new DocuSignUtil.Documents(); doc.documentBase64 = EncodingUtil.base64Encode(docuSignTemplate.Body); doc.name ='Test Document'; doc.fileExtension ='jpeg'; doc.documentId = '44'; ldocuments.add(doc); return ldocuments; } //Method used to structure the JSON format and return the Serialized JSON public static String getJsonPayload(){ String ActionemailBlrb ='Requesting for your electronic signature.\n\n'; String ActionemailBlrbSub ='Please help us in pulling your confidential credit information to process you Loan Application'; ActionemailBlrb=ActionemailBlrb + ActionemailBlrbSub; DocuSignUtil.DocuSignUtilJSON payload = new DocuSignUtil.DocuSignUtilJSON(); payload.recipients = DocuSignUtil.getReipients(); payload.emailSubject = 'Signature for fetching credit info'; payload.emailBlurb = ActionemailBlrb; payload.envelopeIdStamping = 'false'; payload.documents = DocuSignUtil.getAttachment(); payload.customFields = DocuSignUtil.getCustomFields(); payload.status ='sent'; payload.brandId = brandId; system.debug('serialized json '+JSON.serialize(payload)); return JSON.serialize(payload); } }Please help me in writing the test class
- mahesh p 54
- March 14, 2019
- Like
- 0
how to show lightning:dualListbox in modal box after clicking on a button
<aura:component controller="VerificationFilesController" Implements="flexipage:availableForRecordHome,force:hasRecordId,force:appHostable,flexipage:availableForAllPageTypes,force:lightningQuickAction" access="global" > <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:handler event="force:refreshView" action="{!c.doInit}" /> <aura:attribute name="recordError" type="String" access="private"/> <aura:attribute name="isMultiSelectOpen" type="boolean" /> <aura:attribute name="options" type="List" default="[]"/> <aura:attribute name="values" type="List" default="[]"/> <lightning:button variant="brand" label="Request for Additional Documents" title="Request for Additional Documents" onclick="{!c.openMultiSelectModel}"/> <aura:if isTrue="{!v.isMultiSelectOpen}"> <!--###### MODAL BOX Start From Here ######--> <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open "> <div class="slds-modal__container"> <!-- ###### MODAL BOX HEADER Part Start From Here ######--> <div class="slds-modal__header"> <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeReviewer}"> X <span class="slds-assistive-text">Close</span> </button> <h2 id="header99" class="slds-text-heading--medium">Review Document</h2> </div> <!--###### MODAL BOX BODY Part Start From Here ######--> <div class="slds-modal__content slds-p-around--medium slds-is-relative slds-scrollable"> <aura:if isTrue="{!v.showSpinner}"> <div class="demo-only" style="height:6rem;"> <div role="status" class="slds-spinner slds-spinner_medium slds-spinner_brand"> <span class="slds-assistive-text">Loading</span> <div class="slds-spinner__dot-a"></div> <div class="slds-spinner__dot-b"></div> </div> </div> <aura:set attribute="else"> <div class="slds-form-element slds-p-around--medium"> <lightning:dualListbox aura:id="selectOptions" name="multipleOptions" label= "Select Options" sourceLabel="Available Options" selectedLabel="Selected Options" options="{!v.options}" value="{!v.values}" onchange="{!c.handleChange}"/> </div> </aura:set> </aura:if> </div> <button class="slds-button slds-button--neutral" onclick="{!c.closeReviewer}" >Cancel</button> </div> </div> </div> <div class="slds-backdrop slds-backdrop--open"></div> <!--###### MODAL BOX Part END Here ######--> </aura:if>
({ doInit: function(component, event, helper) { var action1 = component.get('c.getTypeWiseDocuments'); //var typewisedocument = component.find("selectOptions"); action1.setCallback(this, function(response1) { var state = response1.getState(); if (component.isValid() && state == 'SUCCESS') { var documents = response1.getReturnValue(); var options = []; documents.forEach(function(document) { console.log(document); options.push({ value: document.Document_Name__c, label: document.Document_Name__c}); }); component.set("v.options", options); component.get("v.values"); alert(JSON.stringify(component.get("v.options"))); } else { console.log('Failed with state: ' + state); } }); $A.enqueueAction(action1); }, handleChange: function (cmp, event) { // This will contain an array of the "value" attribute of the selected options var selectedOptionValue =event.getParam("value"); alert("Option selected with value: '" + selectedOptionValue.toString() + "'"); }, openMultiSelectModel: function(component, event, helper) { // for Hide/Close Model,set the "isOpen" attribute to "Fasle" component.set("v.isMultiSelectOpen", true); alert(component.get("v.isMultiSelectOpen")); }, closeMultiSelectModel : function(component, event, helper) { component.set("v.isMultiSelectOpen", false); } })
public class VerificationFilesController { @AuraEnabled public static List<TypeWiseDocument__c> getTypeWiseDocuments(){ system.debug('getTypeWiseDocuments Controller'); List<TypeWiseDocument__c> twList = [SELECT ID,Document_Name__c FROM TypeWiseDocument__c where DocumentType__c = 'Additional']; return twList; } }
- mahesh p 54
- February 21, 2019
- Like
- 0
how to display contact details after clicking contact in lightning tree component
<!--Tree.cmp--> <aura:component controller="TreeAuraController"> <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> <aura:attribute name="items" type="Object"/> <!--Lightning Tree--> <div class="slds-m-around_xx-large"> <lightning:tree items="{!v.items}" onselect="{!c.handleSelect}" header="Account and Contacts"/> </div> <!--Lightning Spinner--> <div> <lightning:spinner alternativeText="Processing.." title="Processing.." aura:id="spnr" variant="brand" size="large" /> </div> </aura:component>
public class TreeAuraController { @AuraEnabled public static List<item> getAccountTree(){ List<item> items = new List<item>(); List<Account> acctList = new List<Account>(); //get list of accounts and respective contacts acctList = [SELECT Id, Name, (SELECT Id, Name From Contacts) From Account LIMIT 10]; for(Account acc: acctList){ //get contacts of current account record List<item> conitems = new List<item>(); for(Contact c: acc.Contacts){ //add contact items item conitem = new item(c.Name, String.valueOf(c.Id), false, null); conitems.add(conitem); } //add account items item accitem = new item(acc.Name, String.valueOf(acc.Id), false, conitems); items.add(accitem); } return items; } //Item Wrapper Class public class item{ @AuraEnabled public String label {get; set;} @AuraEnabled public String name {get; set;} @AuraEnabled public Boolean expanded {get; set;} @AuraEnabled public List<item> items {get; set;} public item(String label, String name, Boolean expanded, List<item> items){ this.label = label; this.name = name; this.expanded = expanded; this.items = items; } } }
({ doInit: function (component, event, helper) { var spinner = component.find("spnr"); var action = component.get('c.getAccountTree'); action.setCallback(this, function(response){ var state = response.getState(); if(state === 'SUCCESS'){ //get account and respective contact list, and initialize with items component.set('v.items', response.getReturnValue()); //hide spinner after getting data $A.util.toggleClass(spinner, "slds-hide"); }else{ $A.util.toggleClass(spinner, "slds-hide"); alert('ERROR'); } }); $A.enqueueAction(action); }, handleSelect: function (cmp, event, helper) { //return name of selected tree item var selectedName = event.getParam('name'); alert("Selected Name: " + selectedName); } })After i expand one contact its displaying list of contacts now i need to show the contact details when i click on particular contact under an account.
how could i achieve this?
- mahesh p 54
- November 06, 2018
- Like
- 0
test class for before insert
trigger Booking_5Appointments_perDay on Passport_Booking_Appointment__c (before insert) { if (Trigger.isBefore && Trigger.isInsert) { List<Id> passportSlotAvailabilities_ids = new List<Id>(); for(Passport_Booking_Appointment__c j:Trigger.new) { passportSlotAvailabilities_ids.add(j.Passport_Slot_Availability__c); } List<Passport_Booking_Appointment__c> other_bookings = [SELECT Id, CreatedDate, CreatedById,Passport_Slot_Availability__c FROM Passport_Booking_Appointment__c WHERE Passport_Slot_Availability__c IN : passportSlotAvailabilities_ids]; Map<id,integer> bookingAppointmentmap = new Map<id,integer> (); for (Passport_Booking_Appointment__c existent_record : other_bookings) { Date existent_record_created_date = existent_record.CreatedDate.date(); if (existent_record.CreatedById == UserInfo.getUserId() && existent_record_created_date == Date.today()) { if(bookingAppointmentmap.get(existent_record.Passport_Slot_Availability__c) == null) { bookingAppointmentmap.put(existent_record.Passport_Slot_Availability__c,1); } else { bookingAppointmentmap.put(existent_record.Passport_Slot_Availability__c,bookingAppointmentmap.get(existent_record.Passport_Slot_Availability__c)+1); } } } for (Passport_Booking_Appointment__c j : Trigger.new) { if(bookingAppointmentmap != null && bookingAppointmentmap.get(j.Passport_Slot_Availability__c) >=5) { j.addError('Cannot create Booking Appointment for your desired slot please come back tomorrow.'); } } } }can i get the test class for before insert trigger
- mahesh p 54
- October 24, 2018
- Like
- 0
how to redirect to another tab after clicking save button in one tab
<apex:page controller="PassportController" showHeader="false" sidebar="false" > <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js."></script> <script> $(window).load(function(){ $("#calYearPicker").html('') for(var i=1920;i<=2018;i++) { $("#calYearPicker").append("<option value'" + i +"'>" + i+ "</option>"); } }); </script> <style> * { margin: 0; padding: 0; } .tabs { list-style: none; width: 200px; float: left } .tabs a { display: block; padding: 10px 15px; text-decoration: none; background: #fff; color: #000; border-bottom: 1px solid #ccc; } .tabContent { margin-left: 200px; min-height: 300px; position:fixed; border: 1px solid #ccc; padding: 10px; } .tabs a.active { background: rgba(0,0,0,0.2); } .tabContent .tabBox { padding: -5px -5em; display: none } .tabContent .activeTab { display: block } </style> <script> $(document).ready(function(){ $('.tabs a').click(function(){ var tabId = $(this).attr('href'); $('.tabs a').removeClass('active'); $(this).addClass('active'); $('.tabContent .tabBox').removeClass('activeTab'); $(tabId).addClass('activeTab') }); }); </script> <ul class="tabs" > <li><a class="active" href="#tab1">Applicant Details</a></li> <li><a href="#tab2">Emergency Contact</a></li> <li><a href="#tab3">Identity Certificate/Passport Details</a></li> <li><a href="#tab4">Other Details</a></li> <li><a href="#tab5">Passport Details Verification</a></li> <li><a href="#tab6">Self Declaration</a></li> <li><a href="#tab7">Upload Document</a></li> <li><a href="#tab8">Book Appointment</a></li> </ul> <div class="tabContent"> <div class="tabBox activeTab" id="tab1"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Applicant Details"> <apex:inputField value="{!p.Given_Name__c}"> Firts Name + Middle Name</apex:inputField> <apex:inputField value="{!p.Surname_Max_45_Characters__c}"/> <apex:inputField value="{!p.Gender__c}"/> <apex:inputField value="{!p.Date_of_Birth_DD_MM_YYYY__c}"/> <apex:inputField value="{!p.Place_of_Birth_Village_Town_City__c}"/> <apex:inputField value="{!p.Marital_Status__c}"/> <apex:inputField value="{!p.PAN_if_available__c}"/> <apex:inputField value="{!p.Voter_Id_if_available__c}"/> <apex:inputField value="{!p.Educational_qualification__c}"/> <apex:inputField value="{!p.Aadhaar_Number_if_available__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="1" title="Family Details"> <apex:inputField value="{!p.Father_s_Name__c}"/> <apex:inputField value="{!p.Father_s_SurName__c}"/> <apex:inputField value="{!p.Legal_Guardian_s_Given_Name__c}"/> <apex:inputField value="{!p.Legal_Guardian_s_SurName__c}"/> <apex:inputField value="{!p.Mother_s_Name__c}"/> <apex:inputField value="{!p.Mother_s_SurName__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="1" title="Residential Address Details"> <apex:inputField value="{!p.Address_1__c}"/> <apex:inputField value="{!p.Address_2__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save" /> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab2"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Emergency Contact Details"> <apex:inputField value="{!p.Name__c}"/> <apex:inputField value="{!p.Mobile_Number__c}"/> <apex:inputField value="{!p.Email_ID__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab6"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Self Declaration"> <table style="empty-cells:hide;" border="1" cellpadding="1" cellspacing="1"> <tr> <td> Self Declaration <br/> I owe allegiance to the sovereignty , unity & integrity of India, and have not voluntarily acquired citizenship or travel document of any other country. I have not lost, surrendered or been deprived of the the citizenship of India and I affirm that the information given by me in this form and the enclosures is true and I solely responsible for its accuracy, and I am liable to be penalized or prosecuted if found otherwise. I am aware that under the Passport Act, 1967 it is a criminal offence to furnish any false information or to suppress any material information with a view to obtaining passport or travel document. </td> </tr> </table> <apex:pageBlockSectionItem > <apex:outputLabel for="request-true" value="I Agree"/> <apex:inputCheckbox id="request-true" value="{!p.Self_declaration_I_Agree__c}"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockButtons location="bottom"> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </div> <div class="tabBox" id="tab7"> <apex:form > <apex:pageMessages /> <apex:inputFile value="{!file}" /> <apex:commandbutton action="{!upload}" value="Upload" /> </apex:form> </div> <div class="tabBox" id="tab8"> <apex:form > <apex:pageMessages /> <apex:pageBlock > <apex:pageBlockSection columns="1"> <!--<apex:inputField value="{!pb.Passport_Applicant_Name__c}" />--> <apex:inputField value="{!pb.Passport_Slot_Availability__c}" /> <apex:inputField value="{!pb.Booking_Slots__c}" /> <apex:commandbutton action="{!Save}" value="SaveBookings" /> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </div> </div> </apex:page>
public with sharing class PassportController { public Passport_Application__c p { get; set; } public Passport_Booking_Appointment__c pb { get; set; } public ApexPages.StandardSetController stdCntrlr {get; set;} public PassportController(ApexPages.StandardSetController controller) { stdCntrlr = controller; } public Boolean Display{get;set;} public List<Passport_Application__c> ApplicantDetails { get; set; } public List<Passport_Application__c> EmergencyContactDetails { get; set; } public List<Passport_Application__c> SelfDeclaration { get; set; } //public List<Passport_Application__c> FamilyDetails { get; set; } //public List<Passport_Application__c> AddressDetails { get; set; } public List<Passport_Booking_Appointment__c> bookingappointments { get; set; } public Integer i=0; public Integer j=0; //Integer fieldNumber = Integer.ValueOf(pb.count__c.trim()); public PassportController(){ Display=false; p=new Passport_Application__c(); pb=new Passport_Booking_Appointment__c(); //pb.count__c=0; //listBookings=new list<Booking__c>(); //listBookings.add(b); } /*Public void addBookings() { Booking__c b = new Booking__c(); listBookings.add(b); } */ public PageReference save() { try { Display=true; p.Name=userInfo.getUserId(); p.Passport_Booking_Appointment__c=pb.Passport_Slot_Availability__c; p.Booking_Slots_c__c=pb.Booking_Slots__c; ApplicantDetails= [select id,Given_Name__c,Surname_Max_45_Characters__c,Gender__c,Date_of_Birth_DD_MM_YYYY__c,Place_of_Birth_Village_Town_City__c,Marital_Status__c,PAN_if_available__c,Voter_Id_if_available__c,Educational_qualification__c,Aadhaar_Number_if_available__c,Father_s_Name__c,Father_s_SurName__c,Legal_Guardian_s_Given_Name__c,Legal_Guardian_s_SurName__c,Mother_s_Name__c,Mother_s_SurName__c,Address_1__c,Address_2__c,Booking_Slots_c__c,Passport_Booking_Appointment__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id EmergencyContactDetails= [select id,Name__c,Mobile_Number__c,Email_ID__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id SelfDeclaration= [select id,Self_declaration_I_Agree__c from Passport_Application__c where id=:ApexPages.currentPage().getParameters().get('id') ];//c.id bookingappointments= [select id,Name,Booking_Slots__c from Passport_Booking_Appointment__c where id=:ApexPages.currentPage().getParameters().get('id') ]; //upsert p; pb.Name=p.Name; pb.Passport_Application__c=p.Id; //ApexPages.currentPage().getParameters().get('id'); upsert pb; upsert p; i=i+1; if(i==1 ) { ApexPages.AddMessage(new ApexPages.Message(ApexPages.severity.CONFIRM,'Record Created Successfully.Thank you!')); //p=null; //PageReference pg = new PageReference('/apex/Fresh_passport?id=' + p.Id + '#tab2'); //pg.setRedirect(true); //return pg; } } catch(Exception ex){ ApexPages.addMessages(ex); } return null; } public blob file { get; set; } public PageReference upload() { ContentVersion v = new ContentVersion(); v.versionData = file; v.title = 'testing upload'; v.pathOnClient ='/somepath.jpg'; insert v; return new PageReference('/' + v.id); } }After i click save button on tab1 it should upsert into custom object which is working absolutely fine but after clicking save i need to navigate to tab2 which is emergency contact and after clicking save in that tab it should navigate to tab3 which is Identity certificate/passport details and so on.
Help me in meeting this requirement
- mahesh p 54
- October 17, 2018
- Like
- 0
There are 2 Custom objects Passport_Slot_Availability__c and Passport_Booking_Appointment__c.They both have master detail relationship. where Passport_Slot_Availability__c is master and Passport_Booking_Appointment__c is detail.
Requirement: For a day only 5 passport bookings should be created by the users for a particular Passport Slot. On the same day when the 6th user is trying to create another passport booking for the same passport slot as that of 5 users, error message should be thrown. But on the next day the user should be able to create a new passport booking for that same passport slot if available.
trigger Booking_5Appointments_perDay on Passport_Booking_Appointment__c (before insert) { if (Trigger.isBefore && Trigger.isInsert) { List<Id> passportSlotAvailabilities_ids = new List<Id>(); for(Passport_Booking_Appointment__c j:Trigger.new) { passportSlotAvailabilities_ids.add(j.Passport_Slot_Availability__c); } List<Passport_Booking_Appointment__c> other_bookings = [SELECT Id, CreatedDate, CreatedById,Passport_Slot_Availability__c FROM Passport_Booking_Appointment__c WHERE Passport_Slot_Availability__c IN : passportSlotAvailabilities_ids]; for (Passport_Booking_Appointment__c j : Trigger.new) { for (Passport_Booking_Appointment__c existent_record : other_bookings) { if (j.Passport_Slot_Availability__c == existent_record.Passport_Slot_Availability__c && j.CreatedById == UserInfo.getUserId()) { Date existent_record_created_date = existent_record.CreatedDate.date(); if (existent_record_created_date == Date.today()) { j.addError('Cannot create Booking Appointment because limit has exceeded for today.'); } } } } } }
- mahesh p 54
- October 16, 2018
- Like
- 0
Vf page Open?
If i click on new Button this page should be open?
what is the process.
<apex:page standardController="Order">
<apex:form>
<apex:pageBlock title="OrderEdit">
<apex:pageBlockButtons location="Top">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Delete" action="{!Delete}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Order Information">
<apex:inputField value="{!order.name}"/>
<apex:inputField value="{!order.AccountId}"/>
<apex:inputField value="{!order.ContractId}"/>
<apex:inputField value="{!order.Status}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
what is the process.
<apex:page standardController="Order">
<apex:form>
<apex:pageBlock title="OrderEdit">
<apex:pageBlockButtons location="Top">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Delete" action="{!Delete}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Order Information">
<apex:inputField value="{!order.name}"/>
<apex:inputField value="{!order.AccountId}"/>
<apex:inputField value="{!order.ContractId}"/>
<apex:inputField value="{!order.Status}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
- Srikanth Cheera 16
- October 12, 2018
- Like
- 0
how to add functionality to a single button of downloading pdf,sending email and attaching as an attachment on a custom object record
<apex:page extensions="SaveAndOpenPDF" renderAs="{!renderAs}" standardController="Booking__c"> PDF Content Goes Here <apex:form > <apex:outputField value="{!Booking__c.Customer__r.Name}"></apex:outputField> <apex:outputField value="{!Booking__c.Name}"></apex:outputField><br/> <apex:pageBlock title="Customer"> <apex:pageBlockSection columns="2" title="Basic Information"> <apex:outputField value="{!Booking__c.Customer__r.Name}"/> <br/> <apex:outputField value="{!Booking__c.Customer__r.Address_1__c}"/> <apex:outputField value="{!Booking__c.Customer__r.Address_2__c}"/> <apex:outputField value="{!Booking__c.Customer__r.Country__c}"/> <apex:outputField value="{!Booking__c.Customer__r.States__c}"/> <apex:outputField value="{!Booking__c.Customer__r.city__c}"/> <apex:outputField value="{!Booking__c.Customer__r.Zip_Code__c}"/> <apex:outputField value="{!Booking__c.Customer__r.Account__c}"/> <apex:outputField value="{!Booking__c.Customer__r.Customer_Email__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="2" title="Tour Information"> <apex:outputField value="{!Booking__c.Customer__r.Passport_Number__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="2" title="Health Information"> <apex:outputField value="{!Booking__c.Customer__r.Blood_Group__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="1" title="Tour Packages" > <apex:pageBlockTable value="{!Booking__c}" var="b"> <apex:column headerValue="Type a Destination"> <apex:outputField value="{!Booking__c.Type_a_destination__c}"/> </apex:column> <apex:column headerValue="Travel Mode"> <apex:outputField value="{!Booking__c.Travel_Mode__c}"/> </apex:column> <apex:column headerValue="From Date"> <apex:outputField value="{!Booking__c.From_Date__c}"/> </apex:column> <apex:column headerValue="To Date"> <apex:outputField value="{!Booking__c.To_Date__c}"/> </apex:column> <br/> <apex:column headerValue="Bookings for Customer"> <apex:outputField value="{!Booking__c.Customer__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
public with sharing class SaveAndOpenPDF { public final Customer__c customer; public SaveAndOpenPDF(){ customer = [select id,Name,Address_1__c,Address_2__c,Country__c,States__c,city__c,Zip_Code__c,Account__c,Passport_Number__c,Blood_Group__c from Customer__c where id=:ApexPages.currentPage().getParameters().get('id') ];//= :ApexPages.currentPage().getParameters().get('id') } public Customer__c getCustomer() { return customer; } public String recordId { get { return ApexPages.currentPage().getParameters().get('Id'); } } //String blobVal = EncodingUtil.base64Encode(pdfbody); //String pdfBlobString = 'data:application/pdf;content-disposition:attachment;base64,'+blobVal; public ApexPages.StandardController stdCntrlr {get; set;} public SaveAndOpenPDF(ApexPages.StandardController controller) { stdCntrlr = controller; } // this is to make testing a lot easier -- simply append renderAs=html // to the url parameters to test, add displayOnly=1 if you don't want to save public String renderAs { get { if (String.isBlank(ApexPages.currentPage().getParameters().get('renderAs'))) { return 'pdf'; } else { return ApexPages.currentPage().getParameters().get('renderAs'); } } } public PageReference saveAndOpenPDF() { if (String.isBlank(ApexPages.currentPage().getParameters().get('displayOnly'))) { Id attachmentId = savePDF(); return openPDF(attachmentId); } else { return null; } } public Id savePDF() { Attachment attachment = new Attachment(); attachment.ParentId = recordId; attachment.name = 'Customer_Booking_Details_PDF_'+String.valueof(Datetime.now())+'.pdf'; PageReference pdf = Page.SaveAndOpenPDF; pdf.getParameters().put('Id', recordId); pdf.getParameters().put('displayOnly', '1'); pdf.setRedirect(true); try { attachment.Body = pdf.getContent(); } catch (VisualForceException e) { attachment.Body = Blob.valueof('There was an error.'); } attachment.ContentType = 'application/pdf'; insert attachment; return attachment.Id; } public PageReference openPDF(Id attachmentId) { PageReference ret = new PageReference('/servlet/servlet.FileDownload?file=' + attachmentId); ret.setRedirect(true); return ret; } }
I created a custom button named Generate Itinerary on Booking Custom object page layout.When i click that I can view PDF with the details which i put in my VF page but now i need to add features like send an email to custom field and attach it to the booking custom object with the single button Generate Itinerary.
- mahesh p 54
- October 11, 2018
- Like
- 0
- mahesh p 54
- October 05, 2018
- Like
- 0
After I click save button i need to display section
<apex:page Controller="CustomerController" > <apex:form > <apex:pageBlock title="Customer"> <apex:pageBlockSection columns="2" title="Basic Information"> <apex:inputField value="{!c.Name}"/> <br/> <apex:inputField value="{!c.Address_1__c}"/> <apex:inputField value="{!c.Address_2__c}"/> <apex:inputField value="{!c.Country__c}"/> <apex:inputField value="{!c.States__c}"/> <apex:inputField value="{!c.city__c}"/> <apex:inputField value="{!c.Zip_Code__c}"/> <apex:inputField value="{!c.Account__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="2" title="Tour Information"> <apex:inputField value="{!c.Passport_Number__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="2" title="Health Information"> <apex:inputField value="{!c.Blood_Group__c}"/> </apex:pageBlockSection> <apex:pageBlockSection columns="1" title="Tour Packages"> </apex:pageBlockSection> <apex:pageBlockTable value="{!listBookings}" var="b"> <apex:column headerValue="Type a Destination"> <apex:inputField value="{!b.Type_a_destination__c}"/> </apex:column> <apex:column headerValue="Travel Mode"> <apex:inputField value="{!b.Travel_Mode__c}"/> </apex:column> <apex:column headerValue="From Date"> <apex:inputField value="{!b.From_Date__c}"/> </apex:column> <apex:column headerValue="To Date"> <apex:inputField value="{!b.To_Date__c}"/> </apex:column> <br/> <apex:column headerValue="Bookings for Customer"> <apex:inputField value="{!b.Customer__c}"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockButtons > <apex:commandButton value="Add Multiple Bookings" action="{!addBookings}"/> <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> <!--<apex:pageBlockTable value="{!samepage}" var="c"> <!--<apex:column headerValue="Name"> <apex:outputField value="{!c.name}"/> </apex:column> <apex:column headerValue="Address 1"> <apex:outputField value="{!c.Address_1__c}"/> </apex:column> <apex:column headerValue="Address 2"> <apex:outputField value="{!c.Address_2__c}"/> </apex:column> </apex:pageBlockTable>--> </apex:pageBlock> </apex:form> </apex:page>
public with sharing class CustomerController { Booking__c b=new Booking__c(); public list<Booking__c> listBookings{ get; set; } public Customer__c c { get; set; } public List<Customer__c> samepage { get; set; } public CustomerController(){ c=new Customer__c(); listBookings=new list<Booking__c>(); listBookings.add(b); } Public void addBookings() { Booking__c b = new Booking__c(); listBookings.add(b); } public PageReference save() { upsert c; upsert b; samepage= [select id,Name,Address_1__c,Address_2__c,Country__c,States__c,city__c,Zip_Code__c,Account__c,Passport_Number__c,Blood_Group__c,Type_a_Destination__c,From_Date__c,To_Date__c from Customer__c where id=:c.id]; return null; } public PageReference saveBookings() { for(Integer i=0; i<listBookings.size(); i++) { insert listBookings; } upsert c; upsert b; return Page.Allbookingssaved; } }
Initially Tour Packages and Add Multiple Bookings should not be displayed.When i click save button the Tour Package section with Add Multiple Bookings needs to display.How can i achieve this?
- mahesh p 54
- October 05, 2018
- Like
- 0