• Ajitesh Singh 19
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
My organization uses standard Role Hierarchy (no Territories).

This is a moch up of my Role Hierarchy:

CCO
-->AMERICAS Sales
----->US Sales
----->Other AM Sales
-->EMEA Sales
----->Europe Sales
----->Africa Sales
-->APAC Sales
----->China Sales
----->Japan Sales
----->Other Asia Sales

All the Sales People (opportunity owners) have a role in the lowest node of the hierarchy.

I created a Dashboard to show all CLOSED WON Opportunities.
I am grouping my Opportunities by "Owner Role"

When I run the report at CCO level, I see all the groupins showing
----->US Sales
----->Other AM Sales
----->China Sales
etc.

Is there a way to summarize my data at the Role immediately below CCO in Einstien Analytics ?

Hi everyone,
This was my first time asking question in salesforce developer forum.

My org was using omni-channel to receive live chat message for visitor. Therefore i want to implement some custom action before chat transcript was created.

I've added a trigger on this object and using before insert, but when i tried to system.debug() i notice in developer console won't display any log was created for before insert.

Therefore, i also tested on other object like "Case" it was able to display debuging info.

I've also tried to untick developer console -> Debug -> Show My Current Logs Only, to preview all log. Unfortunately, i couldn't find any related log. But when i test with same object but before update it was working and able to log debug info.

Here was my personal assumption, is it because this insertation was done by system it self, therefore i couldn't find log in developer console?

Appriciate if anyone could answer this.

Thanks in advance.

 

User-added imageUser-added imageUser-added image

Hello All,
I am currently looking into Lightning Web Components and have hit a wall. I have a wire decorator that calls to an apex function returning a wrapper class. This Wrapper actually contains a Wrapper that contains a Wrapper, so it is nested 3 times. What I would like to do is updated a field on the 3rd Wrapper when a checkbox is checked or unchecked.

important HTML:
<template if:true={progWrap.progList}>
                    <template for:each = {progWrap.progList} for:item = "prog">
                        <tr key = {prog.progAuth.Id} >
                            <td>{prog.programName}</td>
                            <td>{prog.programCountry}</td>
                            <template if:true={prog.checkboxes}>
                                <template for:each={prog.checkboxes} for:item="checkbox">
                                    <template if:true={checkbox.visible}>
                                        <td key={checkbox.section}><lightning-input type="checkbox" value={checkbox.section} checked={checkbox.checked} data-prog-name ={prog.programName} onchange={handleCheckboxChange}></lightning-input></td>
                                    </template>
                                    <template if:false={checkbox.visible}>
                                        <td key={checkbox.section}>-</td>
                                    </template>
                                </template>
                            </template>
                        </tr>
                    </template>
                </template>

JS:
import { LightningElement, api, track, wire } from 'lwc';
import initWrapper from '@salesforce/apex/programAuthComponentController.initWrapper';

export default class programAuthWebComponent extends LightningElement {
    
    @api recordId;
    @track progWrap;
    @track error;
    @wire(initWrapper, {accId: '$recordId'}) 
    progWrapper({
        error,
        data
    }){
        if(data){
            this.progWrap = data;
        }
        else{
            this.error = error;
        }
    }

    handleCheckboxChange(event){
        var checkValue = event.target.value;
        var checkValue2;
        var programName = event.target.dataset.progName;

        if(checkValue === 'Spring / Semester 1'){
            checkValue = 'Spring';
            checkValue2 = 'Semester 1';
        }
        else if(checkValue === 'Fall / Semester 2'){
            checkValue = 'Fall';
            checkValue2 = 'Semester 2';
        }

        for(let i = 0; i < this.progWrap.progList.length; i++){
            if(this.progWrap.progList[i].programName === programName){
                //console.log(this.progWrap.progList[i].checkboxes.length);
                for(let j = 0; j < this.progWrap.progList[i].checkboxes.length; j++){
                    if(this.progWrap.progList[i].checkboxes[j].section === checkValue){
                        console.log(JSON.stringify(this.progWrap.progList[i].checkboxes[j]));
                        this.progWrap.progList[i].checkboxes[j].checked = true;
                    }
                }
            }
        }
    }
}

