• Andries.Neyens
  • NEWBIE
  • 160 Points
  • Member since 2013
  • Acuerdo Consultancy


  • Chatter
    Feed
  • 4
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 70
    Replies

We have build a lightning component that we placed on a Wordpress website via Lighting out ($Lightning.use).
This component is called AF_App (and AF_Main).

Now, we want to include a Live Agent standard component snippet on the same page from Service Cloud.
When we place both snippets on the same place we get following error:

Uncaught (in promise) Error: $Lightning.use() already invoked with application: c:AF_App

You can find everything back on this page:
https://kmo.attentia.be/blank-page-talent-peaks/
in the middle my component ( a screen flow build in apex/aura) and floating you see the "Chat with an expert" button

Use developer console to see the error.

I'm trying to launch a custom quick action from within a Lightning Component.
According the example given, it should work:

https://developer.salesforce.com/docs/atlas.en-us.case_feed_dev.meta/case_feed_dev/quickaction_api_getCustomAction.htm

And it all does work, if I add the highlight panel on the page that include the Quick action.
If you remove it from the page, the api returns:
 
{"targetName":"Contact","actionName":"Contact.Call","success":false,"parentContext":null}
Is there a way to call them, without having them on the lightning page?

 
Hi All,
 I have one master (obj A) and 3 child object (ObjB,ObjC,ObjD) in look up relationship. Each child have Amt field and Mast have Final_Amount(ie sum of Amt all childs record) . I want whenever new record is created in any of child object sum of Amt field is get added\updated in master field.
Example
ObjB - 3 records Sum (Amt) = 40
ObjC - 2 records Sum (Amt) = 45
ObjD - 4 records Sum (Amt) = 50

So value in ObjA Final_Amounts should be  (40+45+50)= 135
Now one more entry is added in ObjD with Value 10 Then Final_Amounts  should be 145
First thought for this is Trigger on each 3 child object. But implementation\logic will be same for 3 trigger.(Want to avoid code same code repetition)
Is there any way I can achieve this with Trigger ?

Also please suggest some other way is there to achieve this.
Hello,

I am wondering if something like this is possible using just workflows. An example of what I am trying to do would be if someone creates a new opportunity, then a window pops up for them to fill out name, then they click next and a window pops up for them to fill in company/title, etc.

Is this doable?

Thanks,
Frank
Long story short, I'm trying to write a single app for multiple salesforce because a parent company acquired other companies that are  staying in their separate instances of salesforce. I'm trying to create a single global application, but I'm getting Apex errors with my force-app classes because some properties of some objects exist in some instances but not others. My immediate challenge is when I try to write my Apex code, on SDFX force / push (to the scratch org) the compiler checks and throws an error when it sees my Apex classes attempt to access (potentially) non-existent custom properties of the Opportunity object. 

e.g. salesforce instance 1 has custom properties on the Opportunity A, B, C and instance 2 has custom properties X, Y, Z, 
My code will detect which instance of salesforce I'm using (either with custom settings or metadata -- I haven't worked that out yet), then it would only execute settings where the properties do in fact exist. In theory, the code should work fine because it will detect the right instance of salesforce and only execute the right code (the code differences are also small -- so I only want to include that in my current project).

Anyway, my problem is I am writing one application artifact / pacakge, and I don't want to replicate thousands of lines of code just because each salesforce instance requires slightly different code -- I also can't share properties between salesforce instances because each salesforce instance has a different defition of opportunity custom properties, and each instance also typically uses 500+ properties.  

What kind of solutions are viable here?
1-many force-apps? (terrible) do i have to write a separate app (and massively duplicate my code) for each salesforce instance?
2-conditional imports? (decent if possible) could i do conditional imports in my apex classes & put the extra support code in separate artifacts?
3-object inheritance? (would be nice) can I write a core artifact and extend it with my other artifacts -- and use some object inheritance across artifacts?
4-what other options do I have -- are there other possibilites? 
Hi I am trying to get that value from a selected list as a variable going to the next VF page.  However, it continues to only give me the default value (2):

VF Page
<apex:page controller="ParameterController">
    <h1>Your latest Membership Status</h1>
  
              <apex:pageBlock >
        <apex:pageBlockSection > 
            <apex:form >       
          <p> How Long to extend your ISN membership
          
  <apex:selectList size="1" value="{!SelectedValue}" label="SelectedValue" id="SelectedValue">
        <b>  <apex:selectOptions value="{!dynamiclist}" /></b>
       <p></p>
             <apex:actionSupport event="onchange" reRender="one"  />
