• Marc D Behr
  • NEWBIE
  • 154 Points
  • Member since 2014
  • CRM and Automation Engineer
  • Emerson Residential Retail


  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 39
    Replies

How can I insert this public static void in my existing Apex Class and include the Case Thread Id in the email?

To insert:

public static String ThreadId(String caseid)
    {

        string Case_ThreadID = '_' + UserInfo.getOrganizationId().left(4) + '0' ;
        Case_ThreadID = Case_ThreadID + UserInfo.getOrganizationId().mid(11,4) + '._';
        Case_ThreadID = Case_ThreadID + caseid.left(4) + '0' + caseId.mid(10,5);

        return Case_ThreadID;
    }


My existing Apex Class:

// Sends Case information to the Interpreting Department
// Email addresses are listed under Custom Labels: custom_VIEmailAddresses

public class custom_VICasesForwarding {

    @InvocableMethod(Label='forwardToInterpretingDept')
    public static void forwardToInterpretingDept(List<ID> caseRecords){
        Set<Id> createEmailAddresses = new Set<Id>();
        List<Case> caseList = [select Id, 
                                    Subject, 
                                    CaseNumber, 
                                    Case_Reason__c, 
                                    Case_Issue__c, 
                                    Description, 
                                    Date_Time_of_Call__c, 
                                    VINumber__c, 
                                    Customer_s_VP__c, 
                                    Outbound_Audio__c,
                              (select Id from EmailMessages)
                              from Case where Id IN :caseRecords];

        for(Case c: caseList){
            // Pulls field data from Case to include in the email body
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            String[] toaddr = new String[System.Label.custom_VIEmailAddresses.split(',')];
            string[] ccaddr = new string[]{};
            email.setSubject('FW: ' + c.CaseNumber + ' : ' + c.Case_Reason__c);
            email.setHtmlBody('Case Number: ' + c.CaseNumber
                                + '<br/>' + 
                                'Case Reason: ' + c.Case_Reason__c 
                                + '<br/>' +
                                'Case Issue: ' + c.Case_Issue__c 
                                + '<br/>' + 
                                + '<br/>' +
                                'Date/Time: ' + c.Date_Time_of_Call__c 
                                + '<br/>' + 
                                'VI #: ' + c.VINumber__c
                                + '<br/>' +
                                'Customer\'s VP #: ' + c.Customer_s_VP__c
                                + '<br/>' +
                                'Outbound Audio #: ' + c.Outbound_Audio__c
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                'Case Description: ' + c.Description 
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                '<i>' + '*Note: If there are any null values, this means this information was not provided by the Case Owner prior to this submission.' + '<i>'
                                + '<br/>');
            email.setToAddresses(toaddr); 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
        }
        
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();   
        
    }  
}

