• Suresh Kumar Arjunan1
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 8
    Replies
After i sync an email from outlook to salesforce, is there a way to access EmailMessageId or TaskId in my Aura Component displayed on Salesforce Outlook panel/layout? 

Reference link: https://developer.salesforce.com/docs/component-library/bundle/clients:hasItemContext/documentation (http://Reference link: https://developer.salesforce.com/docs/component-library/bundle/clients:hasItemContext/documentation)
Is there a way to set email Data Classification like 'Restricted' or 'Highly Confidential' via Apex?
I use Visual Force lightning out to display an analytics dashboard from another Salesforce Org. There are two Salesforce Orgs (Source Org and Target Org) in this context. 

Source Org:
1) Created analytics dashboard
2) Created lightning component and app to embed analytics dashboard.

Target Org:
1) Created a VF page and used lightning out to pull above created lightning app and component which displays dashboard.
2) Used REST API for authentication, where session Id Source Org has been generated using username and password oAuth route.
3) Defined CORS, Analytics Whitelists, CSPs in source and target orgs respectively.

While opening VF page in target org, page is getting loaded but not the dashboard rather dashboard spinner appears forever. From Developer tools, i get below error:
 
Refused to display  'https://xxxxxxx.salesforce.com/?ec=302&startURL=%2Fanalytics%2Fwave%2FembeddedWave.apexp%3Fmode%3DassetView%26formFactor%3DDESKTOP%26showHeader%3Dfalse%26embeddedInstanceId%3Dewa-5905390847443092%26context%3Daura%26height%3D300px%26sfdcNsOrigin%3Dhttps%253A%252F%252Fxxxxxxx.visual.force.com' in a frame because it set 'X-Frame-Options' to 'deny'.

Note: If i login into source org in the same browser then refreshing target org's visual force page renders the analytics dashboard.
I understand TestDataFactory classes won't be counted against org limit and i would like to whether code coverage has to be done separately for these classes. 

Looking for help and example if any.
Friends,

I'm trying to pass the selected checkboxes and radio button values from vf to controller and it is not working. Can someone throw lights on this please?

Refer method --> component.apex.SelectCheckboxes sc

My controller class:
----------------------------