</apex:selectList></p><p></p>
             </apex:form>            
              <form id="browserpost" method="POST" action="Page2">
        <input type="hidden" name="namex" value="{!Contact.Name}"/>
        <input type="hidden" name="Payment" value="{!SelectedValue*203}"/> 
        <button type="submit" >
           Make Payment
        </button> 
        <apex:outputLabel id="one" >      You have selected: {!selectedValue} years.       
   The total cost will be: ${!selectedValue*203}   </apex:outputLabel>
    </form><p></p>    
              </apex:pageBlockSection>
    </apex:pageBlock> 
</apex:page>
Relevant Contoller:
 
// DROP DOWN LIST FOR YEARS TO RENEW 
    public Integer selectedValue {
    get
    {
       if(selectedValue==null)
           selectedValue=2;
 return selectedValue;   }
set;        
}

 public List<SelectOption> getdynamiclist() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('1','1 year'));
        options.add(new SelectOption('2','2 years'));
        options.add(new SelectOption('3','3 years'));
         options.add(new SelectOption('4','4 years'));
        options.add(new SelectOption('5','5 years'));
        return options;
    
    }

Any help would be appreciated!


 

Hi guys,

Why it keep on showing me this message (Map key error), instance I want to display the Error Message that I type myself. And, when i view in Log of Developer Console, it got show that I got hit my Error Message but why it still cant show in Visualforce Page???Map Key Error

 

Hi all,
I want to show the duplicate email validation error message in first Custom vfpage while redirecting to second vfpage. In Save method  I have written try catche method which is calling in the second page. But In the first page i want to show the duplicate email Id validation error message.

Can anyone help me over here.

Thanks in advance.
Regrads,
mac.
I've been using Web-to-case for clients for a few months now and have never had an issue.  Today I came across an issue where the field "Estimated Start Date" show up blank, even though I made the field required in the online form.  This appears to be for 1 client only and 1 contact, as other clients and contacts from that client are coming in with the Estimated Start Date showing.  Any ideas?
Hi,
When I checked below code in my dev org. It was almost cover 97% code covrage but when I applied same code in my sandbox it was showing only 10% of code covrage. Strange!
Please fing bellow batch class and test class:
global class SendEmailToDueDateTask implements Database.Batchable<sObject>  {
    map<string,list<task>> userEmailTasklistmap = new map<string,list<task>>();
    
    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator([SELECT ID,createddate,what.id,Owner.Email,OwnerId,owner.name,Status,ActivityDate,Subject from Task WHERE Status != 'Completed' and owner.isactive = true and owner.profile.id = '00eD0000001Qs3R']);
    }
    
    global void execute(Database.BatchableContext BC, List<Task> scope){
        for(Task Tsk : scope){
            if(!userEmailTasklistmap.Containskey(tsk.owner.email)){
                userEmailTasklistmap.put(tsk.owner.email, new list<task>());
            }
            userEmailTasklistmap.get(tsk.owner.email).add(tsk);
            
          }  
        List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
    
            for(string email : userEmailTasklistmap.keyset()){
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                list<string> toAddresses = new list<string>();
                toAddresses.add(email);
                mail.setToAddresses(toAddresses);
                mail.setSubject('Details of tasks due for today');                
                String username = userEmailTasklistmap.get(email)[0].owner.name;
                String htmlBody = '';
                
                htmlBody = '<table width="100%" border="0" cellspacing="0" cellpadding="8" align="center" bgcolor="#F7F7F7">'+
                            +'<tr>'+
                              +'<td style="font-size: 14px; font-weight: normal; font-family:Calibri;line-height: 18px; color: #333;"><br />'+
                                   +'<br />'+
                                    +'Dear '+username+',</td>'+
                            +'</tr>'+
                            +'<tr>'+
                                +'<td style="font-size: 14px; font-weight: normal; font-family:Calibri; line-height: 18px; color: #333;">Following tasks are pending. Please update the status.</td>'+
                            +'</tr>'+
                        +'</table>';
 
                htmlBody +=  '<table border="1" style="border-collapse: collapse"><tr><th>Related To</th><th>Subject</th><th>Created Date</th><th> Due Date</th></tr>';
                for(task tsk : userEmailTasklistmap.get(email)){
                    
                    String duedate = '';
                    if (tsk.ActivityDate != null)
                        duedate = tsk.ActivityDate.format();                    
                    else
                        duedate = '';
                    String Subject = tsk.subject;
                    datetime dt = tsk.createddate;
                    string createddate = dt.format('M/d/yyyy');
                    //string what = https://ap2.salesforce.com/tsk.what.id;
                    string View = URL.getSalesforceBaseUrl().toExternalForm()+'/'+ tsk.id;
                    string Clickhere = View;  
                    htmlBody += '<tr><td>' + Clickhere + '</td><td>' + Subject + '</td><td>' + createddate + '</td><td>' + duedate + '</td></tr>';                    
                }
                 htmlBody += '</table><br>';
                 mail.sethtmlBody(htmlBody);
                 mails.add(mail);                    
            }
             if(mails.size()>0)
             Messaging.sendEmail(mails);
    }
    global void finish(Database.BatchableContext BC){        
    }
}