​​​​​​​
trigger CreateTaskWhenNewLeadGenerate on Lead (after insert) {
  Set<Id> LdIdSet = new Set<Id>();
 if(Trigger.isAfter && Trigger.isInsert) {            
        
   List<Lead> LdList = [ SELECT Id,Name,OwnerId,Company,Email, Phone,pi__comments__c,Leasing_agent__c,Create_Leasing_Call_Task__c,Lead_Property_Of_Interest__c FROM Lead WHERE Id IN : LdIdSet];  
   Map<Id,List<Lead>> LIdLdListMap = new Map<Id,List<Lead>>();
   List<Task> insTskList;
      
   Task newTsk ;
    
   
                   
        for ( BP_Property__c Prop:[Select Id,Name,IS_ACTIVE__c,Leasing_agent__c from BP_Property__c])
        {                                         
            
              //      LdList = LIdLdListMap.get(Prop) ;
                                                
      
              for ( Lead Ld : Trigger.New ){
                   LdIdSet.add ( Ld.Id );
                        
                if ( Trigger.NewMap.get ( Ld.Id ).Create_Leasing_Call_Task__c &&  ! Ld.Create_Leasing_Call_Task__c ){            
                //Ld.Create_Leasing_Call_Task__c  = true;
               LdList = LIdLdListMap.get( Ld.Id ) ;    
               
                if ( LdList == null || LdList.size() == 0 )
                    continue;                              
                  
                          if(Ld.Lead_Property_Of_Interest__c == null){
                              if(Ld.Leasing_Agent__c == null){
                                  
                              }
                                  
                              else{ 
                                       newTsk = new Task();
                                     newTsk.Subject = 'PC-Leasing Call';                                                               
                                     newTsk.OwnerId = Ld.Id;                                   
                                       newTsk.Leasing_Agent_ID__c = 'a0MG000000XkQFc';
                                     insTskList.add ( newTsk );
                                                                                                              
                              }
                }  
                              }else if(Ld.Lead_Property_Of_Interest__c != null && Ld.Leasing_Agent__c != null )
                              {        prop.IS_ACTIVE__c = true;
                                       prop.Leasing_Agent__r.IS_ACTIVE__c = true;
                              }
                                                                                             
                                  else{  
                                     newTsk = new Task();
                                        newTsk.Subject = 'LAInitial-Leasing call';                                                               
                                     newTsk.OwnerId = Ld.Owner_ID__c; 
                                     newTsk.WhoId =Ld.Id ; 
                                     NewTsk.Leasing_Agent__c = Ld.Leasing_Agent__c ;
                                        insTskList.add ( newTsk );
                              }
                              } 
                              
                         }
                                     
                                     insert newTsk;
     
              }            
        }
 
  • February 08, 2016
  • Like
  • 0
I am trying to convert a CMD field from Text to LongTextArea and it appears that you can't convert CMD fields once they are defined. Is this true and if so, why?
 
If I have a text field on an object, I can convert it to LongTextArea, but the same conversion on a CMD object does not appear to be possible. I am not finding any documentation that says I can't do this, but apparently I can't. Has anybody seen where it is documented that this is *not* possible? Without being able to convert the field (since the CMD being used in a SFDX package), it looks like it will take creating a new field, updating all of the code the references the old field, and then deleting the original field unless somebody else has another idea?
In reviewing the Limits API, I see that we have 2000 Durable Streaming clients available via the DurableStreamingApiConcurrentClients field. I show that there are currently (and almost always) > 700 in use. I only have one named push topic with one client, so obviously that is not where the 700 are from.
  1. What else could be using these?
  2. Is there any way to see who/what is consuming these connections?
Question... I have a CloudPage with a smart capture section. I am using a RetrieveSalesforceObjects() call to pre-populate the data on the page, but now I want to update the data using the UpdateSingleSalesforceObject() call when the user presses the Submit button. What I am trying to figure out is now can I read the data that the user entered on the form to add it to the UpdateSingleSalesforceObject() call? If I hardcode values, Salesforce gets updated, but I just don't see how to read the form data.
 
Does anybody have any pointers?
I have a Platform Event that is published when an error occurs in some event. I have a Lightning component that is subscribed to the event, but it only shows the last event. What I want, is to be able to show (as long as the window is open), the last X (say 100) events that have been received and have it continue to update as new events come in (old ones fall off the bottom and new ones appear on the top). 

The component that I am using looks like this
<aura:component implements="flexipage:availableForAllPageTypes">
    <aura:attribute name="lastMessagePayload" type="String" access="private"/>
    <c:streaming channel="/event/DebugEvent__e" onMessage="{!c.handleMessage}"/>
    <div><p>{!v.lastMessagePayload}</p>
    </div>
</aura:component>

Does anybody know how can I make the lastMessagePayload do what I described above? 

Thanks!
When I view a visualforce page in a service console, they appear to be rendered differently than when I view the same page outside of the console. This appears to have just started with the Spring'16 release. An an example, here is what the page looks like in a non console app in Classic mode:
Case page, classic interface, non-console mode

Notice that the 'Device' tab is disabled and greyed out.
Here is the same page in console app, classic mode

User-added image

Notice now that the Device tab does not show up greyed out, but it is not clickable, so it is disabled.

The code that is disabling the tab is (normally there is a test case to determine if the tab should be disabled, but for testing, I have forced it disabled):
<apex:tab id="Device" label="Device" disabled="true" >
            <apex:detail subject="{!case.Device__c}" title="false" />
        </apex:tab>