public class dynamicQuestions {
public string str {get; set;}
public List<String> s { get; set; }
public static List<String> selected = new List<String>();
public Map<Id,Export_Compliance__c> m = new Map<Id,Export_Compliance__c>();
public Map<String, rWrapper> rWrap {get; set;}
Map<Id, List<Question_Response__c>> final1 = new Map<Id, List<Question_Response__c>>();
Map<Id, Question_Response__c> rType = new Map<Id, Question_Response__c>();
List<Question_Response__c> Ques = new List<Question_Response__c>();
Map<Id, rWrapper> fWrapper {get; set;}
Map<Id, List<String>> strList {get; set;}
public Map<Id, List<String>> z { get; set; }

public class rWrapper {
public string sflag {get; set;}
public List<String> lstr {get; set;}
public List<Question_Response__c> QRlist {get; set;}
}

public dynamicQuestions(){
z = new Map<Id, List<String>> ();
List<Export_Compliance__c> os = new List<Export_Compliance__c>([select Id, name, Parent__c,Response_Type__c,Opportunity__c, Question_Id__c from Export_Compliance__c]);
Ques = [select Id, name, Response_Type__c, Question__c, Parent_Question_Id__c, Response__c from Question_Response__c];
s = new List<string>();
fWrapper = new Map<Id, rWrapper>();
rWrap = new Map<String, rWrapper>();
strList = new Map<Id, List<String>>();
system.debug('frwapper within constructor :' + fWrapper);
for(Export_Compliance__c e : os)
{

    if(e.Response_Type__c=='Radio')
    {
        rWrapper w = new rWrapper();
        w.sflag=e.Question_Id__c;
        rWrap.put(e.Parent__c, w);
        system.debug('------rWrap---------'+rWrap + ' Parent Q is -->: '+e.Parent__c);
    }
    if(e.Response_Type__c=='Multi')
    {    
        List<string> tempList = new List<string>();
        if(strList.get(e.Parent__c) !=null)
        {
            tempList = strList.get(e.Parent__c);
        } 
        tempList.add(e.Question_Id__c);
        strList.put(e.Parent__c,tempList);
        s.add(e.Question_Id__c);
    }
    
m.put(e.Question_Id__c,e);
}


   for(Question_Response__c qq : Ques)
    {
    
       // rWrapper w = new rWrapper();
        


    //Stores Master Question's response
        if(qq.Parent_Question_Id__c == null)
        {
            rType.put(qq.Id, qq);
        }
    
    //Forms a map with master question and its list of responses.
        if(qq.Parent_Question_Id__c!= null)
        {
            if(final1.get(qq.Parent_Question_Id__c)==null)
            {
                List<Question_Response__c> a = new List<Question_Response__c>();
                a.add(qq);
                final1.put(qq.Parent_Question_Id__c, a);
            } else {
                List<Question_Response__c> b = new List<Question_Response__c>();
                b = final1.get(qq.Parent_Question_Id__c);
                b.add(qq);
                final1.put(qq.Parent_Question_Id__c, b);
            }
        }
        
        if(qq.Parent_Question_Id__c!= null)
        {
            rWrapper w = new rWrapper();
            List<Question_Response__c> a = new List<Question_Response__c>();
            //If statement to set list of responses
            if(fWrapper.get(qq.Parent_Question_Id__c)==null)
            {
                a.add(qq);
                w.QRlist = a;                
            } else {
                w = fWrapper.get(qq.Parent_Question_Id__c);
                a=w.QRlist;
                a.add(qq);
            }
            //If statement to set list of checkboxes selection
           if(strList.get(qq.Parent_Question_Id__c) == null){
               w.lstr = new List<string>();             
            } else {
               w.lstr = strList.get(qq.Parent_Question_Id__c);
            }
            //If statement to string of radio selection            
           if(rWrap.get(qq.Parent_Question_Id__c)!=null){
            w.sflag = rWrap.get(qq.Parent_Question_Id__c).sflag;
            }
            
            fWrapper.put(qq.Parent_Question_Id__c, w);
            
system.debug('your fWrapper------------'+fWrapper);    
        }
    }
}

public Component.Apex.OutputPanel getRadio(){

component.apex.OutputPanel op = new component.apex.OutputPanel();
op.id = 'outPanel';

for(Id myQR : fWrapper.keyset()){

if(rType.get(myQR).Response_Type__c == 'Radio'){
component.apex.outputlabel myRlabel = new component.apex.outputlabel();
component.apex.outputText ot = new component.apex.outputText();
ot.value = rType.get(myQR).Question__c;
myRlabel.childcomponents.add(ot);
system.debug('============='+ rWrap.get(myQR).sflag+' @@@@@@@@@@ '+myQR);
myRlabel.childcomponents.add(sr(fWrapper.get(myQR).QRlist,myQR,fWrapper.get(myQR).sflag));
op.childcomponents.add(myRlabel);
}

if(rType.get(myQR).Response_Type__c == 'Multi'){
component.apex.outputlabel myRlabel = new component.apex.outputlabel();
component.apex.outputText ot = new component.apex.outputText();
ot.value = rType.get(myQR).Question__c;
myRlabel.childcomponents.add(ot);
myRlabel.childcomponents.add(sc(fWrapper.get(myQR).QRlist, myQR, fWrapper.get(myQR).lstr));
op.childcomponents.add(myRlabel);
}


}

return op;
}
//pass wrapper as input to this method and use that in expressions????give a try
public component.apex.selectRadio sr(List<Question_Response__c> myR, String pId, String aaa){


component.apex.selectRadio ssr = new component.apex.selectradio(Id=pId, layout='pageDirection');


for(Question_Response__c childq : myR)
{
        if(m.ContainsKey(childq.Id))
        {
            ssr.value=aaa;
            system.debug('-------: '+aaa);
        }
    component.apex.selectoption so = new component.apex.selectoption();
    so.itemvalue = childq.Id;
    so.itemlabel = childq.Response__c;
    ssr.childcomponents.add(so);
}
return ssr;
}

public component.apex.SelectCheckboxes sc(List<Question_Response__c> myR, String pId, List<string> xyz){
system.debug(';;;;;;;;;;;;;'+xyz);
component.apex.SelectCheckboxes ssc = new component.apex.SelectCheckboxes(Id=pId, Layout='pageDirection');
//z.put(pId, xyz);
//ssc.value=xyz;
ssc.value = fWrapper.get(pId).lstr;
//List<SelectOption> options = new List<SelectOption>();
for(Question_Response__c childq : myR)
{
    //options.add(new SelectOption(childq.Response__c,childq.Id));

    component.apex.selectoption so = new component.apex.selectoption();
    system.debug('child Id reference :'+childq.Id);
    so.itemvalue = childq.Id;
    so.itemlabel = childq.Response__c;
    ssc.childcomponents.add(so);
}
return ssc;
}


public pageReference createRecords(){

system.debug('selected Records fWrapper ---> '+fWrapper);

return null;

}


}

