• Andy Boettcher
  • ALL STAR
  • 5425 Points
  • Member since 2011
  • Salesforce MVP | @andyboettcher | Chief Architect @demandchainsys
  • Demand Chain Systems


Badges

  • Chatter
    Feed
  • 171
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 4
    Questions
  • 2021
    Replies
We are developeing a VF page where we can capture customer signature and attach it to the record.
The code is developed based from  following 2 posts.

http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
http://blog.jeffdouglas.com/2010/07/14/attach-a-pdf-to-a-record-in-salesforce/


It's done it 2 steps.
First we capture the signature and save it to aatchment as png file.
Second in the Visulforce page we refer this image to include in the VF. (The singnature doc Id is passed as URL parmenter )

This is how it's referd in the VF page that is redered as PDF
 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 The fileId is the attachment ID of the signature impage

The problem we have is once this page is attached to the record the image is broken. It's not diplaying image.
If I harcode this tag like below

 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file==00P55000000HHz1"  />
 
 Every thing works fine.
 
 I debugged and verified that the URL parmenter is getting the right value.
 
 I would like your help to fix this issue.
<apex:page standardController="Account" extensions="reconInventoryController"  renderAs="pdf"  >
<apex:form >



<!---
<apex:outputPanel styleClass="panelWrapper" layout="block">
    <apex:pageBlock title="Inventory Updated" >
    </apex:pageBlock>
</apex:outputPanel>
--->

    <apex:pageBlock title="{!theAccount.Name} - Inventory Dated ( {!Today()})">
  

      
         <apex:pageBlockTable value="{!inventories}" var="c">
            
             <apex:column value="{!c.Name}" />   
            <apex:column value="{!c.Pendant_Serial_Number__c}" />
            <apex:column value="{!c.Shelf_Life__c}" />
            <apex:column value="{!c.Ship_Date__c}" />
            <apex:column value="{!c.Phone_Serial_Number__c}" />
           
            <apex:column value="{!c.Data_Retrieval__c}" />
            <apex:column value="{!c.Status__c}" />
            <apex:column value="{!c.Comments__c}" />
           
        
            
        </apex:pageBlockTable>
        
       
        
    </apex:pageBlock>
    {!MySignURL}
    <!--
    <apex:image url="{!MySignURL}" width="256" height="256"/>
     <apex:image value="/servlet/servlet.FileDownload?file=00P55000000HSTHEA4"  />
    --->


    /servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}

 <apex:image url="/servlet/servlet.FileDownload?file={!MySignURL}" />

  <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 <apex:image value="{!URLFOR($Action.Attachment.Download, $CurrentPage.parameters.fileId )}" />
    
    
     
     
    </apex:form>
    </apex:page>
Here is the screenshot of the PDF that got attached through the code.
User-added image

I tried 3 diffrtent ways to display the image here as shown in the VF code. But none of them worked. 
Can any body find what Iam doing wrong here.
  • January 10, 2016
  • Like
  • 0
I have case-trigger based behavior that will assign a case team member to a case based on a value on a field (exposed and editable by community users). If a contact doesn't exist, the contact is created prior to adding to case team.

This works fine, unless the account owner of the community user is an inactive user. In that scenario, the contact is not created.

I have tried to set the ownerID of the contact on create, but debug is showing me that the failure is still occurring with 
INACTIVE_OWNER_OR_USER, operation performed with inactive user [<Account Owner ID>] as owner of contact: 

My suspicion is that salesforce defaults to account owner ID, but allows on creation a different value (I can verify that the ownerID I set for contact is otherwise used when on an account that is not owned by an inactive user).

Is there something I am missing? Does anyone have suggestions? 
 
My mobile app is pulling in too many numbers and in an the wrong order. Was looking to omit some of the numbers and change their order.

I tried changing the order of the numbers in the Accounts --> Page Layouts --> (edit) area but it does not change the order of the numbers. If I remove the number from the layout it *does* remove it from the Call Button List popup.

Anyone had any success here?  Thanks...

User-added image

Hi everyone ,

I would like to know that can I perform any other encrypting method other than existing one in salesforce as

I have to encrypt and use with other system. The other system is using another method of decypting so I have to make

change accordingly. Can I do that in component meaning I need to perform encrypting before sending email .

I have not use visual force page because I have to use component that attached to email template. 

I cannot find any other way and full blank.

 

Do you have any suggestion regarding this ?

 

Thank you so much ..

Hello my current code shows this.

User-added image

While it's nice to have that look.  I need the look of a regular salesforce look inside my tab.
User-added image

What code should I put to make it look like that?  My codes below.

Thanks in advance




