• Ankit Dable
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 1
    Replies
I have two type of Account one is Party and another is Branch, in which Party should be parent of Branch. I want to create page layout on Account when Party record is created we should able to create and see it's related Branch record under that page layout. 

Please suggest the solution.
Thank you!!
I have JavaScript related list button in classic which validate the one parent field and if condition gets satisfy it will open the popup window to create new child record.
Below is my JS code for related list button in classic
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js" )}


var connection = sforce.connection;
var records = '{!EmployeeInfo__c.Id}';
var status= '{!EmployeeInfo__c.Status__c}';
var nameid='{!EmployeeInfo__c.Name}';

if(status=='Closed')
{
var returnVal = window.open('/a01/e?CF00N6F00000TYTs0='+nameid+'&CF00N6F00000TYTs0_lkid='+records+'&retURL=%2F'+records+'&isdtp=vw','NewRecord' );
}
else
{
alert('Record status must be Closed');
}
I want this functionality in lightning, how do I achieve this?

Thank you!


 
I have list table which display the records of perticular object and table shows only 4-5 fields alos each row having edit button. I want to display the all the fields of that record in edit format after clicking on edit button.

Is this possible? Please suggest me any alternate way if this is not possible.

Thank you!
doAction : function(component, event, helper) {
    var params = event.getParam('arguments');
    var cmpEvent = component.getEvent("updated");
    var editRecord=new Object();
    for(var i=0;i<window.count;i++){
        var index=component.find({instancesOf : "ui:inputText"})[i];
        if(index!=undefined){
            editRecord[params.fieldNames[i]]=index.get("v.value");
        }
    }
     var action=component.get("c.editRecords");
    action.setParams({
        "obj":editRecord,
        "objName":params.objName,
        "fieldNames":params.fieldNames
    });
    action.setCallback(this,function(response){
        var state = response.getState();
        alert(state);
       if(state==='SUCCESS'){
         var result=response.getReturnValue();
           cmpEvent.setParams({"listData":result});
        }
    });
$A.enqueueAction(action);
 cmpEvent.fire();
}
 
@AuraEnabled

    public static List<sObject> editRecords(SObject obj,String objName,String[] fieldNames){
        List<sObject> listData =new List<sObject>();
        System.debug(obj);
        if(obj!=null){
            update obj;
            listData=getRecords(objName,fieldNames);
        }
        return listData;
    }

 
