• Joseph Bauer
  • NEWBIE
  • 70 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 18
    Replies
Hello,

What is use of customer portals ?
How to create them ?
How can specific profile be given access to protals ?
how are specific record types and objects be given access to portal users ?

 
  • December 26, 2016
  • Like
  • 0
Hello,

I have a lookup field, but it is not working in Visualforce page,
Is there any way to do it ?

​thanks for suggestions !
  • December 26, 2016
  • Like
  • 0
I'm experiencing some very weird behavior with SingleEmailMessage. I'm just trying to send an email to all users in a case team on the case. It works if I hard code values for subject and body. I want to use variables. But whats even stranger is it doesn't work if I change the hardcoded values. For example if I change the subject from 'Test Message' to 'Case Updated' then it doesn't send me the email. Why would changing the subject prevent the email from being sent? Same thing is happening with the body... Here is my code. Can someone reproduce this issue or is it just my org?
 
public class CaseHistoryTrackerHandler {
	public static Messaging.Email[] allMails{get;}
	public static List<Id> userIds{get;set;}

	static {
		userIds = new List<Id>();
	}

	public static void handleCaseHistory(List<Case> newCases, Map<Id, Case> oldCaseMap) {
		final List<Schema.FieldSetMember> trackedFields = SObjectType.Case.FieldSets.HistoryTracking.getFields();

	    if (trackedFields.isEmpty()) 
	    	return;

	    Map<Id, List<Id>> caseIdToUserIds = getCaseUsers(newCases);

	    Map<Id, User> userIdToUser = new Map<Id, User>([SELECT Email FROM User WHERE Id IN :userIds]);

		Messaging.SingleEmailMessage[] messages = new List<Messaging.SingleEmailMessage>();

	    for (Case newCase : newCases) { 

	        final Case oldCase = oldCaseMap.get(newCase.Id);
	        final List<Id> userIdsForEmail = caseIdToUserIds.get(newCase.Id);

	        if(userIdsForEmail == null || userIdsForEmail.size() == 0)
	        	return ;

	        String body = 'Case id: ' + newCase.Id + ' has been modified by the following changes: <br />';

	        for (Schema.FieldSetMember fsm : trackedFields) {

	            String fieldName  = fsm.getFieldPath();
	            String fieldLabel = fsm.getLabel();

	            if (newCase.get(fieldName) == oldCase.get(fieldName))
	                continue;

	            String oldValue = String.valueOf(oldCase.get(fieldName));
	            String newValue = String.valueOf(newCase.get(fieldName));

	            if (oldValue != null && oldValue.length()>255) 
	                oldValue = oldValue.substring(0,255);

	            if (newValue != null && newValue.length()>255) 
	                newValue = newValue.substring(0,255); 

	            body += 'Field: ' + fieldLabel + '<br />';
	            body += 'Changed By: ' + UserInfo.getUserId() + '<br />';
	            body += 'Old Value: ' + oldValue + '<br />';
	            body += 'New Value: ' + newValue + '<br /><br />';
	        }

	        system.debug(body);
	        // create email for each user
		    for(Id userId : userIdsForEmail) {
				Messaging.SingleEmailMessage message = new Messaging.SingleEmailMessage();
				message.toAddresses = new String[] { userIdToUser.get(userId).email };
				message.subject = 'Test Message';
				message.setHtmlBody('Test');
				messages.add(message);
	        }

	    }
		
Messaging.SendEmailResult[] results = Messaging.sendEmail(messages);

if (results[0].success) {
    System.debug('The email was sent successfully.');
} else {
    System.debug('The email failed to send: ' + results[0].errors[0].message);
}


	}

	public static Map<Id, List<Id>> getCaseUsers(List<Case> newCases) {
		Map<Id, List<Id>> caseIdToUserIds = new Map<Id, List<Id>>();
		for(CaseTeamMember ctm : [SELECT MemberId, ParentID FROM CaseTeamMember WHERE ParentID IN :newCases]){
                if(caseIdToUserIds.containsKey(ctm.ParentID))
                	caseIdToUserIds.get(ctm.ParentID).add(ctm.MemberID);
                else {
                	caseIdtoUserIds.put(ctm.ParentID, new List<Id>{ctm.MemberID});
                }
                userIds.add(ctm.MemberID);
                system.debug('added new member: ' + ctm.MemberID);
        }

        for(Case newCase : newCases) {
       		system.debug(caseIdToUserIds.get(newCase.Id));
        }


        return caseIdToUserIds;
	}
}