Apex Wrappers:
public class wrapperClass{
        @AuraEnabled public List<progAuthWrapperClass> progList{get;set;}
        @AuraEnabled public List<String> sections{get;set;}
        @AuraEnabled public List<String> modifiedSections{get;set;}
    }

    public class progAuthWrapperClass{
        @AuraEnabled public String programName {get;set;}
        @AuraEnabled public String programCountry {get;set;}
        @AuraEnabled public Program_Authorization__c progAuth {get;set;}
        @AuraEnabled public Boolean updated {get;set;}
        @AuraEnabled public Set<String> avaliableTerms {get;set;}
        @AuraEnabled public List<checkboxWrapper> checkboxes {get;set;}
    }

    public class checkboxWrapper{
        @AuraEnabled public Boolean visible {get;set;}
        @AuraEnabled public Boolean checked {get;set;}
        @AuraEnabled public String section {get;set;}
    }

    @AuraEnabled(cacheable=true)
    public static wrapperClass initWrapper(Id accId){
        wrapperClass returnWrapper = new wrapperClass();
        returnWrapper.sections = returnSections();
        returnWrapper.modifiedSections = returnModifiedSections(returnWrapper.sections);
        returnWrapper.progList = returnPrograms(accId);
        return returnWrapper;
    }
The UI Looks like this currently (this is a work in progress):

User-added image

Essentially what we want to have happen is when on of these checkboxes is clicked, it updates the checked boolean on the checkboxWrapper. I thought I could update the this.progWrap.progList[i].checkboxes[j].checked in my for loop but everytime I do this I get an error from salesforce that says this: ['set' on proxy: trap returned falsish for property 'checked'].

This may be too much information but really my question is, what does that mean? and How do I actually update this field?

Thank you all for any help!
Hi All,

I receive the following error when attempting to check the challenge for Apply Unit of Work

Challenge Not yet complete... here's what's wrong: 
The 'challangeComplete' method in the 'UnitOfWorkTest' class has not successfully passed all tests. Ensure that you run the tests and it passes successfully before attempting this challenge again.

However, when I run my code in Developer Console, my test passes.  Any ideas on the problem?  Here is the code:

@isTest
public class UnitOfWorkTest {
    @isTest static void challengeComplete(){
        fflib_SObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(
            new Schema.SObjectType[]{
                Account.SObjectType,
                Contact.SObjectType,
                Note.SObjectType
            }
        );
        
        for (Integer i=0 ; i<100 ; i++) {
            Account a = new Account(Name= 'Test' + i);
            uow.registerNew(a);
            
            for (Integer j=0 ; j<5 ; j++) {
                Contact c = new Contact(LastName = 'Test'+i + ' ' +j);
                uow.registerNew(c, Contact.AccountId, a);
                
                Note n = new Note(Body='Test '+i + '' + j, Title='Test'+i+j);
                uow.registerRelationship(n, Note.ParentId, a);
                uow.registerNew(n, Note.ParentId, a);
            }
        }

        uow.commitWork();
 
        fflib_SObjectUnitOfWork uow2 = new fflib_SObjectUnitOfWork(
            new Schema.SObjectType[]{
                Account.SObjectType,
                Contact.SObjectType,
                Note.SObjectType
            }
        );        
        for (Account a : [SELECT Id, Name, (SELECT Id, LastName FROM Contacts), (SELECT Id, ParentId, Title, Body FROM Notes) FROM Account]) {
            a.Name = 'Test';
            uow2.registerDirty(a);
            
            Integer i = 0;
            for (Contact c : a.Contacts) {
                c.LastName = 'Test';
                uow2.registerDirty(c);
                
                a.Notes[i].Body='Test';
                uow2.registerDirty(a.Notes[i]);
                i++;
            }
        }        
        
        test.startTest();
        uow2.commitWork();
        test.stopTest();
        
        System.assertEquals(100, [Select Id from Account].size());
        System.assertEquals(500, [Select Id from Contact].size());
        System.assertEquals(500, [Select Id from Note].size());
    }
}