Ask Search:
Birthe OelmannBirthe Oelmann 
Hi,
 
I need the number of specific campaigns a lead is associated with to appear as a number on the lead object.
Other than using the Roll Up helper or the declarative-lookup-rollup-summaries, could this be achieved with a flow?
I need to have 3 different numbers 1 for Campaigns that have Event in their name, one with Webinars and one for Downloads
 
Thank you
 
B
 
Best Answer chosen by Birthe Oelmann
Matt GraderMatt Grader
Hi Birthe.  If you used flows you would not be able to decrease the count if a lead was removed from a campaign.  (you cannot trigger a flow based on record deletion).   You may also hit flow limits over time.    The other option is to write a small apex trigger to calculate these fields.
JP GrandclémentJP Grandclément 
Hi all,

I read a lot of subjects related with my issue and try many different things but still can'tfigure it out. The aim is to automatically attach pdf file when generating it. I'm currently not far from this but I'm starting to loosing myself.
- I created a custom Object Audit__c which contains all the information for the PDF.
- I added a custom button which call a VisualForce page :
<apex:page action="{!saveAttachement}" controller="Audit" renderAs="pdf" applyBodyTag="false" applyHtmlTag="false" showheader="false" standardStylesheets="false">
<body>
        <apex:form >

<!-- Content -->
        </apex:form>
</body>
</apex:page>

this is My method saveAttachment() in my Audit.apxc class 
public with sharing class Audit {
    public void saveAttachement() {                        
        PageReference pdf = Page.VF014_Audit;
        pdf.getParameters().put('Compte_associ__c', parentId);
        Attachment attach = new Attachment();
		Blob body;
         try {

        // returns the output of the page as a PDF
             body = pdf.getContent();
        //system.debug('body should be fine');

        // need to pass unit test -- current bug    
        } catch (VisualforceException e) {            
            system.debug('in the catch block');
             body = Blob.valueOf('Some Text');
        }
        attach.Body = body;
		// add the user entered name
    attach.Name = myAudit.R_f_rence_Audit__c + '.pdf';
    attach.IsPrivate = false;
    // attach the pdf to the account
    attach.parentId = myAudit.Compte_associ__c;
    insert attach;
    //system.debug(attach);
    }        
}


Currently, the attachement is being saved, but can't be opened (PDF failed to open).

By converting it in html file, I could catch the error "Some text" which means I'm not in the try bloc. I assume the reason is the getContent() method is not working and this might probably be because of the PageReference pdf = Page.VF014_Audit being null or something.

Please, can someone help me finding the light ?

I tried a few things now, like with a clone VF page which generated the pdf but didn't success.

I also posted it on developer community :
https://developer.salesforce.com/forums/ForumsMain?id=9060G0000005fTj

Thank you for your help,

JP
Best Answer chosen by JP Grandclément
Amnon KruviAmnon Kruvi
Well, your page VF014_Audit usually receives some sort of parameter in order to know what audit to show. Just like the page we're on now has the part "?id=9063A000000Dvyb" at the end of the URL - this tells the page what question to show.

When you added the following line:
pdf.getParameters().put('Compte_associ__c', parentId);
You are telling the page "Compte_associ__c" is equal to ParentId. Now, the controller class (a class called Audit) is probably expecting some sort of ID to be sent in this manner, and queries the audit record according to the value you put in there. This is all just a guesstimate without being able to see the actual code, though.

Now, I'm guessing that your variable ParentId is either empty, or has the wrong value for what the Audit class is looking for.

I recommend adding a system.debug for ParentId, then use the debug logs to see what value is actually in it. If it isn't empty, then check the Audit class to see what value it expects - because the query it runs is not returning any results.
Rinat BRinat B 
Hi

I have 2 objects:
Account - Parent
Deal - Child

I want to give some of my users permissions to edit spefic fields in the Deal layout, ONLY if the account that the deal is connected to is owned by them., meaning Do not let them edit the Deal fields if you are not the Owner of the account.

sorry for asking this questions many times in the community
Thank you
Rinat
Best Answer chosen by Rinat B
Amnon KruviAmnon Kruvi
Hi Rinat,

It seems like you need to set up a sharing model for the Deal object. May I ask, are you using a Lookup or a Master-Detail relation between Deal and Account?

If you're using a lookup, then all you need to do is go to Sharing Settings in the setup page, and set the org-wide default for the Deal object to "Public Read Only". You could then untick the Grant Using Hierarchies checkbox if you don't want a user's manager to also be able to edit deals.

If you're using a M-D relation, then sharing becomes dependent on the Account object. Basically anyone with write access to the account will have write access to deals.
Sushma RamakrishnanSushma Ramakrishnan 
Hi All,

I have the below Products related list and I want the List price and Sales Price to be different.Please help me to achieve that.Thanks In Advance.
User-added image
Best Answer chosen by Sushma Ramakrishnan
Sushma RamakrishnanSushma Ramakrishnan
Hi Naveen,