So the above code works, but if I change the Test Message subject to Case Updated it doesn't work. 
I'm trying to add a Status label and a select list in a column header so it says Status and the user can select a new status in the header to apply to change all values in the column. Here is the markup:
 
<apex:column><apex:facet name="header">Status <br/>
                     <apex:selectList multiselect="false" size="1" value="{!selectedStatus}" required="false" id="status" label="Status">
                          <apex:selectOptions value="{!statusOptions}"/>
                        </apex:selectList>
                 </apex:facet>
                        {!rec.newStatusValue}
</apex:column>

This just shows a selectList in the header and Status is not rendered. If I change the picklist to just text (IE Status2) it renders both lines correctly. I also tried using a label on the SelectList but that did not work either. Anyone know how to do this?
I tried creating a VF page from copying/pasting the code located here:

https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_visualforce_components_code_sample.htm

I'm getting this error when trying to save:

Error: Unknown component liveAgent:clientChat in liveAgent at line 51 column 23

Is the component liveAgent:clientChat no longer supported?
I added an unmanaged field to the managed packaged field set and when I run this code snippet:
 
system.debug(SobjectType.FieldThatHasFieldSet__c.FieldSets.getMap().get('Managed_Field_Set').getFields());

It only lists the managed fields and not the unmanaged fields that I had added.
Getting this error when trying to save a VF component:

An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience. Thank you again for your patience and assistance. And thanks for using salesforce.com! Error ID: 480876482-2320998 (-83440880)

Here is the code:
 
<apex:component >
<apex:stylesheet value="//maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css"/>
      
    <apex:attribute name="Id" type="String" required="false" description="The id of the deal" />
    <apex:attribute name="dealName" type="String" required="true" description="The name of the deal" />
    <apex:attribute name="picture" type="String" required="false" description="The picture of the deal" />
    <apex:attribute name="status" type="String" required="true" description="The status of the deal" />
    <apex:attribute name="type" type="String" required="true" description="The type of the deal" />
    <apex:attribute name="strategy" type="String" required="true" description="The strategy of the deal" />
    <apex:attribute name="synopsis" type="String" required="true" description="The synopsis of the deal" />
              <div id="containerBox">
                  <div id="nameBox"><h2>{!dealName}</h2></div>
                  <div id="pictureBox"><apex:outputText value="{!picture}" escape="false"/></div>
                  <div id="statusTypeStrategyBox">{!status}</div>
                  <div id="statusTypeStrategyBox">{!type}</div>
                  <div id="statusTypeStrategyBox">{!strategy}</div>
                  
                  <div id="dealSynopsisBox"><div class="sidebar-box">
                      <p>{!synopsis}</p>
                      <p class="read-more"><a href="#openModal" class="button">Read More</a></p>

                        <div id="openModal" class="modalDialog">
                            <div>
                                <a href="#close" title="Close" class="close">X</a>
                                <h2>{!dealName}</h2>
                                <div id="pictureBoxModal"><apex:outputText value="{!picture}" escape="false"/></div>
                                <div id="dealSynopsisBoxModal">{!synopsis}</div>
                                <div id="strategyBoxModal">{!strategy}</div>
                               <i class="fa fa-gbp fa-3x" aria-hidden="true" id="bottomMenuItemsModal"></i>          
                              <i class="fa fa-book fa-3x" aria-hidden="true" id="bottomMenuItemsModal"></i>
                              <i class="fa fa-video-camera fa-3x" aria-hidden="true" id="bottomMenuItemsModal"></i>
                              <i class="fa fa-question-circle-o fa-3x" aria-hidden="true" id="bottomMenuItemsModal"></i>
                            </div>
                        </div>
                     
                  </div></div>

                  
                  
                  <i class="fa fa-gbp fa-3x" aria-hidden="true"></i>          
                  <i class="fa fa-book fa-3x" aria-hidden="true" id="bottomMenuItems"></i>
                  <i class="fa fa-video-camera fa-3x" aria-hidden="true" id="bottomMenuItems"></i>
                  <i class="fa fa-question-circle-o fa-3x" aria-hidden="true" id="bottomMenuItems"></i>

              </div>
              
</apex:component>

 
I have a map<list<list<string>>> variable that I need to iterate over in visualforce. Here is my code:
 