Is anybody aware of what may have changed that would cause this behaviour?

Thanks!

Marc
I have a visual workflow that is embedded in a VF page so I can use the finishLocation to redirect the user at the completition of the flow. This works fine as long as I want to open a new page at the completition of the flow, but since the majority of my users are using the Service Console, I would rather have the page open in a new primary tab within the console, but I have not been able to figure out how to do this. I tried creating a JS script to check if the session was in a console and calling that with from finishLocation, but that gives me an error as it appears you can not call JavaScript from finishLocation :-(

Does anybody know how do do this?

Thanks!
I currently have a custom REST API call to create a new person account based on the info being passed after some error/configuration checks..We are now getting ready to implement a community and we want the new person accounts to also create and enable the user for a community login (at the same time that it is created).

In order to do this, I added code to my class to populate a new User and then I tried to call the Site.createPersonAccountPortalUser() call (which I assume will be able to replace the call that I currently have to create the person account), but the createPersonAccountPortalUser call is giving me the error "System.TypeException: That operation is only allowed from within an active site".

The code snippet  that I am working on is here:
User u = new User();
u.username = userID+'.wrsb1';
u.Email = userID;
User owner = [Select Id from User where UserRole.Name = 'Support Management' limit 1]; // pick an owner
Id x = Site.createPersonAccountPortalUser(u,owner.id,password);
The REST call is being made by an account that is also used to handle many other REST interface calls,  It is my understaning that Site.createPersonAccountPortalUser() only works from within a community, but I am not sure how to get a REST call to run under a community.

What am I doing wrong or is there some other way to create a person account and then enable them for community access programatically?
I am using Eclipse Kepler Service Release 2 Build id: 20140224-0627 with Force.com IDE 31.0.0.201406301722 com.salesforce.ide.feature.feature.group salesforce.com and it keeps telling me that I have a syntax error when I create a controller extension.

Here is a segment of the code:
public with sharing class CaseExtensions {

    private Case myCase;

    public CaseExtensions(ApexPages.StandardController caseCtrl ) {
        myCase = (Case)caseCtrl.getRecord();
    }

}

The IDE gives me an error on the line "myCase = (Case)caseCtrl.getRecord();" that reads:

Syntax(error = UnexpectedSyntaxError(loc = RealLoc(startIndex = 110, endIndex = 118, line = 6, column = 24), message = missing SEMICOLON at 'caseCtrl'))

If I copy and paste the exactly same code directly into SalesForce, it saves and runs fine. I think there is a bug in the syntax engine... the error message makes no sense since there is a semicolon at the end of the line.... thoughts?
Hi,

I am writing a custom REST API and I can not get past the following and wanted to see if anybody had a solution.

I need to be able to lookup custom records that belong to a customer. The customer can be identified either by an externalID field or thier email address. I have a GET method written that works as follows:

     GET /services/apexrest/Thermostat/byUser/{user}
        where {user} can be either the externalID (an integer), a SF RecordID or an email address

So, if I do a GET of /services/apexrest/Thermostat/byUser/157 (157 being the externalIDI get back the thermostats that belong to user 157 exactly as expected with a 200 HTTP Status code. Sending a SF AccountID also works fine.  But, if I instead send a GET /services/apexrest/Thermostat/byUser/user@here.com I get back a HTTP Status of 404 with the message

     "The requested resource does not exist"

I tried URL encoding the string so I was sending GET /services/apexrest/Thermostat/byUser/user%40here.com to see if that was causing the issue, but I still get the same results. In the code, I added several system.debug messages so I can see what s happening and it looks like in both cases, the code runs 100% sucessfully to the end and exits cleanly, but yet I get an error only when sending the email address.

As far as I can tell, there seems to be an issue with the SF REST parsing when the URL contains the '@' sign.

Has anybody else seen this or maybe have a suggested solution?

Here is the code:
@HttpGet
	global static List<Device__c> getDevice() {
		RestRequest req = RestContext.request;
		RestResponse res = RestContext.response;
		res.statusCode = 400; //failure

		// get the parameters from the command line
 		String[] command = req.requestURI.substringAfter('Thermostat/').split('/');
 		String action = (command.size() >= 1) ? command[0] : '';
        String userID = (command.size() >= 2) ? command[1] : '';
        List<Device__c> devices = new List<Device__c>();

		if(userID == '' ) {
			return devices;
		}
		
		if(action == 'byUser') {
			res.statusCode = 200; //set return status to good
			if(userID.contains('@')) {
				devices = [Select Name, System_ID__c, Zip_Postal_Code__c From Device__c  where Customer__r.PersonEmail = :userID];
			} else if (userID.length() >= 15){
				// we received a SF ID
				devices = [Select Name, System_ID__c, Zip_Postal_Code__c From Device__c  where Customer__c = :ID.valueOf(userID)];
			} else {
				devices = [Select Name, System_ID__c, Zip_Postal_Code__c From Device__c  where Customer__r.WebCustomerID__c = :Decimal.valueof(userID)];
			}
		}
		
		return devices;
	}


I just discovered a bug in the test for Survey Force, and I am not really sure where else to report it since it is not a supported product, so here goes.

If you delete or rename the default report that is installed when you orginally install Survey Force called 'Survey with Questions and Responses', you will find that everything breaks. You will no longer be able to open existing surveys and if you try to deploy new Apex code to the system, the Survey Force tests will fail.

The problem appears to be that the procedure viewResults() in the GettingStartedController class expects that a report named 'Survey with Questions and Responses' exists at all times. 

Hope this helps somebody else.
I just discovered a bug in the test for Survey Force, and I am not really sure where else to report it since it is not a supported product, so here goes.

If you delete or rename the default report that is installed when you orginally install Survey Force called 'Survey with Questions and Responses', you will find that everything breaks. You will no longer be able to open existing surveys and if you try to deploy new Apex code to the system, the Survey Force tests will fail.

The problem appears to be that the procedure viewResults() in the GettingStartedController class expects that a report named 'Survey with Questions and Responses' exists at all times. 

Hope this helps somebody else.

How can I insert this public static void in my existing Apex Class and include the Case Thread Id in the email?

To insert:

public static String ThreadId(String caseid)
    {

        string Case_ThreadID = '_' + UserInfo.getOrganizationId().left(4) + '0' ;
        Case_ThreadID = Case_ThreadID + UserInfo.getOrganizationId().mid(11,4) + '._';
        Case_ThreadID = Case_ThreadID + caseid.left(4) + '0' + caseId.mid(10,5);

        return Case_ThreadID;
    }


My existing Apex Class:

// Sends Case information to the Interpreting Department
// Email addresses are listed under Custom Labels: custom_VIEmailAddresses

public class custom_VICasesForwarding {

    @InvocableMethod(Label='forwardToInterpretingDept')
    public static void forwardToInterpretingDept(List<ID> caseRecords){
        Set<Id> createEmailAddresses = new Set<Id>();
        List<Case> caseList = [select Id, 
                                    Subject, 
                                    CaseNumber, 
                                    Case_Reason__c, 
                                    Case_Issue__c, 
                                    Description, 
                                    Date_Time_of_Call__c, 
                                    VINumber__c, 
                                    Customer_s_VP__c, 
                                    Outbound_Audio__c,
                              (select Id from EmailMessages)
                              from Case where Id IN :caseRecords];

        for(Case c: caseList){
            // Pulls field data from Case to include in the email body
            Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
            String[] toaddr = new String[System.Label.custom_VIEmailAddresses.split(',')];
            string[] ccaddr = new string[]{};
            email.setSubject('FW: ' + c.CaseNumber + ' : ' + c.Case_Reason__c);
            email.setHtmlBody('Case Number: ' + c.CaseNumber
                                + '<br/>' + 
                                'Case Reason: ' + c.Case_Reason__c 
                                + '<br/>' +
                                'Case Issue: ' + c.Case_Issue__c 
                                + '<br/>' + 
                                + '<br/>' +
                                'Date/Time: ' + c.Date_Time_of_Call__c 
                                + '<br/>' + 
                                'VI #: ' + c.VINumber__c
                                + '<br/>' +
                                'Customer\'s VP #: ' + c.Customer_s_VP__c
                                + '<br/>' +
                                'Outbound Audio #: ' + c.Outbound_Audio__c
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                'Case Description: ' + c.Description 
                                + '<br/>' +
                                + '<br/>' +
                                + '<br/>' +
                                '<i>' + '*Note: If there are any null values, this means this information was not provided by the Case Owner prior to this submission.' + '<i>'
                                + '<br/>');
            email.setToAddresses(toaddr); 
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
        }
        
        Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();   
        
    }  
}

​​​​​​​
I am trying to convert a CMD field from Text to LongTextArea and it appears that you can't convert CMD fields once they are defined. Is this true and if so, why?
 
If I have a text field on an object, I can convert it to LongTextArea, but the same conversion on a CMD object does not appear to be possible. I am not finding any documentation that says I can't do this, but apparently I can't. Has anybody seen where it is documented that this is *not* possible? Without being able to convert the field (since the CMD being used in a SFDX package), it looks like it will take creating a new field, updating all of the code the references the old field, and then deleting the original field unless somebody else has another idea?
I would like to auto-populate contact name when an email address is given in the case.

Can someone please hep me with this?

Thanks in advance
Could you pls someone explain how to debug wat is the satus of the trigger and monitoe if it is not working in mainly prodction 
For example: Reason : i have trigger(after trigger)  on one objects registarion . it is inserting date into an other object(states) . after registarion is created , it is inserting record in to states


 
  • October 18, 2017
  • Like
  • 0
I'm working on "Module: **Org 62 Sales Basics** (https://trailhead.salesforce.com/trails/mr-drive-ae-success-with-org62/modules/mr-org62-sales-basics)" but having trouble with enabling "Lightning Experience". Can someone help to find "Get Started"?User-added image
I am working on Trailhead challenge : Create an Apex trigger for Account that matches Shipping Address Postal Code with Billing Address Postal Code based on a custom field.
I first wrote this code:
 for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c = true && a.BillingPostalCode!=Null) {
            a.ShippingPostalCode = a.BillingPostalCode;
        }   
    }
}
Error Message I am getting is : "Challenge not yet complete... here's what's wrong:
Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true."


