• Uttpal chandra
  • NEWBIE
  • 110 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 31
    Replies
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 mapRequest1 = (JSONWrapper) JSON.deserialize(request.requestBody.toString(),JSONWrapper.class);

 - JSONWrapper --- Name of the Wrapper class

 - request --- Contains Json data
   
 - mapRequest1 --- Contains Deserialized data
 
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:
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
   }  
 }

 
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..??
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.
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.
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.

User-added image

Thanks in advance
 
Hi Anyone help me how to write test class for this ?
 
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
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.
(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
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".
 
<apex:commandButton action="{!processSelected}" value="Run Template" onComplete="Refresh();"/>

Thanks in advance
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
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
<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
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
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