My VF Page
-----------------

<apex:page controller="dynamicQuestions">
<apex:form id="myform">
<apex:commandButton action="{!createRecords}" value="Save" reRender="myform"/><br/>
<apex:dynamicComponent componentValue="{!Radio}" id="magic"/>
</apex:form>
</apex:page>

I'm trying to write a trigger to update a field in Parent record when Child record is created or updated.

Parent Object: Opportunity
Custom Field in Parent Object: Signed_by__c

Child Object: Invoice__c
Custom Field in Child object: Signed_by__c

Whenever the child record is saved (Inserted/updated), the value in 'Signed_by__c' field in child record must be copied to 'Signed_by__c' field in the parent record.

  • December 26, 2017
  • Like
  • 0
I have a custom object "Inventory", that has  a master detil relationship with the account object.
I need to be able to copy all of the related Inventory records to a custon object that has a master detail relationship to case, when the Account lookup is populated on the case reocrd.
I have a Contact(Parent) and Prorgam Enrollment(Child). 

A contact can have multiple Program Enrollments. There is a date field on the Program Enrollment. 
For example, If a contact has 4 Program Enrollments and if I update the date field in One Program Enrollment, the same date should be updated in the other program enrollments too?? 

Can I achieve this through workflow rules? or process builder with out any code?


I appreciate your time and Help!
Hello,

My trigger is running fine in the sandbox. When I run my test class, I receive the following error: System.LimitException: SBQQ:Too many SOQL queries: 101. Can someone take a look at my code and point me in the right direction?

Trigger:
trigger QLAdjustListTotal on SBQQ__QuoteLine__c (after insert, after update, after delete) {
    Decimal ADJrec = 0.00;
    Decimal ADJup = 0.00;
    Decimal ADJhware = 0.00;
    Decimal NETrec = 0.00;
    Decimal NETup = 0.00;
    Decimal NEThware = 0.00;    
    String qid;
    
    list<SBQQ__QuoteLine__c> l;
    
    if(Trigger.isInsert || Trigger.isUpdate){
        l = Trigger.new;
    }
    
    if(Trigger.isDelete){
        l = Trigger.old;
    }
    
    try{
    for(SBQQ__QuoteLine__c q : l){
        qid=q.SBQQ__Quote__c;
    }
 
    for(SBQQ__QuoteLine__c f : l){
        if(f.Adjusted_List_Line_Item__c > 0 && f.Quote_Line_Grouping__c == 'Recurring Fee'){
            ADJrec+=f.Adjusted_List_Line_Item__c;
            if(f.SBQQ__NetTotal__c > 0){
            NETrec+=f.SBQQ__NetTotal__c;
            }
        }
         if(f.Adjusted_List_Total__c > 0 && f.Quote_Line_Grouping__c == 'Upfront Fee'){
            ADJup+=f.Adjusted_List_Total__c;
            if(f.SBQQ__NetTotal__c > 0){ 
            NETup+=f.SBQQ__NetTotal__c;
            }     
        }
        if(f.Adjusted_List_Total__c > 0 && f.Quote_Line_Grouping__c == 'Hardware'){
            ADJhware+=f.Adjusted_List_Total__c;
            if(f.SBQQ__NetTotal__c > 0){ 
            NEThware+=f.SBQQ__NetTotal__c;
                }    
            }
        }
    SBQQ__Quote__c q = [Select Id from SBQQ__Quote__c where Id =: qid];
    q.Adjusted_List_Total_Recurring_Fee_2__c = ADJrec;
    q.Adjusted_List_Total_Upfront_Fee_2__c = ADJup;
    q.Adjusted_List_Total_Hardware_2__c = ADJhware;
    q.Net_Total_Recurring_Fee_2__c = NETrec;
    q.Net_Total_Upfront_Fee_2__c = NETup;
    q.Net_Total_Hardware_2__c = NEThware;
    update q;   
    }catch(QueryException ex){
    System.debug(ADJrec);
    System.debug(ADJup);
    System.debug(ADJhware);
    System.debug(NETrec);
    System.debug(NETup);
    System.debug(NEThware);}     
    
}