Below is the code that I saw it in youtube tutorial
trigger AccountAddressTrigger on Account (before insert, before update) {
 
    for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c == true) 
            a.ShippingPostalCode = a.BillingPostalCode;
         
    }
 
}
I am getting following error message:
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Delete failed. First exception on row 0 with id 00141000013PNVjAAO; first error: DELETE_FAILED, Your attempt to delete TestMyCodeCo could not be completed because it is associated with the following cases.: 00001052 Your attempt to delete TestMyCodeCo could not be completed because some opportunities in that account were closed won. The opportunities that could not be deleted are shown below.: Opp : []

 
Hi,

I have a lighting component with a few buttons on it that I have added to my users home page in the lightning app builder.

These buttons need to launch various flows in new primary tabs in their Salesforce Console. I am aware that one can use a visual force page and use the intergrations toolkit. However the problem is that VF is rendered in an iFrame on the console home page which doesn't allow the JS to interact with the parent window. So when I attempt to execute the sforce.console.openPrimaryTab() function it doesn't do anything.

Is there a way to launch the VF page in a new tab using a lighting component button. I have tried force.navigateToURL but that just opens it in the home tab which I don't want.

Below is my code which is yeilding no result
 
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
    <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">
        <head>
            <meta charset="utf-8" />
            <meta http-equiv="x-ua-compatible" content="ie=edge" />
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <apex:slds />
            <script src="/support/console/40.0/integration.js" type="text/javascript"></script>
        	<script>
            	function openTab()
            	{
                	sforce.console.openPrimaryTab(undefinded, '/flow/' + flow, true, 'New Bike');
            	}
        </script>
        </head>
    </html>
    <body>
        
        <div class="slds-scope">
            <div class="slds-border--bottom slds-m-bottom--medium">
                <h1 class="slds-page-header__title slds-m-right--small slds-align-middle slds-truncate" title="Flow Launcher">
                    Flow Launcher
                </h1>
            </div>
            <div class="slds-m-top--medium">
                <button class="slds-button slds-button--brand" onclick="openTab()">Link 1</button>
                <button class="slds-button slds-button--brand">Link 2</button>
                <button class="slds-button slds-button--brand">Link 3</button>
            </div>
        </div>

    </body>