({
	doInit : function(component, event, helper) {
		component.set(v.columns[
               {label: 'Department ID', fieldName: 'DepartmentID', type: 'Auto Number'},
               {label: 'Department Name', fieldName: 'Name', type: 'text'},
               {label: 'Department Manager', fieldName: 'DepartmentManager', type: 'text'},
        	   {label: 'Employee Count', fieldName: 'NoofEmployee', type: 'number'}
        ]);
		var action= component.get("c.getRecord");
        action.setCallback(this, funtion(response){
                          var state=response.getState();
        if(state==="SUCCESS"){
            component.set("v.dept",response.getReturnValue());
        }
        else{
            console.log("Failed with state: " + state);
        }
        });
		$A.enqueueAction(action);    
}
})
I am getting  Parsing error: Unexpected token {  at line 10.
Can someone suggest me what is requier in this?
Thank you!!
 
public class EmployeeRegistrationController 
{
    public String selectedTab{get; set;}
    public EmpID__c EmpID{get;set;}
    public EmployeeInfo__c EmpDetail{get; set;}
    public EducationInfo__c EduDetail{get; set;}
    public List<EducationInfo__c> listEducation {get; set;}
    public TechnologyInfo__c TechDetail{get;set;}
    public List<TechnologyInfo__c> listTechnology {get;set;}
    public List<EducationInfo__c> listEduInsert {get; set;}
    public List<TechnologyInfo__c> listTechInsert{get;set;}
    public Boolean button{get;set;}
    public Boolean btnSubmit{get;set;}
    public Boolean btnSave{get;set;}
 
    public EmployeeRegistrationController()
    {
        selectedTab='Employee';
        EmpDetail=new EmployeeInfo__c();
        listEducation=new List<EducationInfo__c>();
        TechDetail=new TechnologyInfo__c();
        listTechnology=new List<TechnologyInfo__c> ();
        EmpID=new EmpID__c();
        button=true;
        btnSubmit=true;
        btnSave=false;
    }
    
    public void goNext1()
    {
        selectedTab='Education';
    }
    
    public PageReference saveInfo()
    {
        if(EmpDetail.First_Name__c==null||EmpDetail.Last_Name__c==null||EmpDetail.Email__c==null)
        {
            ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.ERROR,'Please fill Basic details: First Name, Last Name, Email ID');
            ApexPages.addMessage(msg);
        }
        else
        {
        try
        {
            insert EmpDetail;
            ID Eid=[select ID from EmployeeInfo__c where Email__c=:EmpDetail.Email__c limit 1].ID;
            EmpID=new EmpID__c(Eid__c=Eid);
            button=false;
            btnSave=true;
        }
        catch(Exception e)
        {
            System.debug(e.getMessage());
        }
        }
        return null;
    }
    
    public void goNext2()
    {
        selectedTab='Technology';
    }
    
    public PageReference addNewRow()
    {
        if(EmpID.Eid__c==null)
        {
            ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.ERROR,'Please fill the Basic detail First');
            ApexPages.addMessage(msg);
        }
        else
        {
        EduDetail=new EducationInfo__c();
        EduDetail.Employee__c=EmpID.Eid__c;
        listEducation.add(EduDetail);
        }
        return null;
    }
    
    public PageReference saveEducation()
    {
        for (EducationInfo__c c:listEducation)
        {
        if(c.course__c==null)
        {
            ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.ERROR,'Please fill the details');
            ApexPages.addMessage(msg);
        }
        else
        {
            try
            {
                upsert listEducation;
                listEduInsert=[SELECT Name, course__c,From_Date__c,To_Date__c FROM EducationInfo__c WHERE Employee__c=:EmpID.Eid__c];
            }
            catch(Exception e)
            {
                System.debug(e.getMessage());
            }
        }
        }
        listEducation.clear();
        return null;
    }
    
    public PageReference addNewRow2()
    {
        TechDetail=new TechnologyInfo__c();
        TechDetail.Employee__c=EmpID.Eid__c;
        listTechnology.add(TechDetail);
        return null;
    }
    
    public PageReference saveTechnology()
    {
        for(TechnologyInfo__c t: listTechnology)
        {
        if(t.Skill__c==null)
        {
            System.debug(t.Skill__c);
            ApexPages.Message msg=new ApexPages.Message(ApexPages.Severity.ERROR,'Please fill the details');
            ApexPages.addMessage(msg);
            System.debug(msg);
        }
        else
        {
            try
            {
                upsert listTechnology;
                listTechInsert =[SELECT Name, Experience__c,Level__c,Skill__c FROM TechnologyInfo__c WHERE Employee__c=:EmpID.Eid__c];
                btnSubmit=false;
            }
            catch(Exception e)
            {
                System.debug(e.getMessage());
            }
        }
        }
        listTechnology.clear();
        return null;
    }
    
    public PageReference submit()
    {
        SentEmail.sentToAdmin(EmpID.Eid__c);
        SentEmail.sentToUser(EmpID.Eid__c);
        PageReference pageRefer=new PageReference('/apex/FinalPage');
        pageRefer.setRedirect(true);
        return pageRefer;
    }
}

Can someone please suggest me?
I want to separate the string from the Text field using formula. Example textfield =TestName,TestCity,TestCountry
and I want to separate the string as
Name__c=TestName
City__C=TestCity
Country__c=TestCountry
Please assist me to make formula for this.
doAction : function(component, event, helper) {
    var params = event.getParam('arguments');
    var cmpEvent = component.getEvent("updated");
    var editRecord=new Object();
    for(var i=0;i<window.count;i++){
        var index=component.find({instancesOf : "ui:inputText"})[i];
        if(index!=undefined){
            editRecord[params.fieldNames[i]]=index.get("v.value");
        }
    }
     var action=component.get("c.editRecords");
    action.setParams({
        "obj":editRecord,
        "objName":params.objName,
        "fieldNames":params.fieldNames
    });
    action.setCallback(this,function(response){
        var state = response.getState();
        alert(state);
       if(state==='SUCCESS'){
         var result=response.getReturnValue();
           cmpEvent.setParams({"listData":result});
        }
    });
$A.enqueueAction(action);
 cmpEvent.fire();
}
 
@AuraEnabled

    public static List<sObject> editRecords(SObject obj,String objName,String[] fieldNames){
        List<sObject> listData =new List<sObject>();
        System.debug(obj);
        if(obj!=null){
            update obj;
            listData=getRecords(objName,fieldNames);
        }
        return listData;
    }