Test Class
@isTest(SeeAllData = true)
public class TestQLAdjustListTotal {
    static testMethod void TestQL(){
        //Start Test
        Test.startTest();
        
        //Declare Variables and Objects
        Decimal ST = 12;
        Date StartQuote = Date.today();
        Account a = new Account();
        Opportunity o = new Opportunity();
        SBQQ__Quote__c q = new SBQQ__Quote__c();
        SBQQ__QuoteLine__c qlRec = new SBQQ__QuoteLine__c();
        SBQQ__QuoteLine__c qlUp = new SBQQ__QuoteLine__c();
        SBQQ__QuoteLine__c qlHware = new SBQQ__QuoteLine__c();        

        //Create Account Record
        a.Name = 'TestAccount';
        insert a;
        update a;
        
        //Create Opporunity
        o.Name = 'Test Opp';
        o.AccountId = a.Id;
        o.Type = 'New Business 2';
        o.CloseDate = StartQuote;
        o.Type_of_Sale__c = 'New System';
        o.ECi_Product__c = 'Spruce';
        o.StageName = 'Owned Lead';
        o.Cloud_Deal__c = True;
      o.Pricebook2 = [Select id from Pricebook2 where id ='01s0v000000PRox'];
        insert o;

        
        //Create Quote Record
        q.SBQQ__Account__c = a.Id;
        q.SBQQ__Opportunity2__c = o.Id;
        q.SBQQ__Status__c = 'Draft';
        q.SBQQ__Type__c = 'Quote';
        q.SBQQ__StartDate__c = StartQuote;
        q.CurrencyIsoCode = 'USD';
        q.SBQQ__Primary__c = True;
        q.SBQQ__SubscriptionTerm__c = ST;
        q.SBQQ__PriceBook__c = [Select id from Pricebook2 where id ='01s0v000000PRox'].id;
        insert q;

        //Create Quote Line Records
        
        //Create Recurring Fee Quote Line
        qlRec.SBQQ__Quote__c = q.Id;
        qlRec.SBQQ__Product__c = [Select id from Product2 where id ='01t0v0000010bna'].id;
        insert qlRec;
        delete qlRec;
        
        //Create Upfront Fee Quote Line
        qlUp.SBQQ__Quote__c = q.Id;
        qlUp.SBQQ__Product__c = [Select id from Product2 where id ='01t0v0000010bnV'].id;
        insert qlUp;
        delete qlUp;        

        //Create Hardware Fee Quote Line
        qlHware.SBQQ__Quote__c = q.Id;
           qlHware.SBQQ__Product__c = [Select id from Product2 where id ='01t0v0000010bnf'].id;

        insert qlHware;
        delete qlHware;        
        Test.stopTest(); 
    }

}
I see that we can set Apex unit test with an annotation of @isTest(isParallel=true). That is awesome. However I'm requesting some clarification on its functionality.
  1. What is the default value? (I assume false... but don't like to assume)
  2. If I select a group of tests and indicate to SF that I want those tests to run in parallel, do I have to explicity set that to FALSE inorder to preform specific tests in serial? (or do they all run in parallel because I requested it)
  3. If I select a group of tests and indicate I want them run in serial, if isParallel set to TRUE does it over ride and still run in parallel?
Basically I want to understand the dynamics of isParallel before implementing in a LARGE project, that for years has run in serial. It has some tests that do NOT work in parallel, however we want to get the best possible performance out of the tests that can. So our HOPE is that we can tell Salesforce to run all tests in parallel, except the few that cannot, and run those in serial.  Is this the right feature to enable or set this.

Thanks in advance.

 
I understand TestDataFactory classes won't be counted against org limit and i would like to whether code coverage has to be done separately for these classes. 

Looking for help and example if any.