</apex:page>

Any help would be great thanks.
I'm having all sorts of problems trying to complete the challenge for the sharing rules section of this module. I feel like I have everything setup properly but still get this error message:
Challenge Not yet complete... here's what's wrong: 
The Sharing Set is not setup with proper Case access. Please check the requirements.

Sharing set name is "Share cases with customers"
Applies to Profiles: Customer Community User
Access Granted: Case - User:Account = Case:Account - Read/Write

What am I missing

 
So...I created a checkbox formula field on a case that clicks true if the following criteria are met:

IF( (TODAY()> Contact_Cust_Identify_Issues__c ) && ISBLANK(Contacted_Customer_Date__c) 
,true,false)

I then created a workflow that SHOULD trigger an email and create a completed task that states the email was sent. I chose to have the workflow evaulate each time the case meets criteria. The workflow is not firing. 

Here is the workflow rule:
(Case: Case Record TypeEQUALSCase; VOC Response Plan) AND (Case: > 2 DaysEQUALSTrue) AND (Case: StatusEQUALSNew)

Is the formula field update not considered an edit? What am I doing wrong here? I feel dumb because this seems so simple.

Please help,

Shannon
I've been having a recurring issue with my SFDC org every 3-4 days or so, and this is what happens:
  • I get a notification that our API Usage is at 101%+ usage
  • Our Marketo and Workato integrations cease to work