<apex:page standardController="Property__c" showHeader="true" sidebar="false">
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #081f3f; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>

    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="Property__c" id="AccountTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="Property Information" name="name1" id="tabOne">content for tab one
         <apex:form>
          <apex:pageBlock id="Property"> 
         <apex:pageBlockTable value="{!Property__c}" var="record" id="Property">
         <apex:column >


                    <apex:outputField value="{!Property__c.Name}" id="PropertyName" />
                    <apex:facet name="header">Name</apex:facet>
                    </apex:column>
                    <apex:column >
                    <apex:outputField value="{!Property__c.Property_Address__c}" id="PropertyAddress" />
                    <apex:facet name="header">Address</apex:facet>
                    </apex:column>
                    <apex:column >
                    <apex:outputField value="{!Property__c.City__c}" id="PropertyCity" />
                    <apex:facet name="header">City</apex:facet>
                    </apex:column>
                    <apex:column >
                    <apex:outputField value="{!Property__c.State__c}" id="PropertyState" />
                    <apex:facet name="header">State</apex:facet>
                    </apex:column>
                    <apex:column >
                    <apex:outputField value="{!Property__c.Zip_Postal_Code__c}" id="PropertyZip" />
                    <apex:facet name="header">Zip Code</apex:facet>
                    </apex:column>
                      <apex:inlineEditSupport event="ondblClick" 
                        showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
                      </apex:pageBlockTable> 
                 <apex:pageBlockButtons> 
                <apex:commandButton value="Edit" action="{!save}" id="editButton" />
                <apex:commandButton value="Save" action="{!save}" id="saveButton" />
                <apex:commandButton value="Cancel" action="{!cancel}" id="cancelButton" />
            </apex:pageBlockButtons> 
           </apex:pageBlock> 
           </apex:form>
           </apex:tab>
   

        
        
        <apex:tab label="Building Information" name="name2" id="tabTwo">content for tab two</apex:tab>
        <apex:tab label="Financial Information" name="name3" id="tabThree">content for tab two</apex:tab>
        <apex:tab label="Loan Information" name="name4" id="tabFour">content for tab two</apex:tab>
    </apex:tabPanel>
</apex:page>

Merry Christmas!

I am trying to write my first trigger, and am really stuck with the method.  I have three custom objects:  Product__c, BOM__c, and BOM_Items__c

Product is the grandparent, BOM is the parent and BOM Items is the child.

I also have a lookup from BOM Items to Product, so effectively the Product is also the parent of BOM items.  It is a strange, incestous relationship.

When I create a BOM Item, I want to trigger the ID of the Product in the BOM field, so that both BOM Items and BOM mention the Product. (ie trigger from the Product__c lookup field in the BOM__c object TO the Product__c lookup field in the BOM_Item__c field.  This doesn't have to happen for ALL records ALL the time, only for the records as and when they are created.

As a novice, my initial thought on the methodology would be something like this:
trigger ProductName on BOM_Item__c (before insert, before update) {
BOM.Product__c ProductIDBOM;
Product__c ProductIDBOMItem;

for (BOM_Item__c trigger : trigger.new)
{
ProductIDBOM=BOM__c.Product__c;
ProductIDBOMItem=ProductIDBOM;
}
}


However, when I read about triggers on these pages, everyone seems to start with having to build a map of the IDs and then selecting from the map to find the ID etc etc.  I can't work out whether this is because they want to update more than one record at a time, or just because this is best practice.  Please help!!

Ben





From what I can see on the boards, the methodology should be:

1.  Build a map
In battle station i cant preview my battle stations with supplies it just says no preveiw
help me people
Could someone help me understand why this code is not creating the case within Live Agent?


 
<!-- Save the Contact on the Live Chat Transcript's Contact Loookup -->
<!-- <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Contact" value="Contact" /> -->
<!-- Show the Contact when it is found or created -->
<!-- <input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Contact" value="true" /> -->
<!-- Create a Case every time -->
<input type="hidden" name="liveagent.prechat:caseOrigin" value="Chat" />
<input type="hidden" name="liveagent.prechat:caseSubject" id="subject" value="" />
<input type="hidden" name="liveagent.prechat:caseSuppliedName" id="SuppliedName" value="" />
<input type="hidden" name="liveagent.prechat:Status" value="In Progress" />
<input type="hidden" name="liveagent.prechat:caseRecordType" value="Support" />
<input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Origin,caseOrigin;Subject,caseSubject;Status,Status;Domain__c,Domain;SuppliedCompany,Organization;RecordType,caseRecordType;SuppliedEmail,Email;SuppliedName,caseSuppliedName" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Origin,true;Subject,true;Status,true;Domain__c,true;SuppliedCompany,true;SuppliedEmail,true;SuppliedName,true;RecordType,true;" /> <input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="Case" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />
<!-- Link the records to the Case -->
<input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Organization__c" value= "Case,Organization__c" />
<input type="hidden" name="liveagent.prechat.findorcreate.linkToEntity:Account" value= "Case,AccountId" />

Hello,

#I have two objects.
> Standard object (contact) (Master)
> Custom object (cust__c) (Detail)
They both have master detail relationship

#Both of them have Two record types each
> contact has record type "Con1" and "con2"
> cust__c has record type "Cus1" and "Cus2"

#Other info
> the detail page layout is present on the parent object

#Requirement
> I want to make sure that if a new "cust__c" is created on contact with record type "Con1" then mandatorily it should be associated to "Cus1".
> Similaryly, "Con2" should be associated to "Cus2", 
> Both of the association should be mandatory for a user

#Solution required
I am looking for solution where clicking on a custom button on parent object will redirect to new record creation on of child object with prepopulated record type

Thank you for suggestion
Hi 
How to share the records to specified users using Visualforce Pages.Tell me the resonable answer with proper code

Thanks
Galeeb SK
I'm on the second to last unit of the Visualforce Basics module, called Creating & Using Custom Controllers.
I THINK I have followed everything correctly (being new to coding) but I'm getting an error when in the section Add A New Action Method:

line 7: expecting a semi-colon, found "("


The custom controller I am trying to use is as follows and the line in bold is line 7:

public class ContactsListController {
    private String sortOrder = 'LastName';
        public List<Contact> getContacts() {
    public void sortByLastName() {
    this.sortOrder = 'LastName';
}    
public void sortByFirstName() {
    this.sortOrder = 'FirstName';
}   
        List<Contact> results = Database.query(
            'SELECT Id, FirstName, LastName, Title, Email ' +
            'FROM Contact ' +
            'ORDER BY ' + sortOrder + ' ASC ' +
            'LIMIT 10'
        );
        return results;
    }
}


Any ideas on where I have gone wrong?

Thanks
Dan
Hello,

For a report, If i do not click "save level hierarchy", on what basis are the records displyed ?
 
Hello,

Unitl i do not click "Folder sharing option", i do not get the option for "edit dashboard in public folders".
What is reason ?
How can i get this done if i do not want to activate the folder sharing option ?

Thanks
Hello,

I am planning to enable "Enable access levels for sharing report and dashboard folders" in production org.

this check box can be found below in set up

Report and Dashboard Folder Sharing
    Folder Sharing
        Enable access levels for sharing report and dashboard folders 

I followed below link which gives information on this topic.
https://help.salesforce.com/apex/HTViewSolution?id=000193465&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000193465&language=en_US)

I have below questions:
1) What are disadvantages of this step
2) Will it effect the current report data, as in, will the user be able to see more data or less data
3) What are otehr notable effects ?
I have written the test class for my apex class. The test class is not covered inside the aggregate functions. Please help me out !