Test Class:
@isTest 

public class SendEmailToDueDateTaskTest { 

static testMethod void testMethod1(){ 

        Profile pro = [SELECT Id FROM Profile WHERE Name='Standard User'];  
        User usr = new User(Alias = 'standt', Email='standarduser@tt.com',  
        EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',  
        LocaleSidKey='en_US', ProfileId = pro.Id,  
        TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@tt.com'); 

        System.runAs(usr) { 
            Account acc = new Account(); 
                acc.Name = 'Test Account'; 
                insert acc; 
                acc=[SELECT id,Name FROM account WHERE id=:acc.Id]; 
                System.assertEquals(acc.Name,'Test Account'); 
            Task tsk = new Task(); 
                tsk.whatId = acc.Id;  
                tsk.Subject = 'Testing'; 
                tsk.Status = 'In Progress'; 
                tsk.Priority = 'Normal'; 
                tsk.ActivityDate = System.today(); 
                insert tsk ; 
                tsk=[SELECT id,Status FROM Task WHERE id=:tsk.Id]; 
                System.assertEquals(tsk.Status ,'In Progress'); 
            } 
            Test.StartTest(); 
                Database.executeBatch (new SendEmailToDueDateTask (),200); 
            Test.StopTest(); 
    } 
 }

Please help. Where I am wrong.
Hi All, 

We had this following error : 502 (Bad Gateway) when we tried to call a WS (soap) from community.
There is no issue if we test it in admin

here the code : 


sforce.connection.remoteFunction({
              url : "https://v10-creditor.cs81.force.com/creditor/services/Soap/class/WebServiceTest",//"https://" + window.location.host + "/services/Soap/class/WebServiceTest",//"https://maps.googleapis.com/maps/api/geocode/json?address=Kensington",
            //mimeType: "text/xml",
            cache : false,
            async: false,
              requestHeaders: {"Authorization":"Bearer " + __sfdcSessionId, 
              "Content-Type":"text/xml",
                        "SOAPAction": "Hello"
                    },
              requestData: envelope.join(''),
              method: "POST",
              onSuccess : function(response) {
                  // sforce.debug.log(response);
                  console.log('response: ');
                  console.log(response);
                  var obj = JSON.stringify(xmlDoc);
                  console.log('stringify: ');
                  console.log(obj);
                   var jObj = JSON.parse(obj);
                  //alert("onSuccess: \n\n" + jObj);
                  console.log('JSON: ');
                   console.log(jObj);

                  return returnObject;
              },
              onFailure : function(response) {
                  console.log(response);
                  var parser = new DOMParser();
                  var xmlDoc = parser.parseFromString(response,"text/xml");
                  //alert("onFailure end:" + xmlDoc);
                  return returnObject;
              }
            });
            // Step 3: Get Response from GED WS - Khanh
            return returnObject;
        }

 
Hi ,

Could you please help me on below error,

System.SObjectException: Field is not writeable: User.ProfileId

thanks in advance.
venu
Hi all,

we are trying to use AngularJS as a community site.
Problem is that the first page is accessible as a guest user.
All remote action calls are public.
At a certain point, the calls must be made protected (via profile and apex class security)

Here we want to use some sort of login via remote actions using Site.Login
But helas, this is not working.
Session id's returned are still for guest users (but login was successful, can be seen in the login history)
Only way to let this work is use the standard login page that somehow sets session id's via cookies?
no idea how to mimic this ??

andries