When I check out the API usage by user report in the last 24 hours I see nothing coming close to 100% usage. After stumbling upon this page: https://help.salesforce.com/HTViewSolution?id=000003706&language=en_US which mentions:

"NOTE: This report displays SOAP API usage, but REST API (including Bulk API) calls are not included in the report, which might explain why the data displayed in the report does not match the figure returned by the System Overview page."

I'm lead to believe it's our REST API usage that is causing us to go over our API limit.

Is there any way to find out where these API calls are coming from? If more details are needed, I'd be happy to provide them.

Thanks in advance!
 

Hi, I've enjoyed using trailhead and i'm attending admin basic trail. When I do this challenge :

Users sometimes want a more detailed way to add new Accounts. In order to make entry of new Account data more flexible, add a new global quick action with a new layout and new default values.Create a new global quick action labeled 'New Detailed Account' to create an Account record.
Add the Account Name, Type, Rating and Fax fields to the action layout.
Add the new quick action to the global publisher layout.
Set the predefined value of the 'Type' field to 'Prospect'.

I get this message:
Challenge Not yet complete... here's what's wrong: 
The global quick action was not created or it was not named 'New Detailed Account'

But i'm sure that New Detailed Account exist. How could i fix it? Please help me.
Hi,

For below trigger, when i have deployed in production, i am getting the "limit exception : too many query rows : 50001"
trigger TaskUpdatewithLeadComments on Task (after insert) {
     Set<Id> leadids = new Set<Id>();
    List<Task> taskstoupdate = new list<Task>();
    
    //Fetch only Leads which follow criteria
    for(Lead ld : [ SELECT Id, company  FROM lead ])
        {
            leadids.add(ld.Id);
    }
    //Iterate over all Leads and modify Tasks for them + Add to a list variable 
    for(Lead ld : [SELECT Id, Prospect_notes__c,(SELECT Id, Whatid, Description FROM Tasks) from Lead Where Id IN : leadids])
    
     {
        for(Task t : ld.Tasks) {
        
           if(t.Description==null)
            t.Description = ld.prospect_notes__c;
            taskstoupdate.add(t);
        }
    }
    
    //Update Tasks
    if(taskstoupdate.size()>0) {
        update taskstoupdate;
    }
}

