• Sachin Shah 56
  • NEWBIE
  • 5 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 11
    Replies
Hello Folks,
 
How shall I enable this setting and create the commerce cloud site.
I am performing this in my personal developer edition and want to have demo showcase site.
 
Thanks,
 
#Sales Cloud  #Trailhead  #New Releases  #Analytics
Any help on this..

Note : (No trigger solution only flow)
Having a requirement where opportunity has a child record and where ever a child record is created or updated need to check that count of child record is not more than 4 for a month (i.e sept :4 records, oct: 4 records).

Thanks in advance!!
Hello Folks,
 
How shall I enable this setting and create the commerce cloud site.
I am performing this in my personal developer edition and want to have demo showcase site.
 
Thanks,
 
#Sales Cloud  #Trailhead  #New Releases  #Analytics
Hi All,  I am trying to create a formula field to populate a default Account.Legal Entity (picklist) value from the Users.Legal Entity (picklist) based on the creating Users User.Legal Entity.  Example: If the User creating the Account has a Legal Entity value of 'Canada', then default the Account Legal Entity value to 'Canada' on the new Account record.

Thoughts?

Thank you!

I have Lightning Aura Component Name as caseList3

not passing selected case record id in js controller

below is the code (YOU CAN CHECK IN BROWSER BY CLTR+SHIFT+i) so it show selected record Id

as below line

console.log("Selected Case Id: " + selectedCaseId);

 

Now i want an lwc component which will take this Selected record Id as Input and display case and associated product details

 

 

My lightning components working perfectly

you can copy and test in your org

 

only issue i am getting with lwc

 

My Linghtning component code

APEX

public with sharing class CaseListController {
    public CaseListController() {

    }
    @AuraEnabled
    public static List<Case> getCases() {
        
         return [SELECT Id, Subject FROM Case Order By createdDate DESC LIMIT 5];
             
    }}

 

COMPONENT

 

 

caseList3.cmp

 

<aura:component controller="CaseListController"
                implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global">
    <aura:attribute name="caseList" type="Case[]" />
    <aura:attribute name="selectedCaseId" type="String" />
    <aura:attribute name="selectedRecordId" type="String" />
    <aura:handler name="init" value="{!this}" action="{!c.loadCases}" />
   
    <div class="slds-card">
        <div class="slds-card__header slds-grid">
            <h2 class="slds-text-heading_medium slds-col">Case Information</h2>
        </div>
        <div class="slds-card__body">
            <ul class="slds-list_dotted">
                <aura:iteration items="{!v.caseList}" var="caseRecord">
                    <li class="slds-p-around_small slds-box slds-box_small">
                        <p class="slds-text-title"><strong>Case Number:</strong> {!caseRecord.CaseNumber}</p>
                        <p class="slds-text-title"><strong>Subject:</strong> {!caseRecord.Subject}</p>
                        <p><strong>Description:</strong> {!caseRecord.Description}</p>
                        <!-- Add more case fields here -->
                        <button class="slds-button slds-button_brand select-case-button" data-caseid="{!caseRecord.Id}" onclick="{!c.selectCase}">Select Case&#128512;</button>
                    </li>
                </aura:iteration>
            </ul>
        </div>
    </div>
    <lightning:workspaceAPI aura:id="workspace" />
</aura:component>
 

 

 

caseList3Controller.js

 

({
    selectCase: function (component, event, helper) {
        var selectedCaseId = event.currentTarget.getAttribute("data-caseid");
        component.set("v.selectedCaseId", selectedCaseId);
        console.log("Selected Case Id: " + selectedCaseId);
        var messagePayload = {
            selectedCaseId: selectedCaseId
        };
        var messageContext = component.find("workspace").getMessageContext();
        var message = {
            recordId: component.get("v.recordId"),
            messageBody: JSON.stringify(messagePayload)
        };
        messageContext
            .publishMessage(CASE_SELECTION_CHANNEL, message)
            .then(response => {
                console.log("Message published successfully");
            })
            .catch(error => {
                console.error("Error publishing message: " + error);
            });
    },
    loadCases: function (component, event, helper) {
        var action = component.get("c.getCases");
        action.setCallback(this, function (response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var caseRecords = response.getReturnValue();
                component.set("v.caseList", caseRecords);
            } else {
                console.error("Error fetching case data: " + state);
            }
        });
        $A.enqueueAction(action);
    },
    handleRecordSelection: function(component, event, helper) {
        var selectedRecordId = event.getParam("recordId");
        component.set("v.selectedRecordId", selectedRecordId);
    }
   
})
 

 

 

lwc component passing param to apex class is null, works fine with standard user login, the issue is only when the guest user accesses it from the site.
Hello Everyone,

I have a requirement in Service Cloud where i want to set specific timeframe  if no action is taken on case then it get escalate to another user and even second user doesn't respond to it and leave it unattended it should escalate to higher authority user 
Any help on this..

Note : (No trigger solution only flow)
Having a requirement where opportunity has a child record and where ever a child record is created or updated need to check that count of child record is not more than 4 for a month (i.e sept :4 records, oct: 4 records).

Thanks in advance!!
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.