public class testMapController {

    public Map<String, List<List<String>>> getDemoMap(){

        Map<String, List<List<String>>> demoMap = new Map<String, List<List<String>>>();
        List<String> testList = new List<String>();
        testList.add('test');
        testList.add('testing');
        List<List<String>> listOfList = new List<List<String>>();
        listOfList.add(testList);

        
        List<String> testList2 = new List<String>();
        testList2.add('test2');
        testList2.add('testing2');
        listOfList.add(testList2);
        
        demoMap.put('first', listOfList);
        demoMap.put('second', listOfList);
    
        return demoMap;
    }
}

<apex:page controller="testMapController">
<apex:repeat value="{!DemoMap}" var="key" >
    <apex:repeat value="{!DemoMap[key]}" var="keyvalue" >
        <apex:outputText value="{!keyvalue[0]}" />
        <br/>
   </apex:repeat>
</apex:repeat>
</apex:page>

Here is the error I am receiving when trying to save the visualforce page:

Incorrect parameter type for subscript. Expected Text, received Number (even though its a list of lists and should be a number in the subscript)

I have the beta version of the ability to create custom lookup fields on activities enabled. So when I create a look up field to Account I would expect to see 3 relationships to account from a task: AccountID, WhatId, and the newly created lookup field we'll call it Account__c. When I execute this code snippet in execute anonymous it doesn't display the custom lookup field.

Schema.DescribeSObjectResult describe = Account.sObjectType.getDescribe();
Schema.sObjectType childSObject;

for (Schema.ChildRelationship child : describe.getChildRelationships())
{
     childSObject = child.getChildSObject();
     system.debug(childSObject);
     system.debug(child);
}
 

It lists all the relationships except the custom one that was created on task. Is this a known issue?

This app previously worked just fine but now in winter '14 it only works if the dev console is open. I tried removing all system.debug statements and that did not fix the issue. Anyone know how to fix this?
I'm trying to add a Status label and a select list in a column header so it says Status and the user can select a new status in the header to apply to change all values in the column. Here is the markup:
 
<apex:column><apex:facet name="header">Status <br/>
                     <apex:selectList multiselect="false" size="1" value="{!selectedStatus}" required="false" id="status" label="Status">
                          <apex:selectOptions value="{!statusOptions}"/>
                        </apex:selectList>
                 </apex:facet>
                        {!rec.newStatusValue}
</apex:column>

This just shows a selectList in the header and Status is not rendered. If I change the picklist to just text (IE Status2) it renders both lines correctly. I also tried using a label on the SelectList but that did not work either. Anyone know how to do this?
I tried creating a VF page from copying/pasting the code located here:

https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_visualforce_components_code_sample.htm

I'm getting this error when trying to save:

Error: Unknown component liveAgent:clientChat in liveAgent at line 51 column 23

Is the component liveAgent:clientChat no longer supported?
I call the method below from my opportunity's before update trigger.  I'm hitting a too many soql queries error in some cases and when i run the debug log the culprit is this block of code.  I think it is because this thing has a for loop within a for loop that is causing the issue but I'm not sure.  

Anyone see anything in this piece of code that would cause too many soql queries error:
 
public static void updateProductMarket(List<Opportunity> opps) {
        Schema.DescribeFieldResult Pickvalue = Opportunity.Product_Market_s__c.getDescribe();
        List<Schema.PicklistEntry> PickListValue = Pickvalue.getPicklistValues();
        //get a list of all Ids we are updating and add them to oppIds
        set<Id> oppIds = new set<Id>();
        for(Opportunity opp : opps) {
            oppIds.add(opp.Id);
        }
        //get all Opportunity Products for all Opportunities being updated
        List<OpportunityLineItem> olis = [SELECT Product_Market__c, Opportunity.Id FROM OpportunityLineItem WHERE Opportunity.Id in:oppIds];
        for(Opportunity opp : opps) {
            //loop through each line item
            for(OpportunityLineItem oli : olis) {
                if(oli.Opportunity.Id == opp.Id) {
                    //we have a match
                    if(oli.Product_Market__c != null){
                        if(opp.Product_Market_s__c == null) {
                            opp.Product_Market_s__c = oli.Product_Market__c;
                        } else {
                            if(isNewProductMarket(opp.Product_Market_s__c.split(';'), oli.Product_Market__c)){
                                opp.Product_Market_s__c = opp.Product_Market_s__c + ';' + oli.Product_Market__c;
                            }
                        }
                    }
                }
            }
        }
    }

 