how can i fix this ?
trigger CreateTaskWhenNewLeadGenerate on Lead (after insert) {
  Set<Id> LdIdSet = new Set<Id>();
 if(Trigger.isAfter && Trigger.isInsert) {            
        
   List<Lead> LdList = [ SELECT Id,Name,OwnerId,Company,Email, Phone,pi__comments__c,Leasing_agent__c,Create_Leasing_Call_Task__c,Lead_Property_Of_Interest__c FROM Lead WHERE Id IN : LdIdSet];  
   Map<Id,List<Lead>> LIdLdListMap = new Map<Id,List<Lead>>();
   List<Task> insTskList;
      
   Task newTsk ;
    
   
                   
        for ( BP_Property__c Prop:[Select Id,Name,IS_ACTIVE__c,Leasing_agent__c from BP_Property__c])
        {                                         
            
              //      LdList = LIdLdListMap.get(Prop) ;
                                                
      
              for ( Lead Ld : Trigger.New ){
                   LdIdSet.add ( Ld.Id );
                        
                if ( Trigger.NewMap.get ( Ld.Id ).Create_Leasing_Call_Task__c &&  ! Ld.Create_Leasing_Call_Task__c ){            
                //Ld.Create_Leasing_Call_Task__c  = true;
               LdList = LIdLdListMap.get( Ld.Id ) ;    
               
                if ( LdList == null || LdList.size() == 0 )
                    continue;                              
                  
                          if(Ld.Lead_Property_Of_Interest__c == null){
                              if(Ld.Leasing_Agent__c == null){
                                  
                              }
                                  
                              else{ 
                                       newTsk = new Task();
                                     newTsk.Subject = 'PC-Leasing Call';                                                               
                                     newTsk.OwnerId = Ld.Id;                                   
                                       newTsk.Leasing_Agent_ID__c = 'a0MG000000XkQFc';
                                     insTskList.add ( newTsk );
                                                                                                              
                              }
                }  
                              }else if(Ld.Lead_Property_Of_Interest__c != null && Ld.Leasing_Agent__c != null )
                              {        prop.IS_ACTIVE__c = true;
                                       prop.Leasing_Agent__r.IS_ACTIVE__c = true;
                              }
                                                                                             
                                  else{  
                                     newTsk = new Task();
                                        newTsk.Subject = 'LAInitial-Leasing call';                                                               
                                     newTsk.OwnerId = Ld.Owner_ID__c; 
                                     newTsk.WhoId =Ld.Id ; 
                                     NewTsk.Leasing_Agent__c = Ld.Leasing_Agent__c ;
                                        insTskList.add ( newTsk );
                              }
                              } 
                              
                         }
                                     
                                     insert newTsk;
     
              }            
        }
 
  • February 08, 2016
  • Like
  • 0
When I view a visualforce page in a service console, they appear to be rendered differently than when I view the same page outside of the console. This appears to have just started with the Spring'16 release. An an example, here is what the page looks like in a non console app in Classic mode:
Case page, classic interface, non-console mode

Notice that the 'Device' tab is disabled and greyed out.
Here is the same page in console app, classic mode

User-added image

Notice now that the Device tab does not show up greyed out, but it is not clickable, so it is disabled.

The code that is disabling the tab is (normally there is a test case to determine if the tab should be disabled, but for testing, I have forced it disabled):
<apex:tab id="Device" label="Device" disabled="true" >
            <apex:detail subject="{!case.Device__c}" title="false" />
        </apex:tab>

Is anybody aware of what may have changed that would cause this behaviour?

Thanks!

Marc

I'm currently testing out Survey Force from Force.com Labs http://appexchange.salesforce.com/listingDetail?listingId=a0N30000003I2gDEAS

I
've manage to install, deploy and create my first survey, however when I select 'Email link with Contact & Case merge' it is not finding any sites to expose to. The only option I have is internal despite the fact I have a site enabled with the required vforce pages.

I am doing this in a sandbox, would this cause this to happen?

If anyone can advise, I would be very grateful!

Cheers,

Graeme

  • February 23, 2012
  • Like
  • 0