apex class : 
public class getZohoRecords {
    public static HttpResponse getActivity(){
        List<Lead> leadList = new List<Lead>();
        string accToken = 'XXXXXXXXXXXXXXXXX';
        Http http = new http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://www.zohoapis.in/crm/v2/Leads?fields=Full_Name&fields=Email&fields=Last_Activity_Time');
        request.setHeader('Authorization', 'Bearer ' + accToken);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
        if(response.getStatusCode() == 200) {
            system.debug(response.getBody());
            Map<String, Object> deserialized = (Map<String, Object>)JSON.deserializeUntyped(response.getBody());
            for(Object m2 : (List<Object>) deserialized.get('data')){
                Map<String, Object> leadFields = (Map<String, Object>)m2;
                String id = (String)leadFields.get('id');
                String fullName = (String)leadFields.get('Full_Name');
                String lastActivityTime = (String)leadFields.get('Last_Activity_Time');
                
                if(lastActivityTime != null){
                    Http https = new http();
                    HttpRequest requests = new HttpRequest();
                    
                    requests.setEndpoint('https://www.zohoapis.in/crm/v2/leads/'+id+'/activities');
                    requests.setHeader('Authorization', 'Bearer ' + accToken);
                    requests.setMethod('GET');
                    HttpResponse responses = https.send(requests);
                    if(responses.getStatusCode() == 200) {
                        system.debug(responses.getBody());
                        leadList = [Select id, Name From Lead WHERE Name = :fullName];
                        if(leadList.size() > 0){
                            Map<String, Object> deserializeds = (Map<String, Object>)JSON.deserializeUntyped(responses.getBody());
                            for(Object m21 : (List<Object>) deserializeds.get('data')){
                                Map<String, Object> leadField = (Map<String, Object>)m21;
                                String ActivityType = (String)leadField.get('Activity_Type');
                                if(ActivityType == 'Tasks'){
                                    Task tasks = new Task();
                                    tasks.whoId = leadList[0].id;
                                    tasks.Priority = (String)leadField.get('Priority');
                                    tasks.Status = (String)leadField.get('Status');
                                    tasks.Subject = (String)leadField.get('Subject');
                                    tasks.Description = (String)leadField.get('Description');
                                    
                                    string dueDate = (String)leadField.get('Due_Date');
                                    Date actDate = Date.valueOf(dueDate);
                                    tasks.ActivityDate = actDate;
                                    
                                    string crtDate = (String)leadField.get('Created_Time');
                                    Date dt = Date.valueOf(crtDate);
                                    tasks.CreatedDate = dt;
                                    
                                    Insert tasks;
                                    system.debug(tasks);
                                } else if(ActivityType == 'Events'){
                                    Event events = new Event();
                                    events.WhoId = leadList[0].id;
                                    events.subject = (String)leadField.get('Subject');
                                    events.IsAllDayEvent = (Boolean)leadField.get('All_day');
                                    events.Description = (String)leadField.get('Description'); 
                                    
                                    string startTime = (String)leadField.get('Start_DateTime');
                                    DateTime startTm = Datetime.valueOf(startTime.replace('T',' '));
                                    events.StartDateTime = startTm;
                                    
                                    string endTime = (String)leadField.get('End_DateTime');
                                    DateTime endTm = Datetime.valueOf(endTime.replace('T',' '));
                                    events.EndDateTime = endTm;
                                    
                                    string crtDate = (String)leadField.get('Created_Time');
                                    Date dt = Date.valueOf(crtDate);
                                    events.CreatedDate = dt;
                                    
                                    insert events;
                                    system.debug(events);
                                } else if(ActivityType == 'Calls'){
                                    Task calls = new Task();
                                    calls.whoId = leadList[0].id;
                                    calls.type = 'Call';
                                    calls.TaskSubtype = 'Call';
                                    calls.Description = (String)leadField.get('Description');
                                    calls.Subject = (String)leadField.get('Subject');
                                    calls.CallType = (String)leadField.get('Call_Type');
                                    if((String)leadField.get('Priority') == null){
                                        calls.Priority = 'Normal';
                                    }else{
                                        calls.Priority = (String)leadField.get('Priority');
                                    }
                                    if((String)leadField.get('Status') == null){
                                        calls.Status = 'Completed';
                                    }else{
                                        calls.status = (String)leadField.get('Status');   
                                    }
                                    
                                    string crtDate = (String)leadField.get('Created_Time');
                                    Date dt = Date.valueOf(crtDate);
                                    calls.CreatedDate = dt;
                                    
                                    Insert calls;
                                    system.debug(calls);
                                }
                            }
                        }
                    }else{
                        system.debug(responses.getStatusCode());
                        system.debug(responses);
                        system.debug('No Activity found in lead');
                    }
                }
            }
            
        } else if(response.getStatusCode() == 401){
            Http ht = new http();
            HttpRequest req = new HttpRequest();
        
            req.setEndpoint('https://accounts.zoho.in/oauth/v2/token?code=XXXXXXXXXX&cl----------');
            req.setMethod('POST');
            HttpResponse res = ht.send(req);
            Map<String, Object> results = (Map<String, Object>)JSON.deserializeUntyped(res.getBody());
            String token = '';
            String refreshtoken = '';
            if(res.getStatusCode() == 200){
                token = (String)results.get('access_token');
                refreshtoken = (String)results.get('refresh_token');
                system.debug(res);
                system.debug(token);
            }else{
                system.debug(res);
            }
        }else{
            system.debug(response);
        }
        return response;
    }
}
  • September 15, 2023
  • Like
  • 0