Hello,

What is use of customer portals ?
How to create them ?
How can specific profile be given access to protals ?
how are specific record types and objects be given access to portal users ?

 
  • December 26, 2016
  • Like
  • 0
Hello Team,

When I attempt to change the owner of a lead I get the following error: 
Error: Apex trigger HubSpot_Inc.SaveLeadChange caused an unexpected exception, contact your administrator: HubSpot_Inc.SaveLeadChange: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object: (HubSpot_Inc) 

Please help me.
Hello,

I have a lookup field, but it is not working in Visualforce page,
Is there any way to do it ?

​thanks for suggestions !
  • December 26, 2016
  • Like
  • 0
We have e-commerce community in our org. Here customer community users will submits their orders after shopping online and these orders will be reviewed and approved by salesforce platform users from CRM. Actual problem comes here, we couldn't share community user records with CRM users. we wrote apex trigger to share records using apex sharing but it is not working.

NOTE that we don't want to use view All or modify All permissions in profile because this will provide complete access to the users.

your suggestions or ides will be most appreciated.

Thank you guys...
I am gettting frustrated trying to find a company to do this for us. It seems like all the salesforce developing companies are geared to larger companies. We are a small business and just need some minor salesforce customizations. Can someone help???? Thank you.
I have a map<list<list<string>>> variable that I need to iterate over in visualforce. Here is my code:
 
public class testMapController {

    public Map<String, List<List<String>>> getDemoMap(){

        Map<String, List<List<String>>> demoMap = new Map<String, List<List<String>>>();
        List<String> testList = new List<String>();
        testList.add('test');
        testList.add('testing');
        List<List<String>> listOfList = new List<List<String>>();
        listOfList.add(testList);

        
        List<String> testList2 = new List<String>();
        testList2.add('test2');
        testList2.add('testing2');
        listOfList.add(testList2);
        
        demoMap.put('first', listOfList);
        demoMap.put('second', listOfList);
    
        return demoMap;
    }
}

<apex:page controller="testMapController">
<apex:repeat value="{!DemoMap}" var="key" >
    <apex:repeat value="{!DemoMap[key]}" var="keyvalue" >
        <apex:outputText value="{!keyvalue[0]}" />
        <br/>
   </apex:repeat>
</apex:repeat>
</apex:page>

Here is the error I am receiving when trying to save the visualforce page:

Incorrect parameter type for subscript. Expected Text, received Number (even though its a list of lists and should be a number in the subscript)

I have the beta version of the ability to create custom lookup fields on activities enabled. So when I create a look up field to Account I would expect to see 3 relationships to account from a task: AccountID, WhatId, and the newly created lookup field we'll call it Account__c. When I execute this code snippet in execute anonymous it doesn't display the custom lookup field.

Schema.DescribeSObjectResult describe = Account.sObjectType.getDescribe();
Schema.sObjectType childSObject;

for (Schema.ChildRelationship child : describe.getChildRelationships())
{
     childSObject = child.getChildSObject();
     system.debug(childSObject);
     system.debug(child);
}
 

It lists all the relationships except the custom one that was created on task. Is this a known issue?

This app previously worked just fine but now in winter '14 it only works if the dev console is open. I tried removing all system.debug statements and that did not fix the issue. Anyone know how to fix this?
Hi,
I have custom object Target.we are created custom visualforce page and assigned to Target Tab.We used custom visualfoce for targert because we have lot of  validation during record save and page layout implemention according to product selected.

Example : Assiged Visaulforce CreateTarget to target tab (/apex/CreateTarget).Now business want to create clone button on created visualforcepage (CreateTarget).Is there any API for Clone or Idea? 

Please help on create custom clone button on visualforce page?

I am getting Insufficient privileges issue when visualforce page is accessed on a tab.

Actually, the Visualforce page overrides the standard tab of custom object.

 

I have checked all the custom object permissions on the profile and made sure that Visualforce page and Apex classes are enabled for the profile.

The strange thing is that, when i turn on the View Setup and Configuration permission in the profile, the Visualforce page gets rendered well without any issue.

But i don't want that permission to be turned on.

 

If i turn off, i get the same issue.

 

Any thoughts?

Appreciate any help on this.