-
ChatterFeed
-
1Best Answers
-
1Likes Received
-
0Likes Given
-
31Questions
-
31Replies
Need help with a test class
Hi,
I've been trying to write a test class for this Apex class that is the controller for a lightning:fileUploader that uploads files and shows a list of the uploaded files. I've worked on it for a while now and nothing has worked so far. Can someone give me some assistance?
Apex class:
I've been trying to write a test class for this Apex class that is the controller for a lightning:fileUploader that uploads files and shows a list of the uploaded files. I've worked on it for a while now and nothing has worked so far. Can someone give me some assistance?
Apex class:
public class fileUploaderClass { @AuraEnabled public static List<ContentDocument> getFiles(string recordId){ List<ContentDocument> DocumentList = new List<ContentDocument>(); Set<Id> documentIds = new Set<Id>(); //store file ids List<ContentDocumentLink> cdl=[select id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where LinkedEntityId=:recordId]; for(ContentDocumentLink cdLink:cdl){ documentIds.add(cdLink.ContentDocumentId); // Document ids } DocumentList = [select Id,Title,FileType,ContentSize,Description from ContentDocument where id IN: documentIds]; return DocumentList; } @AuraEnabled public static List<ContentDocument> UpdateFiles(string documentId,string title,string recordId){ system.debug('title: ' +title); ContentDocument cd = [select id,title from ContentDocument where Id=:documentId]; // Getting files from Parent record cd.Title = title; // Changing file Title with user entered title try{ update cd; // Update ContentDocument (File) } catch(DMLException e){ system.debug('Exception has occurred! ' +e.getMessage()); } List<ContentDocument> DocumentList = new List<ContentDocument>(); Set<Id> documentIds = new Set<Id>(); List<ContentDocumentLink> cdl=[select id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where LinkedEntityId=:recordId]; for(ContentDocumentLink cdLink:cdl){ documentIds.add(cdLink.ContentDocumentId); } DocumentList = [select Id,Title,FileType,ContentSize,Description from ContentDocument where id IN: documentIds]; return DocumentList; // Return list of files on parent record } }
- Luke Higgins 22
- October 10, 2019
- Like
- 0
- Continue reading or reply
How to change child record owner if i change the owner of parent record?
Hi all,
In account object if i change the owner of parent object then all the child record account get changed upto 3 level.
For eg.
ABC(parent)---->XYZ(child)-->MNO(child of XYZ).
If i change owner of ABC then the owner of XYZ and MNO also got changed
Thanks in advance
In account object if i change the owner of parent object then all the child record account get changed upto 3 level.
For eg.
ABC(parent)---->XYZ(child)-->MNO(child of XYZ).
If i change owner of ABC then the owner of XYZ and MNO also got changed
Thanks in advance
- Uttpal chandra
- October 04, 2019
- Like
- 0
- Continue reading or reply
How to track email?
Hi all,
I am sending email to the user using schedualable class and Batch class on every monday.
What i want to do is i want track the email that has been sent to the user?
Anyone know how to do it.
I am sending email to the user using schedualable class and Batch class on every monday.
What i want to do is i want track the email that has been sent to the user?
Anyone know how to do it.
- Uttpal chandra
- July 04, 2019
- Like
- 0
- Continue reading or reply
Lightning component is not visible in Salesforce mobile 1 app
Hi all,
I have created lightning component in salesforce and placed it is on related list and it is visible in desktop but not visble in mobile app in salesforce.
I have created lightning component in salesforce and placed it is on related list and it is visible in desktop but not visble in mobile app in salesforce.
Anyonw know what is the problem.
- Uttpal chandra
- May 30, 2019
- Like
- 0
- Continue reading or reply
Prevent user to stop editing child record
Hi all,
I have one picklist value Status on master object if status value changes from New to Pending i want to prevent user from stop editing child record anyone know how to achieve that..??
I have one picklist value Status on master object if status value changes from New to Pending i want to prevent user from stop editing child record anyone know how to achieve that..??
- Uttpal chandra
- May 27, 2019
- Like
- 0
- Continue reading or reply
Approval process not working
I all i have created a Approval process in salesforce and it is working fine with standard page but when i had put custom vf page in Edit button it is not working correctly.
When i had submit the record for approval it is still editing the record when i am using custom VF page and also it is still editing the record after it is approved
When i had submit the record for approval it is still editing the record when i am using custom VF page and also it is still editing the record after it is approved
- Uttpal chandra
- May 25, 2019
- Like
- 0
- Continue reading or reply
Select2 or Searchable dropdown
Hi all,
I want to implement searchable dropdown or select2 in my vf page in apex:selectList but when i use jquery of Select2 it is not workig.
I tried by both giving static resource and also used <script src> but nothing is working any one know what i am doing wrong?
Thnaks in advance
I want to implement searchable dropdown or select2 in my vf page in apex:selectList but when i use jquery of Select2 it is not workig.
I tried by both giving static resource and also used <script src> but nothing is working any one know what i am doing wrong?
Thnaks in advance
- Uttpal chandra
- May 21, 2019
- Like
- 0
- Continue reading or reply
Iframe redirect is not working in mobile?
Hi all,
I have created on lightning component using iframe in which i embeded a vf page.
It is working fine in Desktop/PC but in mobile app it is not redirecting to the Parent page.
I have created on lightning component using iframe in which i embeded a vf page.
It is working fine in Desktop/PC but in mobile app it is not redirecting to the Parent page.
- Uttpal chandra
- May 14, 2019
- Like
- 0
- Continue reading or reply
Child1 to parent to child2 SOQL query
Hi all,
Currently i am on a child1 and i want to write a query anyone know how to do it?
Currently i am on a child1 and i want to write a query anyone know how to do it?
- Uttpal chandra
- May 08, 2019
- Like
- 0
- Continue reading or reply
CSS not working when convert to Pdf
Hi All,
When i try to convert the below page into Pdf using renderAs="Pdf" its CSS not working correctly and table got disturbed.
<apex:page applyHtmlTag="false" showHeader="false" applyBodyTag="false"> <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/> <title>Generating HTML DEMO</title> <link href="https://fonts.googleapis.com/css?family=Fira+Sans+Condensed:400,700" rel="stylesheet" /> <style type="text/css"> h1, h2, h3, h4, h5, h6{ margin: 0; } body{ font-family: 'Fira Sans Condensed', sans-serif; font-size: 1rem; color: #3a3a3a; font-weight: 400; } </style> </head> <body style="padding: 0; margin: 0; font-family: 'Fira Sans Condensed', sans-serif;"> <!-- Main Table --> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td align="center"> <!-- Main Table --> <table width="70%" border="0" cellspacing="0" cellpadding="0"> <!-- Start Header Heading ( Section 1)--> <tr> <td align="center" width="100%"> <table width="100%"> <tr> <td align="center"> <h2>Main Heading top level </h2> </td> </tr> <tr> <td align="center"> <h5>(This line contain some data and it is below the main heading and top of the table and displaying some data...... New data and not showing)</h5> </td> </tr> </table> </td> </tr> <!-- End Header Heading (Section 1)--> <tr> <td> <table border="1" style="border-collapse: collapse;" cellpadding="0" cellspacing="0" align="center" width="100%"> <!-- Start Left Side --> <td width="40%" valign="top"> <table> <tr> <td> <table class="table" cellpadding="0" cellspacing="15" style="border-bottom: 1px solid;"> <tr> <td> <h2>Line 1</h2> </td> </tr> <tr> <td>Line 2</td> </tr> <tr> <td>Line 3</td> </tr> <tr> <td>Line 4</td> </tr> <tr> <td>Line 5</td> </tr> <tr> <td>Line 6</td> </tr> <tr> <td>Line 7</td> </tr> <tr> <td>Line 8</td> </tr> <tr> <td>Line 1324567981021354564654654654646546</td> </tr> </table> </td> </tr> <!-- Left Bottom Information --> <tr> <td> <table class="table" cellpadding="0" cellspacing="15"> <tr> <td> <h2>Line 1</h2> </td> </tr> <tr> <td> Line 1 </td> </tr> <tr> <td> Line 1 </td> </tr> <tr> <td> Line 1 </td> </tr> <tr> <td> Line 1 </td> </tr> </table> </td> </tr> </table> </td> <td width="60%" valign="top"> <table class="table" width="100%"> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data 1</td> </tr> <tr> <td><strong>Answer 1</strong></td> </tr> </table> </td> <td width="50%"> <table> <tr> <td>Data</td> </tr> <tr> <td><strong>Answer </strong></td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 1 --> <!-- Start Column 2 --> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> <td width="50%"> <table> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 2 --> <!-- Start Column 3 --> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> <td width="50%"> <table> <tr> <td>Data</td> </tr> <tr> <td><strong>Answer </strong></td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 3 --> <!-- Start Column 4 --> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> <td width="50%"> <table> <tr> <td>Data</td> </tr> <tr> <td><strong>Answer </strong></td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 4 --> <!-- Start Column 5 --> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data.</td> </tr> <tr> <td> </td> </tr> </table> </td> <td width="50%"> <table> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 5 --> <!-- Start Column 6 --> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> <td width="50%"> <table> <tr> <td>Data</td> </tr> <tr> <td> </td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 6 --> <!-- Start Column 7 --> <tr> <td> <table width="100%" style="border-bottom: 1px solid #000;"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data: <strong>Answer </strong></td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 7 --> <!-- Start Column 7 --> <tr> <td> <table width="100%"> <tr> <td width="50%"> <table cellpadding="2" cellspacing="0"> <tr> <td>Data</td> </tr> </table> </td> </tr> </table> </td> </tr> <!-- End Column 7 --> </table> </td> <!-- End Right Side --> </table> </td> </tr> <!-- Company Info Row Start (Section 2) --> <tr> <td height="30"></td> </tr> </table> </td> </tr> </tbody> </table> <!-- End Main Table --> </body> </html> </apex:page>
Anyone why it is not working?
- Uttpal chandra
- April 26, 2019
- Like
- 0
- Continue reading or reply
Could not resolve field 'Website' from <apex:outputField> value binding '{!con.Website}' in page Abc
Hi All,
Need help on this
Getting Error: Could not resolve field 'Website' from <apex:outputField> value binding '{!con.Website}' in page Abc
1.Controller
2.Vf Page
Need help on this
Getting Error: Could not resolve field 'Website' from <apex:outputField> value binding '{!con.Website}' in page Abc
1.Controller
public class Abc { public Dist__c con{get;set;} public Abc(){ Id conId = apexpages.currentpage().getparameters().get('id'); con = [SELECT id,name, (select website,Rating,industry,SLA__c from Accounts__r)from Dist__c WHERE Id=: conId]; } }
2.Vf Page
<apex:page controller="Abc"> <apex:pageBlock> <apex:pageBlockSection columns="1"> <apex:outputField Value="{!con.Website}"/> <apex:outputField Value="{!con.Rating}"/> <apex:outputField Value="{!con.Industry}"/> <apex:outputField Value="{!con.SLA__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:page>
- Uttpal chandra
- April 23, 2019
- Like
- 0
- Continue reading or reply
Custom button for sending Email in Custom Object in Lightning
Hi All,
I had created a one custom object and in that there is one custom field Email id.
I have also created a custom Detail page button So whenever user click on that button it should send Email to that particular email id which is defined in that Custom Object with pdf which contain detail of the current record.
I have to implement this in Lightning.
I had created a one custom object and in that there is one custom field Email id.
I have also created a custom Detail page button So whenever user click on that button it should send Email to that particular email id which is defined in that Custom Object with pdf which contain detail of the current record.
I have to implement this in Lightning.
- Uttpal chandra
- April 17, 2019
- Like
- 0
- Continue reading or reply
How to send email on custom button
Hi all,
I want to send an email as well as pdf which contain the fields of contacts whenever user click on custom send email button.
I want to send an email as well as pdf which contain the fields of contacts whenever user click on custom send email button.
- Uttpal chandra
- April 15, 2019
- Like
- 0
- Continue reading or reply
Can't able to write "Select All" label in Checkbox?
Hi All,
I have used wrapper class and I have implemented checkbox but I can't able to write "Select all" beside the topmost checkbox.
Thanks in advance
I have used wrapper class and I have implemented checkbox but I can't able to write "Select all" beside the topmost checkbox.
Thanks in advance
- Uttpal chandra
- April 08, 2019
- Like
- 0
- Continue reading or reply
How to write a test class for this apex classs
Hi Anyone help me how to write test class for this ?
Thanks in advance
public class theController { public List<Wrapper> contactList {get; set;} public static String mass {get;set;} public static boolean saveSuccessful {get; set;} public static string message {get; set;} ID Id = ApexPages.currentPage().getParameters().get('id'); public Integer offSetSize = 0; public Integer QueryLimit = 10; public Integer countTotalRecords{get;set;} public theController(ApexPages.StandardController controller){ countTotalRecords = [SELECT count() FROM Activity_Template__c WHERE For_Which_Object__c = 'Account']; } public List<Wrapper> getContacts() { if(contactList == null) { contactList = new List<Wrapper>(); for(Activity_Template__c c: [Select Name,Template_Tool_Tip__c,Template_Type__c FROM Activity_Template__c WHERE For_Which_Object__c = 'Account' LIMIT :QueryLimit OFFSET :offSetSize ]) { contactList.add(new Wrapper(c)); } } return contactList; } public boolean getprv(){ if(offSetSize > 0) return false; else return true; } public boolean getnxt(){ if(offSetSize + queryLimit < CountTotalRecords ) return false; else return true; } public PageReference nextbtn(){ contactList=null; offSetSize += queryLimit ; return null; } public PageReference prvbtn(){ contactList=null; offSetSize -= queryLimit ; return null; } public Integer getPageNumber() { return offSetSize/QueryLimit + 1; } public Integer getTotalPages() { if (math.mod(countTotalRecords, QueryLimit) > 0) { return countTotalRecords/QueryLimit + 1; } else { return (countTotalRecords/QueryLimit); } } public PageReference processSelected() { List<Activity_Template__c> selectedContacts = new List<Activity_Template__c>(); for(Wrapper cCon: getContacts()) { if(cCon.selected == true) { selectedContacts.add(cCon.con); } } for(Activity_Template__c con: selectedContacts) { system.debug(con); } // addParentAccount(id,selectedContacts); contactList=null; return null; } public class Wrapper { public Activity_Template__c con {get; set;} public Boolean selected {get; set;} public Wrapper(Activity_Template__c c) { con = c; selected = false; } } }
Thanks in advance
- Uttpal chandra
- March 28, 2019
- Like
- 0
- Continue reading or reply
How to create dynamic iframe using javascript?
Hi all,
Right now I am creating a pop on detail page button.Everything is fine except it's height can anyone help me on how to create a dynamic iframe using javascript?
Here is my code.
Thanks in advance
Right now I am creating a pop on detail page button.Everything is fine except it's height can anyone help me on how to create a dynamic iframe using javascript?
Here is my code.
(function() { var width = 700; var height = 515; var title = "Dialog title here"; var box = new SimpleDialog("salesforce" + Math.random(), true); box.setTitle(title); box.displayX = true; box.isMovable = false; box.createDialog(); box.setWidth(width); // set your html content here box.setContentInnerHTML( '<iframe src="/apex/toastmessage?Id={!Account.Id}" style="border:none;" width="100%" height="'+ (height - 30)+'px" />' ); //set the height of the modal box.dialog.children[1].style.height = height + 'px'; box.show(); //if displayX is set to true, then override standard close event by this code box.dialog.getElementsByClassName('dialogClose')[0].onclick = function() { box.hide(); // you can add code to reload the page or redirect to another page }; //optional : add this to close the modal onclick of the overlay background box.background.addEventListener('click', function() { box.hide(); }); // if you want to be able to close the modal from the Visualforce page window.addEventListener('message', function(event){ if (event.data === 'close'){ box.hide(); } }); })();
Thanks in advance
- Uttpal chandra
- March 25, 2019
- Like
- 1
- Continue reading or reply
How to display record using next button?
Hi all,
I have dispaly 10 record in Pop Up uisng rows=10 in apex:pageBlockTable.
So I want to create a Custom "Next" button in Pop Up which can display the remaining record in Pop up.
Thanks in advance
I have dispaly 10 record in Pop Up uisng rows=10 in apex:pageBlockTable.
So I want to create a Custom "Next" button in Pop Up which can display the remaining record in Pop up.
Thanks in advance
- Uttpal chandra
- March 19, 2019
- Like
- 0
- Continue reading or reply
How to display message using java script?
Hi All,
I have VF page in which I have one command button if supose user insert the data suceesfully it should display message "Record is inserted" and if some error occur it should display message "Record is not created".
Thanks in advance
I have VF page in which I have one command button if supose user insert the data suceesfully it should display message "Record is inserted" and if some error occur it should display message "Record is not created".
<apex:commandButton action="{!processSelected}" value="Run Template" onComplete="Refresh();"/>
Thanks in advance
- Uttpal chandra
- March 15, 2019
- Like
- 0
- Continue reading or reply
How to get id when user click on Detail Page Button
Hi All,
Currently When a user is clicking on Detail Page Button I am loading a javscript to create a Pop up. But I am not able to fetch Id of a record.
Anyone help me on this.
javascriptcode
Thanks in advance
Currently When a user is clicking on Detail Page Button I am loading a javscript to create a Pop up. But I am not able to fetch Id of a record.
Anyone help me on this.
javascriptcode
(function() { var width = 500; var height = 300; var title = "Run Template"; var box = new SimpleDialog("salesforce" + Math.random(), true); box.setTitle(title); box.displayX = true; box.isMovable = false; box.createDialog(); box.setWidth(width); // set your html content here box.setContentInnerHTML( '<iframe src="/apex/RunTemplate" style="border:none;" width="100%" height="'+ (height - 30)+'px" />' ); //set the height of the modal box.dialog.children[1].style.height = height + 'px'; box.show(); //if displayX is set to true, then override standard close event by this code box.dialog.getElementsByClassName('dialogClose')[0].onclick = function() { box.hide(); // you can add code to reload the page or redirect to another page }; //optional : add this to close the modal onclick of the overlay background box.background.addEventListener('click', function() { box.hide(); }); // if you want to be able to close the modal from the Visualforce page window.addEventListener('message', function(event){ if (event.data === 'close'){ box.hide(); } }); })();
Thanks in advance
- Uttpal chandra
- March 11, 2019
- Like
- 0
- Continue reading or reply
Pop up on detail page button
Hi all,
I had created one Visualforce page and i want to implement that as a pop up on a Detail Page button.
Right now when i click on a button it automatically move to that vf page.
Thanks in Advance
I had created one Visualforce page and i want to implement that as a pop up on a Detail Page button.
Right now when i click on a button it automatically move to that vf page.
Thanks in Advance
- Uttpal chandra
- March 06, 2019
- Like
- 0
- Continue reading or reply
Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}
Hi,
Anyone Solve this.
I am trying to save record using Lightning component but i am getting error "Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}"
Below I have mentioned my class.
Hello.cmp
helloController.js
harness.app
CreateCandidateRecord.apxc
Thanks in advance
Uttpal
Anyone Solve this.
I am trying to save record using Lightning component but i am getting error "Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}"
Below I have mentioned my class.
Hello.cmp
<aura:component controller="CreateCandidateRecord"> <aura:attribute name="Tax" type="Taxes__c" default="{'sobjectType': 'Taxes__c', 'Name': '', 'Last_Name__c': '', 'SSN__c': '' }"/> <aura:attribute name="Id" type="String"/> <lightning:input value="{v.Tax.Name}" label="Name" placeholder="Enter name......" /> <lightning:input value="{v.Tax.Last_Name__c}" label="Last Name" placeholder="Enter Last name......" /> <lightning:input value="{v.Tax.SSN__c}" label="SSN No" placeholder="Enter SSN No....." /> <lightning:button variant="brand" label="Save" title="Save" onclick="{!c.doSave}" /> </aura:component>
helloController.js
({ doSave : function(component,event,helper) { var action = component.get("c.createRec"); action.setParams({'contObj':component.get('v.Tax')}); action.setCallback(this,function(data){ componnet.set('v.Id',data.getReturnValue()) }); $A.enqueueAction(action); } })
harness.app
<aura:application extends="force:slds" > <c:hello/> </aura:application>
CreateCandidateRecord.apxc
public class CreateCandidateRecord { @AuraEnabled public static string createRec(Taxes__c contObj){ System.debug('Taxes::' +contObj.Name); insert contObj; return contObj.Id; } }
Thanks in advance
Uttpal
- Uttpal chandra
- February 21, 2019
- Like
- 0
- Continue reading or reply
How to create dynamic iframe using javascript?
Hi all,
Right now I am creating a pop on detail page button.Everything is fine except it's height can anyone help me on how to create a dynamic iframe using javascript?
Here is my code.
Thanks in advance
Right now I am creating a pop on detail page button.Everything is fine except it's height can anyone help me on how to create a dynamic iframe using javascript?
Here is my code.
(function() { var width = 700; var height = 515; var title = "Dialog title here"; var box = new SimpleDialog("salesforce" + Math.random(), true); box.setTitle(title); box.displayX = true; box.isMovable = false; box.createDialog(); box.setWidth(width); // set your html content here box.setContentInnerHTML( '<iframe src="/apex/toastmessage?Id={!Account.Id}" style="border:none;" width="100%" height="'+ (height - 30)+'px" />' ); //set the height of the modal box.dialog.children[1].style.height = height + 'px'; box.show(); //if displayX is set to true, then override standard close event by this code box.dialog.getElementsByClassName('dialogClose')[0].onclick = function() { box.hide(); // you can add code to reload the page or redirect to another page }; //optional : add this to close the modal onclick of the overlay background box.background.addEventListener('click', function() { box.hide(); }); // if you want to be able to close the modal from the Visualforce page window.addEventListener('message', function(event){ if (event.data === 'close'){ box.hide(); } }); })();
Thanks in advance
- Uttpal chandra
- March 25, 2019
- Like
- 1
- Continue reading or reply
how to pass wrapper class as parameter to another method which is in another class in apex?
I have a wrapper class and we are deserializing the JSON data, and now we have to send that wrapper class to another method which is in another class.
1. Q1)How we have to send it as a parameter?
2. Q2)How to access it in another class?
This is what our approach till now.
- JSONWrapper --- Name of the Wrapper class
- request --- Contains Json data
- mapRequest1 --- Contains Deserialized data
1. Q1)How we have to send it as a parameter?
2. Q2)How to access it in another class?
This is what our approach till now.
JSONWrapper mapRequest1 = (JSONWrapper) JSON.deserialize(request.requestBody.toString(),JSONWrapper.class);
- JSONWrapper --- Name of the Wrapper class
- request --- Contains Json data
- mapRequest1 --- Contains Deserialized data
- Naveen Sana
- October 12, 2019
- Like
- 0
- Continue reading or reply
Need help with a test class
Hi,
I've been trying to write a test class for this Apex class that is the controller for a lightning:fileUploader that uploads files and shows a list of the uploaded files. I've worked on it for a while now and nothing has worked so far. Can someone give me some assistance?
Apex class:
I've been trying to write a test class for this Apex class that is the controller for a lightning:fileUploader that uploads files and shows a list of the uploaded files. I've worked on it for a while now and nothing has worked so far. Can someone give me some assistance?
Apex class:
public class fileUploaderClass { @AuraEnabled public static List<ContentDocument> getFiles(string recordId){ List<ContentDocument> DocumentList = new List<ContentDocument>(); Set<Id> documentIds = new Set<Id>(); //store file ids List<ContentDocumentLink> cdl=[select id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where LinkedEntityId=:recordId]; for(ContentDocumentLink cdLink:cdl){ documentIds.add(cdLink.ContentDocumentId); // Document ids } DocumentList = [select Id,Title,FileType,ContentSize,Description from ContentDocument where id IN: documentIds]; return DocumentList; } @AuraEnabled public static List<ContentDocument> UpdateFiles(string documentId,string title,string recordId){ system.debug('title: ' +title); ContentDocument cd = [select id,title from ContentDocument where Id=:documentId]; // Getting files from Parent record cd.Title = title; // Changing file Title with user entered title try{ update cd; // Update ContentDocument (File) } catch(DMLException e){ system.debug('Exception has occurred! ' +e.getMessage()); } List<ContentDocument> DocumentList = new List<ContentDocument>(); Set<Id> documentIds = new Set<Id>(); List<ContentDocumentLink> cdl=[select id,LinkedEntityId,ContentDocumentId from ContentDocumentLink where LinkedEntityId=:recordId]; for(ContentDocumentLink cdLink:cdl){ documentIds.add(cdLink.ContentDocumentId); } DocumentList = [select Id,Title,FileType,ContentSize,Description from ContentDocument where id IN: documentIds]; return DocumentList; // Return list of files on parent record } }
- Luke Higgins 22
- October 10, 2019
- Like
- 0
- Continue reading or reply
Prevent user to stop editing child record
Hi all,
I have one picklist value Status on master object if status value changes from New to Pending i want to prevent user from stop editing child record anyone know how to achieve that..??
I have one picklist value Status on master object if status value changes from New to Pending i want to prevent user from stop editing child record anyone know how to achieve that..??
- Uttpal chandra
- May 27, 2019
- Like
- 0
- Continue reading or reply
Custom button for sending Email in Custom Object in Lightning
Hi All,
I had created a one custom object and in that there is one custom field Email id.
I have also created a custom Detail page button So whenever user click on that button it should send Email to that particular email id which is defined in that Custom Object with pdf which contain detail of the current record.
I have to implement this in Lightning.
I had created a one custom object and in that there is one custom field Email id.
I have also created a custom Detail page button So whenever user click on that button it should send Email to that particular email id which is defined in that Custom Object with pdf which contain detail of the current record.
I have to implement this in Lightning.
- Uttpal chandra
- April 17, 2019
- Like
- 0
- Continue reading or reply
How to send email on custom button
Hi all,
I want to send an email as well as pdf which contain the fields of contacts whenever user click on custom send email button.
I want to send an email as well as pdf which contain the fields of contacts whenever user click on custom send email button.
- Uttpal chandra
- April 15, 2019
- Like
- 0
- Continue reading or reply
Can't able to write "Select All" label in Checkbox?
Hi All,
I have used wrapper class and I have implemented checkbox but I can't able to write "Select all" beside the topmost checkbox.
Thanks in advance
I have used wrapper class and I have implemented checkbox but I can't able to write "Select all" beside the topmost checkbox.
Thanks in advance
- Uttpal chandra
- April 08, 2019
- Like
- 0
- Continue reading or reply
How to write a test class for this apex classs
Hi Anyone help me how to write test class for this ?
Thanks in advance
public class theController { public List<Wrapper> contactList {get; set;} public static String mass {get;set;} public static boolean saveSuccessful {get; set;} public static string message {get; set;} ID Id = ApexPages.currentPage().getParameters().get('id'); public Integer offSetSize = 0; public Integer QueryLimit = 10; public Integer countTotalRecords{get;set;} public theController(ApexPages.StandardController controller){ countTotalRecords = [SELECT count() FROM Activity_Template__c WHERE For_Which_Object__c = 'Account']; } public List<Wrapper> getContacts() { if(contactList == null) { contactList = new List<Wrapper>(); for(Activity_Template__c c: [Select Name,Template_Tool_Tip__c,Template_Type__c FROM Activity_Template__c WHERE For_Which_Object__c = 'Account' LIMIT :QueryLimit OFFSET :offSetSize ]) { contactList.add(new Wrapper(c)); } } return contactList; } public boolean getprv(){ if(offSetSize > 0) return false; else return true; } public boolean getnxt(){ if(offSetSize + queryLimit < CountTotalRecords ) return false; else return true; } public PageReference nextbtn(){ contactList=null; offSetSize += queryLimit ; return null; } public PageReference prvbtn(){ contactList=null; offSetSize -= queryLimit ; return null; } public Integer getPageNumber() { return offSetSize/QueryLimit + 1; } public Integer getTotalPages() { if (math.mod(countTotalRecords, QueryLimit) > 0) { return countTotalRecords/QueryLimit + 1; } else { return (countTotalRecords/QueryLimit); } } public PageReference processSelected() { List<Activity_Template__c> selectedContacts = new List<Activity_Template__c>(); for(Wrapper cCon: getContacts()) { if(cCon.selected == true) { selectedContacts.add(cCon.con); } } for(Activity_Template__c con: selectedContacts) { system.debug(con); } // addParentAccount(id,selectedContacts); contactList=null; return null; } public class Wrapper { public Activity_Template__c con {get; set;} public Boolean selected {get; set;} public Wrapper(Activity_Template__c c) { con = c; selected = false; } } }
Thanks in advance
- Uttpal chandra
- March 28, 2019
- Like
- 0
- Continue reading or reply
How to create dynamic iframe using javascript?
Hi all,
Right now I am creating a pop on detail page button.Everything is fine except it's height can anyone help me on how to create a dynamic iframe using javascript?
Here is my code.
Thanks in advance
Right now I am creating a pop on detail page button.Everything is fine except it's height can anyone help me on how to create a dynamic iframe using javascript?
Here is my code.
(function() { var width = 700; var height = 515; var title = "Dialog title here"; var box = new SimpleDialog("salesforce" + Math.random(), true); box.setTitle(title); box.displayX = true; box.isMovable = false; box.createDialog(); box.setWidth(width); // set your html content here box.setContentInnerHTML( '<iframe src="/apex/toastmessage?Id={!Account.Id}" style="border:none;" width="100%" height="'+ (height - 30)+'px" />' ); //set the height of the modal box.dialog.children[1].style.height = height + 'px'; box.show(); //if displayX is set to true, then override standard close event by this code box.dialog.getElementsByClassName('dialogClose')[0].onclick = function() { box.hide(); // you can add code to reload the page or redirect to another page }; //optional : add this to close the modal onclick of the overlay background box.background.addEventListener('click', function() { box.hide(); }); // if you want to be able to close the modal from the Visualforce page window.addEventListener('message', function(event){ if (event.data === 'close'){ box.hide(); } }); })();
Thanks in advance
- Uttpal chandra
- March 25, 2019
- Like
- 1
- Continue reading or reply
How to display message using java script?
Hi All,
I have VF page in which I have one command button if supose user insert the data suceesfully it should display message "Record is inserted" and if some error occur it should display message "Record is not created".
Thanks in advance
I have VF page in which I have one command button if supose user insert the data suceesfully it should display message "Record is inserted" and if some error occur it should display message "Record is not created".
<apex:commandButton action="{!processSelected}" value="Run Template" onComplete="Refresh();"/>
Thanks in advance
- Uttpal chandra
- March 15, 2019
- Like
- 0
- Continue reading or reply
Pop up on detail page button
Hi all,
I had created one Visualforce page and i want to implement that as a pop up on a Detail Page button.
Right now when i click on a button it automatically move to that vf page.
Thanks in Advance
I had created one Visualforce page and i want to implement that as a pop up on a Detail Page button.
Right now when i click on a button it automatically move to that vf page.
Thanks in Advance
- Uttpal chandra
- March 06, 2019
- Like
- 0
- Continue reading or reply
Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}
Hi,
Anyone Solve this.
I am trying to save record using Lightning component but i am getting error "Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}"
Below I have mentioned my class.
Hello.cmp
helloController.js
harness.app
CreateCandidateRecord.apxc
Thanks in advance
Uttpal
Anyone Solve this.
I am trying to save record using Lightning component but i am getting error "Error in $A.getCallback() [componnet is not defined] Callback failed: apex://CreateCandidateRecord/ACTION$createRec Failing descriptor: {c:hello}"
Below I have mentioned my class.
Hello.cmp
<aura:component controller="CreateCandidateRecord"> <aura:attribute name="Tax" type="Taxes__c" default="{'sobjectType': 'Taxes__c', 'Name': '', 'Last_Name__c': '', 'SSN__c': '' }"/> <aura:attribute name="Id" type="String"/> <lightning:input value="{v.Tax.Name}" label="Name" placeholder="Enter name......" /> <lightning:input value="{v.Tax.Last_Name__c}" label="Last Name" placeholder="Enter Last name......" /> <lightning:input value="{v.Tax.SSN__c}" label="SSN No" placeholder="Enter SSN No....." /> <lightning:button variant="brand" label="Save" title="Save" onclick="{!c.doSave}" /> </aura:component>
helloController.js
({ doSave : function(component,event,helper) { var action = component.get("c.createRec"); action.setParams({'contObj':component.get('v.Tax')}); action.setCallback(this,function(data){ componnet.set('v.Id',data.getReturnValue()) }); $A.enqueueAction(action); } })
harness.app
<aura:application extends="force:slds" > <c:hello/> </aura:application>
CreateCandidateRecord.apxc
public class CreateCandidateRecord { @AuraEnabled public static string createRec(Taxes__c contObj){ System.debug('Taxes::' +contObj.Name); insert contObj; return contObj.Id; } }
Thanks in advance
Uttpal
- Uttpal chandra
- February 21, 2019
- Like
- 0
- Continue reading or reply
How to insert data using custom controller?
Hi all,
I have created one vf page and one custom controller.But whenever i am trying to save data it is not happening and also it is not showing any error.
Anyone help me on this.
Controller
Vfpage
Thanks in advance
I have created one vf page and one custom controller.But whenever i am trying to save data it is not happening and also it is not showing any error.
Anyone help me on this.
Controller
public class EmployeeController { public Employee__c abc{get;set;} public EmployeeController() { abc = new Employee__c(); // abc = [Select id,Name,Birth_Date__c from Employee__c]; } public PageReference save(){ insert abc; return null; } }
Vfpage
<apex:page lightningStylesheets="true" controller="EmployeeController" showHeader="false" standardStylesheets="false"> <apex:pageBlock > <apex:pageBlockSection columns="2"> <apex:inputField value="{!abc.Name}"/> <apex:inputField value="{!abc.Custom_Code__c}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Work Address"> <apex:inputField value="{!abc.Work_Address__c}"/> <apex:inputField value="{!abc.Work_Address_Line_2__c}"/> <apex:inputField value="{!abc.Work_City__c}"/> <apex:commandButton value="Save" action="{!save}" styleClass="slds-button slds-button_brand"/> </apex:pageBlockSection> </apex:pageBlock>
Thanks in advance
- Uttpal chandra
- February 15, 2019
- Like
- 0
- Continue reading or reply