function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NyshaaNyshaa 

I want to create a lightning component in which I want to show the the details for a master detail object child-parent relation.

I have an Object which is n master-detail with another object 
When A record in object A is created 3 records are created in Object b automatically.(I did this through process builder)
I want to put the component on object A to show all the associate record of object B and billing details of it.

Thanks in Advance!

viswanath reddy 53viswanath reddy 53
 Hi Nyshaa,

It looks like our team of experts can help you resolve this ticket.
We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!

https://jbshelpdesk.secure.force.com

Thanks,
Jarvis SFDC team
Barthelemy Laurans 1Barthelemy Laurans 1
Hi,

You can use the related list feature.

If you really need specific control over the list displayed, you can create a custom LWC or Aura component and query the related records using the relationship queries (https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_query_using.htm#sforce_api_calls_soql_relationships_query_using) for example.

Best regards,
Barthélemy
Sumana R 15Sumana R 15
Hello everyone, 
I am trying to create a component that accepts 'n' number of case numbers as comma saperated values and a picklist field named Status. Once the user clicks on Update case status button, the status of all the selected case numbers must be updated as per the value selected in the picklist

The code is saved but i am getting error on click on the update status button. 

Component:
<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="CaseStatusUpdateClass">
       
    <aura:attribute name="userList" type="List"/>
    <aura:attribute name="caseNo" type="String"/>
    <ui:inputTextArea aura:id="caseno" label="Enter Case numbers" value="Enter Case numbers" rows="5"/>
    
    <aura:attribute name="caseStatusAtt" type="String"/>
    <div class="row">
        
        <p class="title">Select Case Status: </p>
        
    	<ui:inputSelect class="Single" aura:id="CaseStatus">
            <ui:inputSelectOption text="In Progress"/>
            <ui:inputSelectOption text="Closed"/>
            <ui:inputSelectOption text="Working"/>
            <ui:inputSelectOption text="Escalated"/>
            <ui:inputSelectOption text="None"/>
        </ui:inputSelect> 
    </div>
   
    <ui:button class="button" label="Update Case Status" press="{!c.setStatus}"/>
    
    
</aura:component>
Controller JS:
({
	setStatus : function(component, event, helper) {
        var caseno = component.find("caseno").get("v.value");
        component.set("v.caseNo",caseno);
        console.log('---caseno---',caseno);
        
        var status = component.find("caseStatusAtt").get("v.value");
        component.set("v.CaseStatus",caseStatusAtt);
        console.log('---caseStatus---',caseStatusAtt);
        
        helper.CaseStatusUpdateClass(component,event,helper);
	}
})
Helper:
({
	CaseStatusUpdateClass : function(component, event, helper) {
        var caseno = component.get("v.caseNo");//here we are getting the case number we entered
        var action = component.get("c.getcasenew");//here we calling apex method
        
        action.setParams({ caseno1 : caseno, CaseStatusToSet : CaseStatus });
        action.setCallback(this, function(response){
            var state = response.getState();
            console.log(response.getReturnValue());
        });
        $A.enqueueAction(action);
	} 
})

Apex class:
public class CaseStatusUpdateClass {
    @auraEnabled
    public String caseno {get; set;}
    @auraEnabled
    public String CaseStatus {get; set;}
	@auraEnabled
    public static String getcasenew(String caseno1, String CaseStatusToSet){
        system.debug('----------yes---');
        
        String status = CaseStatusToSet;
        // you need to create another list for updation --just add the case in that list and then update
        string caseNum = caseno1;
        List<Case> caseupdate = new List<Case>();
        system.debug('--casenumber---'+caseNum);
        List<Case> existingCaseList = [Select id from case where CaseNumber =:caseno1];
        system.debug('caseList---->'+existingCaseList);
        system.debug('caseStatus---->'+CaseStatusToSet);
        for(Case c : existingCaseList){
           Case cc = new Case();
            cc.Id = c.id;
            cc.Status = status;
            caseupdate.add(cc);
            
        }
        //always check for null - best practise
        if(caseupdate!=null && !caseupdate.isEmpty()){
            update caseupdate;
        	return 'Updated successfully';
        }else{
            return 'Test error';
        }        
    }
}

Please help
Barthelemy Laurans 1Barthelemy Laurans 1
@Sumana R 15 : could you ask your question in a separated post ?