My apex class:
public with sharing class Rfleet_DashboardcurrentYear{
public decimal Dvol{get;set;}
public decimal dElTarSum{get;set;}
public decimal tArRatioSum{get;set;}
public decimal dElComSum{get;set;}
public decimal cOmRatioSum{get;set;}
public decimal iKamForcastSum{get;set;}
public String mOnthName{get;set;}
public decimal cUrntMonth{get;set;}
public decimal cOunForcastSum{get;set;}
public decimal cOunForCastRatio{get;set;} 
public decimal cUrntYear{get;set;}
public String str{get;set;}
public String s{get;set;}
public String selectedval{get;set;}
public decimal iKamForcastRatio{get;set;} 
public decimal iKamForcastRatioIn;
public decimal cOunForCastRatioIn;
public decimal maxvalue{get;set;} 
public Rfleet_DashboardcurrentYear(ApexPages.StandardController controller) {
//Global deliveries Realized
    List<AggregateResult> tAr=[select SUM(Countries_delivered_volume__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    for (AggregateResult ar : tAr)  {
    Dvol=(decimal)ar.get('expr0');
     }
// Annual global deliveries target   
    AggregateResult[] tArRatio=[select SUM(Target_ratio__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    for (AggregateResult ar : tArRatio)  {
    Decimal tArRatioSumIn=(decimal) ar.get('expr0');
    tArRatioSum=tArRatioSumIn.setScale(0,System.Roundingmode.HALF_UP); 
    }

    AggregateResult[] dElTar=[select SUM(Annual_deliveries_target__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    for (AggregateResult ar : dElTar)  {
    dElTarSum=(decimal) ar.get('expr0');
    //system.debug('<<<<<<<a value'+dElTarSum);
    }
//Annual global deliveries Commitment
    AggregateResult[] cOmRatio=[select SUM(Commitment_Ratio__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    for (AggregateResult ar : cOmRatio)  {
    Decimal cOmRatioSumIn=(decimal) ar.get('expr0');
    //system.debug('<<<<<<<a value'+cOmRatioSumIn);
    if(cOmRatioSumIn!=null)
    cOmRatioSum=cOmRatioSumIn.setScale(0,System.Roundingmode.HALF_UP); 
    }


    AggregateResult[] dElCom=[select SUM(Annual_global_deliveries_commitment__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    for (AggregateResult ar : dElCom)  {
    dElComSum=(decimal) ar.get('expr0');
    //system.debug('<<<<<<<a value'+dElComSum);
    }
//Country Forecast

    AggregateResult[] cOunForcast=[select SUM(Countries_forecast__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    if(cOunForcast.size()>0)
    {
    for (AggregateResult ar : cOunForcast)  {
    cOunForcastSum=(decimal) ar.get('expr0');
    //system.debug('<<<<<<<a value'+cOunForcastSum);
    }
    }

    if(cOunForcastSum!=null)
    {
    cOunForCastRatioIn=(Dvol/cOunForcastSum)*100;
    cOunForCastRatio=cOunForCastRatioIn.setScale(0,System.Roundingmode.HALF_UP); 
    }

//Current year

    AggregateResult[] cUrntYr=[select CALENDAR_YEAR(Current_month__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    for (AggregateResult ar : cUrntYr)  {
    cUrntYear=(Integer) ar.get('expr0');
    //system.debug('<<<<<<<a value'+cUrntYear);
    }
    str=String.valueof(cUrntYear);

//Current month
    AggregateResult[] cUrntMon=[select CALENDAR_MONTH(Current_month__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_MONTH(Current_month__c) order by CALENDAR_MONTH(Current_month__c) desc limit 1];
    for (AggregateResult ar : cUrntMon)  {
    cUrntMonth=(Integer) ar.get('expr0');
    //system.debug('<<<<<<<a value'+cUrntMonth);
    }

If(cUrntMonth==1){mOnthName='January';}
else if(cUrntMonth==2){mOnthName='February';}
else if(cUrntMonth==3){mOnthName='March';}
else if(cUrntMonth==4){mOnthName='April';}
else if(cUrntMonth==5){mOnthName='May';}
else if(cUrntMonth==6){mOnthName='June';}
else if(cUrntMonth==7){mOnthName='July';}
else if(cUrntMonth==8){mOnthName='August';}
else if(cUrntMonth==9){mOnthName='September';}
else if(cUrntMonth==10){mOnthName='October';}
else if(cUrntMonth==11){mOnthName='November';}
else if(cUrntMonth==12){mOnthName='December';}
else{}

    AggregateResult[] iKamForcast=[select SUM(IKAM_forecast__c) from Account where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
    if(iKamForcast.size()>0)
    {
    for (AggregateResult ar : iKamForcast)  {
    iKamForcastSum=(decimal) ar.get('expr0');
   // system.debug('<<<<<<<a value'+iKamForcastSum);
    }
    }
    

    if(iKamForcastSum!=null)
    {
    iKamForcastRatioIn=(Dvol/iKamForcastSum)*100;
    iKamForcastRatio=iKamForcastRatioIn.setScale(0,System.Roundingmode.HALF_UP); 
    }
    
      maxvalue= (dElTarSum>dElComSum&& dElTarSum>cOunForcastSum&& dElTarSum>iKamForcastSum) ? dElTarSum: ((dElComSum>cOunForcastSum && dElComSum>iKamForcastSum) ? dElComSum: ((cOunForcastSum>iKamForcastSum)?cOunForcastSum: iKamForcastSum)) ;  
    }  

 
}

My test class :
@isTest
public class Rfleet_DashboardcurrentYear_Test {    
static testMethod void DashboardcurrentYear(){
test.startTest();
        Id rType =[Select id from RecordType where sObjectType = 'Account' and name='RFLEET-ACC-DCVF-RT'].id;    
        Account acc = new Account(Name='Prabu',Montant__c=5,recordtypeid=rType);
        insert acc;
        system.debug('-------->acc value is ' + acc);
        IKAM_Data__c ikam=new IKAM_Data__c(Annual_deliveries_target__c=45,Annual_global_deliveries_commitment__c=98,IKAM_Year__c=2015,CurrencyIsoCode='INR',Account__c=acc.id);
        insert ikam;
        
        ApexPages.StandardController sc = new ApexPages.standardController(ikam);  
        Rfleet_DashboardcurrentYear accPageCtrl = new Rfleet_DashboardcurrentYear (new ApexPages.StandardController(ikam));     
             
      
        accPageCtrl.Dvol=6.8;   
        accPageCtrl.cOmRatioSum=34.5;
        accPageCtrl.cOunForCastRatio=23.3;
        accPageCtrl.cOunForcastSum=67.8;
        accPageCtrl.cUrntMonth=9.0;
        accPageCtrl.cUrntYear=2015.0;
        accPageCtrl.dElComSum=56.8;
        accPageCtrl.dElTarSum=89;     
        accPageCtrl.iKamForcastRatio=8.7;
        accPageCtrl.iKamForcastSum=56.7;
        accPageCtrl.mOnthName='january';
        accPageCtrl.iKamForcastRatioIn=9.8;
        accPageCtrl.cOunForCastRatioIn=6.7;
        accPageCtrl.tArRatioSum=5.6;
        accPageCtrl.selectedval='hjk';
        accPageCtrl.str='gjg';
        accPageCtrl.s='jh';
        test.stopTest();
}
}

 I have added the screenshot for uncovered lines in my apex class 
User-added image
 

Hi
 if(newvals.severity != oldvals.Serverity){
                    Account acc = new Account();
                         acc.Field__c = 'Severity';
                         acc.New_Value__c= newvals.Severity;
                         acc.Old_Value__c= oldvals.Severity;
                         acc.Id__c = newvals.id;
                         ac.add(acc);

For above code how to write the test class.
Thnks&Regards
rangareddy
 
Hi

I'm trying to extend the Email-To-Case functionality and I'm not sure why it's not working.
The purpose of this is to read two lines from an incoming email and depending on the data from Salesforce, either create a new case or update a case.

I've tried swapping between using EmailMessage and Messaging.InboundEmailHandler but both produce errors and I think it's related to my crappy code. I've just been writing code for 3 days now so I'm very new to APEX/SOQL.

1) I'm pretty sure the RegEx is working since I've tested that in Execute Anonymous Window
2) How can I make this work?
3) In my APEX Class, what should i return when the statements in the code are validated?
4) As it is right now, I don't even know if my code is being triggered. How can I check this?
5) I still need to figure out how to post a message to a user and the Chatter implementation might not be working right now. Is it?

This is my trigger:
trigger op5EmailTrigger on EmailMessage (before insert) {
    op5EmailHandler.getEmailData(Trigger.new);
}

This is my APEX class:
 
global class op5EmailHandler {
    public static void getEmailData(EmailMessage messageList) {
            for(EmailMessage email : messageList) {
            try {
                if(email.fromAddress == 'hidden@for.now') {
                    String emailSubject = email.Subject;
                    String emailBody = email.TextBody;
                    Pattern assetPattern = Pattern.compile('((e)\\: )(.*)');
                    Pattern serialPattern = Pattern.compile('((l)\\: )(.*)');
                    
                    // define separate matchers for asset and serial
                    Matcher assetMatcher = assetPattern.matcher(emailBody);
                    Matcher serialMatcher = serialPattern.matcher(emailBody);
                    
                    if(assetMatcher.find() && serialMatcher.find()) {
                        String asset = assetMatcher.group(3);
                        String serial = serialMatcher.group(3);
                        Asset findAsset = [SELECT Id,AccountId FROM Asset WHERE (Serial_No__c=:serial AND Name=:asset)];
                        
                        String assetAccount = findAsset.AccountId;
                        String assetFound = findAsset.Id;
                        // array, as it may include multiple cases
                        Case[] returnedCases = [SELECT Id,CaseNumber FROM Case WHERE (AssetId=:assetFound AND Origin='Monitoring OP5' AND (Status!='Closed' OR Status!='No fault found') AND Type='Incident')];
                        
                        if(returnedCases.size() == 2) {
                            // create a new case
                            Case newCase = new Case(Subject=emailSubject, AccountId=assetAccount, AssetId=assetFound, Description=emailBody);
                            
                            insert newCase;
                            // post to chatter
                            String multipleCasesExists = 'There is multiple open cases for Asset: ' + assetMatcher.group(1) + ' with S/N: ' + serialMatcher.group(1) + ' and a new case has been created with Case Number: ' + newCase.CaseNumber + '. Please delete the cases that are irrelevant and use one case to track the alerts for this Asset.';
                            ConnectApi.FeedElement sendToChatter = ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), '0F925000000049v', ConnectApi.FeedElementType.FeedItem, multipleCasesExists);
                            
                            
                        } else if(returnedCases.size() == 1) {
                            EmailMessage newEmail = new EmailMessage(FromAddress = email.FromAddress,
                                                                     FromName = email.FromName,
                                                                     ToAddress = email.ToAddress,
                                                                     Subject = email.Subject,
                                                                     TextBody = email.TextBody,
                                                                     HtmlBody = email.HtmlBody,
                                                                     Incoming = true,
                                                                     MessageDate = System.now(),     
                                                                     ParentId = returnedCases[0].Id);
                            
                            insert newEmail;
                            
                            
                            // post to chatter
                            String chatterMessage = 'New email from OP5 have been inserted into case: ' + returnedCases[0].CaseNumber + '. Please investigate if further action is needed.';
                            ConnectApi.FeedElement sendToChatter = ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), '0F925000000049v', ConnectApi.FeedElementType.FeedItem, chatterMessage);
                            
                            // send email to case owner
                            
                            
                        } else {
                            // create new case
                            Case newCase = new Case(Subject=emailSubject, AccountId=assetAccount, AssetId=assetFound, Description=emailBody);
                            
                            insert newCase;
                            // post to chatter
                            String newCaseFromOP5 = 'New case: ' + newCase.CaseNumber + ' for Asset: ' + assetMatcher.group(1) + ' with S/N: ' + serialMatcher.group(1) + ' has been created, please take action asap.';
                            ConnectApi.FeedElement sendToChatter = ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), '0F925000000049v', ConnectApi.FeedElementType.FeedItem, newCaseFromOP5);
                            
                        }
                    }
                }
                return email;
            } catch (Exception e) {
                return email;
            }
        }
    }
}

All I've done is read the error messages produced in the Developer Console. I havn't used the Execute Anonymous Window since I don't know how to with a Email.

Many many thanks in advance!

 
I have a user that owns an Opportunity record, and when he goes to create a New Task on the Opportunity record, he gets the below error.  I tried to reproduce both under my login and logging in as him, but I cannot reproduce the error.  Any idea why this might be happening?

User-added image
Sound off!  How many badges do you have?  =)

I have an APEX class that is inserting Lead information, *randomly* (yes, I know there is no random) I'm getting back an Id from an existing Lead.  There is only one "before insert" trigger and the only thing that does is query some other objects to populate a custom field with some instructions on what to do next with that lead.

 

Environment - this is running in Sites.

 

Pseudo-code and flow:

 

1.  Instantiate variables via Controller:

public Lead ldNew {get;set;}

ldNew = new Lead();

 

2.  Display and collect on VF Page

<apex:inputField value="{!ldNew.Email}" />

 

3.  Insert Lead object

insert ldNew;

 

4.  Requery Lead for instruction info 

Lead ldRequery = [SELECT ... FROM Lead WHERE Id = ldNew.Id];

 

5.  Send Emails to people, etc...

etc...

 

Right there between Step 3 and 4, sometimes I"m getting back an Id from an EXISTING LEAD instead of the expected new lead.

 

I'm stumped - ideas?  Anyone seen this behavior before?  I didn't think it was possible to return the Id from another Lead within a before insert trigger??!

 

-Andy

Howdy.

 

I'm trying to make a call to an external web service - the WSDL imports correctly, I'm able to actually invoke the port call, and the processing works on the remote side, but I get a Callout Exception thrown on the response envelope:

 

System.CalloutException: Web service callout failed: Failed to get next element
What I've found is that APEX is successfully getting back the entire envelope (APEX Logs) but something must have either got whacked during the WSDL import on the response class, or the web service is returning data in a format that WebServiceCallout.invoke just can't deal with.
Code for response class:
    public class deliveryActivitySinceResponse {
        public WS_CO.deliveryActivity deliveryActivity;
        private String[] deliveryActivity_type_info = new String[]{'deliveryActivity','http://<clientwebsite>.com','deliveryActivity','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://<clientwebsite>.com','false','false'};
        private String[] field_order_type_info = new String[]{'deliveryActivity'};
    }

 

SOAP response envelope:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:deliveryActivitySinceResponse xmlns:ns2="http://<clientname>.com">
<deliveryActivity nextSequence="465x">
<delivery {multiple attributes}>
<delivery {multiple attributes}>
<delivery {multiple attributes}>
<delivery {multiple attributes}>
<delivery {multiple attributes}>
</deliveryActivity>
</soap:Body>
</soap:Envelope>

 

It's definitely getting back - but my guess is that the callout method can't parse that XML right.  I've done countless other integrations like this, and the only thing I can see that's fundamentally different from the previous ones is that element heirarchy one more level deep (ns2 to deliveryActivitySinceResponse to deliveryActivity) - the other ones I've done don't go that one more level deep.
Thoughts?  Thanks in advance!
-Andy

Good evening!

 

Here is my business scenario - let me know if I can provide any more information or if you have another idea for me...

 

  1. Quote is created
  2. User enters Quote information (Line Items, etc)
  3. User presses "Create PDF"
  4. System checks certain business rules (via APEX)
  5. If rule A is in effect, Quote Tempate A is chosen and a PDF is generated / attached to the Quote
  6. If rule B is in effect, Quote Template B is chosen and a PDF is generated / attached to the Quote

Essentially, the situation is that if "A" is in effect, the "Draft" watermarked Quote Template is the ONLY template that can be used.  Conversely, if "B" is in effect, the "Final" un-watermarked Quote Template is the ONLY template that can be used.

 

To the user, they aren't allowed the choice of which template to use.  The system just picks it for them based on the appropriately parsed business logic fork.

 

I have been able to successfully figure out how to get the standard CreatePDF JS-driven button on a new VF page.  The correct template appears, the correct data is merged, however when I enter the "savePDF" JS function and it submits to SF, I get a generic failure message back with no obvious next step:

 

while(1);
{"quotePDFSaveError":"Error saving PDF to quote.  Please try again."}

 

The above error message comes back after submitting a long GET (or POST, tried them both) string to <instance>/_ui/sales/quote/document/QuotePDFServlet?<bunch of variables parsed by JS>

 

So in lies my question to the masses - has anyone done this?  Does anyone have an alternate approach / solution to my customer need?  Does anyone know what this cryptic error message means?

 

-Andy

Hi team,
i am not able to find the quick link botton to add the quick link created in earlier step. Can u please help me on this?

Rgds
Hari

 
I need to update the status of lookup filters, is it feasible to do so through tooling api or jforce api if yes, please let me know how to achieve this?

Thanks in advance!
hi, i am publishing an app on appexchage and had passed my salesforce organisation security and review scan but , but as my app is getting data from my ruby on rails website through rest api, now salesforce reviewers are asking for the my website security scan report also from zap or other security scnanners provided by them and my website is having some security header issues. is it really that much necessary to provide scan result of my website too.
Hi,

We have an issue with the Salesforce1 LookUp ,Currently it shows only one column for account object (Name which can have duplicates) this makes it difficult, for users to select the correct related record if there are multiple records with same names.There is one idea posted on this (https://success.salesforce.com/ideaView?id=08730000000DkMjAAK).
I want to know if there is any workaround for it .(using Coding to customize this functionality?).

Thanks,
Gayathri
See this as a warning for everyone using Metadata type. 
When adding a boolean field to an existing set of lines, this boolean shows as false, but in APEX it does not react as false. Marked the field and unmarked same field solved the issue for me.

Looks like the field is not initiale correct for SOQL queries. It showed correct values.
Be aware
Hi,
The code snippets are incomplete in the trail named "Build an Account Geolocation App". I was unable to complete some tasks.Whenever I preview my application, it gives a the error as shown
in the screenshot. Can you please give me an idea where this problem might be? I would be really grateful.​

User-added image
I am looking to take a date/time field and make it look like an email forward date.
I am looking to create an email template that looks like an email forward. The goal is to create a workflow for a new field 'Last Email Sent Date' inside of the field use a formula to achieve the folliwng.

"Sunday, January 10, 2016 10:59 AM" 

I am getting the following error message

Error: Syntax error. Missing ')'

After reading through the help discussion and help posts, I am assuming this is the correct formula for the inpute field
CASE(
  MONTH( date ),
  1, "January",
  2, "February",
  3, "March",
  4, "April",
  5, "May",
  6, "June",
  7, "July",
  8, "August",
  9, "September",
  10, "October",
  11, "November",
  "December",

CASE(
  MOD( date - DATE( 1900, 1, 8 ), 7 ),
  0, "Monday",
  1, "Tuesday",
  2, "Wednesday",
  3, "Thursday",
  4, "Friday",
  5, "Saturday", 
  "Sunday"
)
 DATEVALUE("EEEEE, MMMMM dd, yyyy hh:mm a")
We are looking to minimize the number of Full licenses we use and my management would like to use forms for data entry and restrict users to chatter plus license only.  What are we losing going that way? 
We are developeing a VF page where we can capture customer signature and attach it to the record.
The code is developed based from  following 2 posts.

http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
http://blog.jeffdouglas.com/2010/07/14/attach-a-pdf-to-a-record-in-salesforce/


It's done it 2 steps.
First we capture the signature and save it to aatchment as png file.
Second in the Visulforce page we refer this image to include in the VF. (The singnature doc Id is passed as URL parmenter )

This is how it's referd in the VF page that is redered as PDF
 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 The fileId is the attachment ID of the signature impage

The problem we have is once this page is attached to the record the image is broken. It's not diplaying image.
If I harcode this tag like below

 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file==00P55000000HHz1"  />
 
 Every thing works fine.
 
 I debugged and verified that the URL parmenter is getting the right value.
 
 I would like your help to fix this issue.
<apex:page standardController="Account" extensions="reconInventoryController"  renderAs="pdf"  >
<apex:form >



<!---
<apex:outputPanel styleClass="panelWrapper" layout="block">
    <apex:pageBlock title="Inventory Updated" >
    </apex:pageBlock>
</apex:outputPanel>
--->

    <apex:pageBlock title="{!theAccount.Name} - Inventory Dated ( {!Today()})">
  

      
         <apex:pageBlockTable value="{!inventories}" var="c">
            
             <apex:column value="{!c.Name}" />   
            <apex:column value="{!c.Pendant_Serial_Number__c}" />
            <apex:column value="{!c.Shelf_Life__c}" />
            <apex:column value="{!c.Ship_Date__c}" />
            <apex:column value="{!c.Phone_Serial_Number__c}" />
           
            <apex:column value="{!c.Data_Retrieval__c}" />
            <apex:column value="{!c.Status__c}" />
            <apex:column value="{!c.Comments__c}" />
           
        
            
        </apex:pageBlockTable>
        
       
        
    </apex:pageBlock>
    {!MySignURL}
    <!--
    <apex:image url="{!MySignURL}" width="256" height="256"/>
     <apex:image value="/servlet/servlet.FileDownload?file=00P55000000HSTHEA4"  />
    --->


    /servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}

 <apex:image url="/servlet/servlet.FileDownload?file={!MySignURL}" />

  <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 <apex:image value="{!URLFOR($Action.Attachment.Download, $CurrentPage.parameters.fileId )}" />
    
    
     
     
    </apex:form>
    </apex:page>
Here is the screenshot of the PDF that got attached through the code.
User-added image

I tried 3 diffrtent ways to display the image here as shown in the VF code. But none of them worked. 
Can any body find what Iam doing wrong here.
  • January 10, 2016
  • Like
  • 0
I'm trying to track the users geo location, the release notes (summer 15) does not provide sufficient information.
What are the steps or how do I configure Login Geo to obtain the users geo location and draw the map
Is there a way to increase the Entitlement Process limit? i've tried going through salesforce support but it just keeps sending me here saying

"Developer support for standard customers and partners is supported directly through our community. If you have a developer support question, please click here"

And won't let me fill out a case to submit.

If anyone has any idea's I would greatly appriciate it.

Many thanks,
Adam Hayden
What are differences b/w custome sales process and standard sales process.
Hi,
I implemented SF to SF integration using WSDL and Partner WSDL. And it's working as expected. 
Task record created in Org1is getting integrated with Org2.
What my requirement:

1. The attachments of Tasks should also be synched to another Org2.
2. Lookup fields should also be synched with Org2

Please help me on this?

Thanks in advance
Hi All,

What are the different ways for Lightning component deployment ?

Appreciate you help.
Hi,

I am query Opportunity for Last 90 days. I would like to show the each table for weekly opportunity record in this 90days opportunity. So how to i have split the weekly record for sperate from last 90 days record. For example below like this

First Table: 2-12-2015 to 9-12-2015
Name Createddate Amount

Second Table: 10-12-2015 to 17-12-2015
Name Createddate Amount

This is again repeated for Last 90days Record. If anyone know reply to me how to achieve this.
We have a custom button on detail page. On click of the button, we create a task and we want the user to receive email notification regarding the same. I tried using dml header option but it doesn't work. 

//sample code 
var task = new sforce.SObject("Task"); 
----
----
sforce.connection.emailHeader =  { triggerUserEmail : true};
result = sforce.connection.create([task]);

 
I have implemented some logic to reconnect sandboxes through s2s connection after sandbox refresh and use self callouts for that, but apparently something has been changed in Salesforce recently which breaks my functionality.

Looks like now each time when I do callout from Salesforce, it changes IP address each time when callout is made. I believe before it was working fine.
I mean there was one IP address for several transaction and several callouts which made me possible to write some "Browser" class. I was able to identify salesforce IP Address in the list of Login History of my user and it was exposed, and I was able to add it to the Network Access whitelist.
Now it just says "Salesforce.com IP" but doesn't expose that IP.
When I try external tools to detect Salesforce IP it appears to be different at each HTTPCallout (not only each transaction) and these IP addresses

 90.66.44.51,
 47.88.200.216,
 88.136.180.127,
 166.37.94.227,
 102.27.105.71,
 194.38.160.218,
 28.223.203.168,
 104.100.211.38,
 130.97.39.91,
 185.44.248.223,
 253.132.217.3,
 86.55.62.241,
 35.22.219.18,
 90.66.44.51,
 168.89.106.144,
 238.169.209.111 etc

 are out of range of Salesforce IP Addresses documented  here:
https://help.salesforce.com/apex/HTViewSolution?id=000003652


> IPv4 Networks IPv4 IP Address Ranges Date Added       ARIN
>  
> 96.43.144.0/20
> 96.43.144.0 - 96.43.159.254
>  
> 136.146.0.0/15
> 136.146.0.0 - 136.147.255.254
>  
> 204.14.232.0/21
> 204.14.232.0 - 204.14.239.254
>         RIPE
>  
> 85.222.128.0/19
> 85.222.128.0 - 85.222.159.254 April 14, 2015
> 185.79.140.0/22
> 185.79.140.0 - 185.79.143.254
>         APNIC
>  
> 182.50.76.0/22
> 182.50.76.0 - 182.50.79.254
>  
> 202.129.242.0/23
> 202.129.242.0 - 202.129.243.254

Does anyone knows what kind of new feature this is and if is it possible to turn this off or to get the complete list of Salesforce IP addresses to make it able to add to Network Access range?

I tried to add 0.0.0.0-255.255.255.255 but it says IP range too large

=====================================

Update: let me explain what is the problem.
So, when I try to make HTTPCallout from Salesforce to itself to login, it says:

1/4/2016 12:51:05 PM EET    Salesforce.com IP    Application    Failed: Computer activation required    Browser    test.salesforce.com     

and sends me activation code to the email, but even if I use that code and sends another HTTPCallout it would be invalid, since another callout will be made from another IP Address and previous code would be invalid.

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.