I fixed it myself.I kept the List Price and Standard Price Same in Price Books.But dafaulted the Discount , Sales price & Quantity value in my Process Builder.
Ed QuitosEd Quitos 
I have seen and read many of the articles in relation to this but not one of them has proven to fix the issue I am having.

I know there's this article: https://help.salesforce.com/articleView?id=formula_examples_dates.htm&type=5 that shows this formula for adding months to a date:

DATE(
  YEAR( date ) + FLOOR( ( MONTH ( date ) + #months - 1 ) / 12 ),
  MOD( MONTH ( date ) + #months - 1 + 
    IF( DAY ( date ) > CASE( MOD( MONTH( date ) + #months - 1, 12 ) + 1, 
      2, 28,
      4, 30,
      6, 30,
      9, 30, 
      11, 30,
      31 ), 1, 0 ), 12 ) + 1,
    IF( DAY( date ) > CASE( MOD( MONTH( date ) + #months - 1, 12 ) + 1,
      2, 28, 
      4, 30, 
      6, 30, 
      9, 30, 
      11, 30, 
      31 ), 
    1, DAY( date )
  )
)

But this did not factor in the fact that: what if the #months added would have the 'end' date go over the next year? I have that same exact formula in a field and when I enter the ff values:

Date: 5/31/2018
#months: 18 

The end date is 12/1/2019 instead of 11/30/2019.

Can someone help?
Best Answer chosen by Ed Quitos
Amnon KruviAmnon Kruvi
I just got to test it, and you're incredibly right! Seems like it has special behaviour for end-of-month dates, where it keeps the date as the end of the month, which is not documented anywhere.

Let's see if we can work around it:
IF (DAY(ADDMONTHS(CloseDate, Term_Length_Months__c )) <= DAY(CloseDate), ADDMONTHS(CloseDate, Term_Length_Months__c ), DATE(YEAR(ADDMONTHS(CloseDate, Term_Length_Months__c )), MONTH(ADDMONTHS(CloseDate, Term_Length_Months__c )), Day(CloseDate)))

 
JOY PAJEJOY PAJE 
we made a lot of changes in the production eversince going live and thus i am  compelled to sometimes test something in the production instead of using test environment. is there any way to make test environment syncronized with the current setup in production? thanks in advance!
Best Answer chosen by JOY PAJE
Lokesh KumarLokesh Kumar
Hey Joy, Yes it is possible you need to roll-out a new sandbox from production and in the newly created sandbox you will have all the configuration and code changes and it depends what type of sandbox you have available. I would recommend creating a new FULL copy so you will have an exact replica of production including records.

Here is the link from salesforce to create a new sandbox.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_intro_get_dev_account.htm
Jim StricklandJim Strickland 
I have written a process that should only run if the following conditions are met.
1. Invoice Date is blank
2. Paid is false

This is how the condition in question looks.
Field                       Operator         Type          Value
[Invoice_Date__c]    Is Null              Boolean      True

If I am wanting the process to run an email alert only if the Invoice Date is blank, should the Value be true, or false?
Best Answer chosen by Jim Strickland
Steve DoddSteve Dodd
This would be saying the Invoice Date field does not contain a value (Is Blank):
 
[Invoice_Date__c]    |   Is Null   |   Boolean   |   True

 
Caterina TorresCaterina Torres 
I was under the impression it was called Boolean code, but now I'm not so sure.

 
Best Answer chosen by Caterina Torres
Steve DoddSteve Dodd
They're really just functions - similar to the formula functions in Excel. It's not a coding language.

The "code" that is involved in Salesforce development is called Apex, which is a combination of JavaScript and C++
 
Bailey RuddBailey Rudd 
Here is a small piece of my formula I'm trying to build:

AND(
IF(ShippingPostalCode >=90001, "Southern CA",NULL),
IF(ShippingPostalCode<=92327,  "Southern CA", NULL)


But I'm getting a  Incorrect parameter type for operator '>='. Expected Text, received Number. 
Any help would be appreciated, Thank you. 
 
Best Answer chosen by Bailey Rudd
Rajesh Varma MudunuriRajesh Varma Mudunuri
Then remove the Text Function and try like this.
IF(AND(VALUE(ShippingPostalCode) >=90001,VALUE(ShippingPostalCode) <=92327), "Southern CA",Null)

 
Kevin PerryKevin Perry 
The button to add the account team to the opp team in lightning isn't showing up in any of my environments.  Is there any setting i need to turn on before it's available?


http://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/rn_sales_features_core_oppty_teams.htm
Best Answer chosen by Kevin Perry
Coline LudwigColine Ludwig
Hi Kevin, 

The button didn't appear for me until my Account had an Account Team member. Have you confirmed that the Account related to your Opportunity has an Account Team member record? 

Hope this helps!
Coline