• GSBasso
  • NEWBIE
  • 219 Points
  • Member since 2010

  • Chatter
    Feed
  • 8
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 19
    Questions
  • 66
    Replies
IN: Dynamic SQOL, Dynamic Search

Based on Jeff Douglas's article Dynamic Search,

Can anyone please provide suggestions as to how to use 'IN' in a  dynamic SOQL

// runs the search with parameters passed via Javascript
        public PageReference runSearch() {



String billcode = Apexpages.currentPage().getParameters().get('billcode');

List<String> parts = billcode .split('\\,');
}

if (!billcode.equals(''))
          
                soql += ' and bill_Code__c IN '+parts+'';

In the search parameter if i pass billcode as BC23,BC42, this is the SOQL that is generated

select Name, Branch__c, F1__c, F2__c, F3__c from Obj__c Where Branch__c!=null and bill_Code__c IN (BC42,BC93) order by Branch__c asc limit 25   // quotes missing

but the search doesn't return anything. it needs to be IN ('BC42','BC93') // quotes for each passed value.
I am new to Salesforce, so excuse me if I missed he obvious.

We have a Saleforce Site setup which is called ContactDirectory. I received a requirement to split this page to two pages: one for faculty, and another for staff. I tried two approaches trying to avoid the third approach.

My first thought was that I can simply choose Faculty Record Type for Contact object in a profile of the first site, and Staff Record Type for the second site. It turned out I misunderstand the purpose of selecting record types in profile of the site. I am still not clear on it, but it did not work.

My second way was to retrieve URL in a controller and then alternate SOQL query conditioned to this URL. URL which contains faculty will only select records for Faculty Record Type etc. Here I am not sure if it is good idea to build logic around URL. The main reason I am stack with idea is I do not know how to fix test cases that use PageReference to trigger controller. Specifically, I do not know how to set/pass URL when triggering VF page.

The third option would be just to copy everything for the second Site.

What would the best approach here? Should I try to reuse VF page and controller for similar sites?

Thanks.
  • July 26, 2013
  • Like
  • 0

I know this is achieveable through JAvascript / Jquery but don't know how?

 

On this visualfore page I have a table of records with a checkbox next to each record.

 

I want all users to see all records but only be able to select the records the user owns.

i.e/ 

IF(Userinfo.userid() != ownerid)

{

       disable checkbox;

} else {

 

      enable checkbox;

}

So if a user sees 5 records but owns only 3 of those records, Show all 5 records to the user but have the checkboxes for only 3 of the records enabled. Checkboxes on the other two records will be disabled.

 

 

<apex:page controller="MyAccountListCntrlr" tabStyle="Account">
   <apex:form >
      <apex:pageBlock title="Account List">
         <apex:pageBlockButtons >
            <apex:commandButton value="Show Selected Accounts" action="{!displaySelectedAccountNumbers}"/>
         </apex:pageBlockButtons>

         <!-- ACCOUNT LIST -->
         <apex:pageBlockTable value="{!acctList}" var="acctWrapper">
            <apex:column >
               <apex:inputCheckbox value="{!acctWrapper.isSelected}"/>
            </apex:column> 
            <apex:column value="{!acctWrapper.cAccount.AccountNumber}"/>
            <apex:column value="{!acctWrapper.cAccount.Name}"/>
         </apex:pageBlockTable>

         </apex:pageBlock>
   </apex:form>
</apex:page>

 

I have a flow that has a date input field.  I'm calling the flow in a Visualforce page that has a CSS applied.  Because I'm not using standard stylesheets, the date picker format is not available.  Typically I would use java script to mimic the date picker behavior, but I'm not sure ther eis a way to do this in the CSS related to a flowDate.  Has anyone else done this before?

I have a Visualforce page that allows users to view the Master-detail in one UI. The page uses the Master StandardController with an Extension which allows updates/delete to the detail records.

 

Try as I might, I cannot get the "Add new Detail" button to invoke the Edit page for a new detail item (see Apex code excerpt below). Whatever I seem to do, it always invokes the "edit" of the Master record.

 

    // Invoked when user presses "newDetail" button from VF page

    public PageReference newDetail()
    {
        Detail__c newDetail = new Detail__c(Master__c=getMaster().ID);
        PageReference newDetailPage = new ApexPages.StandardController(newDetail).edit();
        newDetailPage.setRedirect(true);
        Return newDetailPage;
    }

 

NB: I am trying to pre-populate the master record's ID -- I want this to work as if the user pressed the "New" button on the standard Salesforce related list page

According to the KB article linked, setting runAllTests to false for production ant deployments will exclude only managed package tests.

 

Is there a way to run unmanaged code tests only for sandbox ant deployments?

 

http://help.salesforce.com/apex/HTViewSolution?id=000003620&language=en_US

Hi Guys, 

 

I am trying to use data loader command line uploading the csv data. 

 

But everytime I got some error message like:

 

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: C:\Users\jeffrey.lai\AppData\Local\Temp\sdl.log (
Access is denied)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java
:207)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:3
07)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.ja
va:295)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurat
or.java:176)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfi
gurator.java:191)
at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOM
Configurator.java:523)
at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.ja
va:436)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:999)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:867)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:773)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionCon
verter.java:483)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:117)
at com.salesforce.dataloader.process.ProcessRunner.<clinit>(ProcessRunne
r.java:82)

 

From http://files.meetup.com/1589707/Force.com%20Certified%20Developer.pdf, I know this file locate in %TEMP%

 

But my %TEMP% envirenment variable is C:\Users\TonyG\AppData\Local\Temp.

 

 

my config file looks like:

 

<beans>

<bean class="com.salesforce.dataloader.process.ProcessRunner" id="BusinessUnits1"
singleton="false">
<property name="name" value="BusinessUnits1" />
<property name="configOverrideMap">
<map>
<entry key="sfdc.debugMessages" value="true"/>
<entry key="sfdc.debugMessagesFile"
value="C:\Users\TonyG\Desktop\v8\1.log"/>
<entry key="sfdc.endpoint" value="https://login.salesforce.com" />
<entry key="sfdc.username" value="XXXX@XXXX.com" />
<entry key="sfdc.password" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
<entry key="process.encryptionKeyFile" value="C:\Users\TonyG\Desktop\v8\key.txt" />
<entry key="sfdc.timeoutSecs" value="600" />
<entry key="sfdc.loadBatchSize" value="200" />
<entry key="sfdc.entity" value="xpl__BusinessUnit__c" />
<entry key="process.operation" value="upsert" />
<entry key="sfdc.externalIdField" value="xpl__ExternalID__c" />
<entry key="process.mappingFile" value="C:\Users\TonyG\Desktop\v8\mapping\BusinessUnits.sdl" />
<entry key="dataAccess.name" value="C:\Users\TonyG\Desktop\v8\split\BusinessUnits1.csv" />
<entry key="dataAccess.type" value="csvRead" />
<entry key="process.outputSuccess" value="C:\Users\TonyG\Desktop\v8\results\BusinessUnits1_success.csv" />
<entry key="process.outputError" value="C:\Users\TonyG\Desktop\v8\results\BusinessUnits1_error.csv" />
<entry key="process.initialLastRunDate" value="2005-12-01T00:00:00.000-0800" />
</map>
</property>
</bean>

</beans>

 

 

The data can be insert into salesforce successfully, but I keep receiving this error message.

 

How can I fix this problem?

  

Thanks in advance.

 

 

As per my recent response to this post, newer versions of Data Loader (certainly v26.0 and newer) can be installed silently (i.e. without the need for user intervention).

The installer for v36.0 has added an additional option to install for just the current user or to install for all users.

Data Loader Setup - Select install type

For a silent install, Is there a way to override the Single User default and install for All users
Anyone able to successfully initialize a Date variable at the start of a Flow either using <apex:param> in a Visualforce page or by passing an interview map when constructing a Flow instance within an Apex controller (as per this page)?

I get an error with either technique. When I use <apex:param> it complains that the types don't match.

The only thing that works is initalizing through the URL itself.

I even tried to initialize using a string date (i.e. yyyy-DD-mm), just like with the URL technique. Specifically,  I made the controller property bound to <apex:param> a String type, and for the interview map I used a string value rather than a Date object. But these made no difference.
Have opened a case with Salesforce on this issue but thought I'd reach out to the dev community to see if anyone has any ideas.

Basically the issue occurs when you render a table with a repeating header as a PDF. On the first page the header will be rendered with extra whitespace above. On subsequent pages the header is fine, though in the sample code below that demonstrates the issue I have a border around the table and the top of the border is missing on all pages save the first.

A similar issue occurs with a repeating footer, though in this case the extra whitespace gets added below the footer. The sample code below does not show this behaviour.

One odd thing I've noticed is that if there is sufficient content before the table on the same page the table renders as expected (both first page and all subsequent pages). This can be observed by including the outputPanel in the sample code below.

<apex:page controller="TestPDFController" standardStylesheets="false" showHeader="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" renderAs="pdf" readOnly="true">
<html>
    <head>
        <style type="text/css">
            @page {
                size: letter portrait;
                margin-top: 1.0in;
                margin-bottom: 1.0in;
                margin-left: 1.0in;
                margin-right: 1.0in;
                counter-increment: page;
                @bottom-right {
                    content: "Page " counter(page)
                }
            }
            body {
                font-family: Arial, sans-serif;
                color: #000;
            }
            .dataTableClass {
                -fs-table-paginate: paginate;
                 border: 1px solid black; 
                 width: 100%;
            }
            .dataTableClass th, .dataTableClass td {
                vertical-align: top;
                text-align: left;
            }
            .dataTableClass .dtColHeader {
                font-size: 9pt;
                font-weight: bold;
            }
            .dataTableClass .dtColData {
                font-size: 9pt;
            }
        </style>
    </head>
  
    <body>
        <apex:outputPanel layout="block" rendered="false">
            <h3>By including these lines the table header...</h3>
            <h3>...renders as expected on all pages</h3>
        </apex:outputPanel>
        <apex:dataTable value="{!accounts}" var="rec" styleClass="dataTableClass" >
            <apex:facet name="header">
                <h3 style="text-align: center;">List of Accounts and Owners</h3>
            </apex:facet>
            <apex:column style="width: 60%;">
                <apex:facet name="header">
                    <apex:outputText value="Account Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Name}" styleClass="dtColData"/>
            </apex:column>
            <apex:column style="width: 40%;">
                <apex:facet name="header">
                    <apex:outputText value="Owner Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Owner.Name}" styleClass="dtColData" />
            </apex:column>
        </apex:dataTable>
    </body>
  
</html>
</apex:page>

public class TestPDFController
{
    public Account[] accounts{get; private set;}

    public TestPDFController()
    {
        init();
    }
  
    private void init()
    {
        this.accounts = [SELECT Id, Name, Owner.Name FROM Account ORDER BY Name LIMIT 100];
    }
}

I have the Send Apex Warning Emails option enabled in our full sandbox.

 

When I perform a certain action I receive a warning message. When another user performs the same action I do not receive a warning message.

 

Is this correct? The documentation for Send Apex Warning Emails suggests that warnings should be generated for any user. Is there some other setting I need to enable, perhaps on the other user record?

 

Thanks.

  • September 17, 2013
  • Like
  • 0

Hi,

 

In the Approve New Position approval process for the sample recruiting application (see link below) I'm wondering about the filter for the 2nd step in the approval process.

 

One of the constraints is to bypass the step if the CEO already approved the new position (in the first step). I've setup the approval process (including the steps) as documented but when I submitted a new position as one of the CEO's direct reports (with a minimum salary of over $150,000) a second approval (by the CEO) is still required and I'm trying to understand why.

 

If "Current User" represents the person who originally submitted the request (in this case a direct report of the CEO) then the 2nd step should have been bypassed (assuming the Manager field has been correctly popluated, which it has)

 

On the other hand, if, at the second step, "Current User" is now the person who approved the request in the first step (in this case the CEO) then the filter on the second step is incorrect.

 

Anyone ever work through the sample approval process for the recruiting application?

 

http://www.salesforce.com/us/developer/docs/fundamentals/Content/adg_workflow_approvals.htm

 

Am using the migration tool to deploy a new profile. The profile is meant to have access to only a single application. However, after deployment, the profile has access to all the standard apps (sales, marketing, etc.), even though the standard apps are not referenced in the metadata file. How can I deploy the new profile such that access to these apps is disabled? Note that the profile is for a Salesforce license (i.e. not a platform license).

 

Have tried adding entries similar to the following to the metadata file but Salesforce complains that the app does not exist (in this case, sales):

 

    <applicationVisibilities>
        <application>Sales</application>
        <default>false</default>
        <visible>false</visible>
    </applicationVisibilities>

 

Even the list-metadata command does not show any of the standard apps.

 

There doesn't seem to be a way to get or, more importantly, set the tab settings for a custom object in a permission set using the ANT Migration Tool (25.0).

 

Am I missing something here or is this just not supported for some reason?

 

Thanks.

I work for a large organization that uses numerous instances, some of which I support and some of which I do not.

 

Often people move around within the company and, as a result, may need access to a different instance.

 

In order to use their company email address as the username in the new instance it is necessary to change their old, now inactive, username. However,  finding out which instance they were using before can be problematic.

 

Ideally one could perform some sort of lookup that would at least provide the org id in which the username exists (ideally more information, such as the system administrator of the instance so they can be contacted to change the username).

 

Does such a facility exist?

 

This ability is available through the web service API but I'm not aware of any way to do it through Apex.

 

One would expect this to be a property of the DMLOptions object but no such property exists to my knowledge.

  • September 08, 2011
  • Like
  • 0

When deploying an existing Home Page Component using the Metadata API 20.0 the custom links ended up in a different order than what appears in the .homePageComponent file.

 

In fact, the order seems to somehow be fixed, as no matter how I arrange the links in the package the links always end up in the same order. And the ordering is not obvious (e.g. it's not alphabetical).

 

  • September 07, 2011
  • Like
  • 0

Consider the simple Visualforce markup below.

 

In IE6 clicking the label does not select the radio button.

 

If you include the same markup in a standard HTML page (e.g. replace apex:page with html and apex:form with body) the radio buttons are selected when clicking the associated label (as expected).

 

 

apex:page >
    <apex:form >
        <fieldset>
            <legend>Type of radiation:</legend>
            <div><label for="radio1"><input type="radio" name="rad" value="1" id="radio1"/>alpha</label></div>
            <div><label for="radio2"><input type="radio" name="rad" value="2" id="radio2" checked="true" />beta</label></div>
            <div><label for="radio3"><input type="radio" name="rad" value="3" id="radio3"/>gamma</label></div>
        </fieldset>
    </apex:form>
</apex:page>

 

 

There must be some way to tell because both the Profile detail page and the enhanced list view indicate whether the profile is custom.

Based on my observations the answer seems to be “no”.

 

The table below shows the result for each combination of component and type.

 

Visualforce Markup

Error Message

<apex:listViews type="Folder" />

common.page.InvalidParameterValueException: Invalid parameter value "Folder" for parameter "type".

<apex:enhancedList  type="Folder" …/>

An internal server error has occurred

<apex:listViews type="Document" />

None (works)

<apex:enhancedList type="Document" …/>

Unsupported type Document encountered.

 

 

When you include the Last Modified By column in a related list the last modified timestamp is also displayed.

 

If I choose to sort the related list by this field what exactly is being sorted? I suspect the User name but the displaying of the timestamp throws some reasonable doubt on the matter.

 

Assuming the User name is the sort key, then in order to sort by Last Modified Date one must include this column as well. Now with both columns displayed the last modified timestamp appears twice. Is there any way to not have the timestamp appear in the Last Modified By column?

 

I'm building a Visualforce page that uses the inputFile component to create an attachment.

 

All works fine. However, the heap size limit prevents me from being able to upload an attachment larger than 3MB, even though Salesforce itself allows attachments of up to 5MB.

 

Any suggestions on how I might overcome this obstacle?

 

Recently I've noticed when retrieving the metadata (through the Force.com Migration Tool) for our Contact page layouts in Prod the following entry:

 

<excludeButtons>RequestUseSfdc</excludeButtons>

 

As near as I can tell this does not correlate to any button listed in the Page Layout Editor.

 

The other odd thing is that this entry is not included when retrieving the same layout(s) from our sandbox instance.

 

Anyone know what this entry is for?

 

I have a reference to the Home Page layout itself in my manifest, but the resulting .profile file does not include the Home Page layout assignment.

 

I'm using the latest 18.0 version.

 

-Gino

When I deploy to our production instance using the Migration Tool it appears that test methods in managed packages are being run.

 

When I deploy to the same instance using the Eclipse plugin test methods in managed packages are not run.

 

I know this because a test method in one of the managed packages is failing. As such, deployments through the Migration Tool also fail.

 

How is this possible, since both ultimately rely on the Metadata Web Services API?

 

Or how can I prevent test methods in managed packages from running when using the Migration Tool?

 

This was observed using v16, v17 and v18 of the Migration Tool.

 

The Eclipse plugin used was v16.

 

-Gino

 

If I retrieve a profile using the Force.com Migration Tool (i.e. Ant) whose name contains certain characters, such as open or close round brackets, the character is url encoded in the resulting .profile filename.

 

For example, a profle name My Profile (Test) would yield the file My Profile %28Test%29.profile.

 

However, the corresponding <members> element in the generated package.xml file still lists the name in its original form (i.e. without the encoding). This means you cannot deploy the retrieved content without first modifying the package.xml file, which seems contrary to the intent.

 

The above was observed with v17.0 of the Migration Tool.

 

-Gino

 

 

Have opened a case with Salesforce on this issue but thought I'd reach out to the dev community to see if anyone has any ideas.

Basically the issue occurs when you render a table with a repeating header as a PDF. On the first page the header will be rendered with extra whitespace above. On subsequent pages the header is fine, though in the sample code below that demonstrates the issue I have a border around the table and the top of the border is missing on all pages save the first.

A similar issue occurs with a repeating footer, though in this case the extra whitespace gets added below the footer. The sample code below does not show this behaviour.

One odd thing I've noticed is that if there is sufficient content before the table on the same page the table renders as expected (both first page and all subsequent pages). This can be observed by including the outputPanel in the sample code below.

<apex:page controller="TestPDFController" standardStylesheets="false" showHeader="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" renderAs="pdf" readOnly="true">
<html>
    <head>
        <style type="text/css">
            @page {
                size: letter portrait;
                margin-top: 1.0in;
                margin-bottom: 1.0in;
                margin-left: 1.0in;
                margin-right: 1.0in;
                counter-increment: page;
                @bottom-right {
                    content: "Page " counter(page)
                }
            }
            body {
                font-family: Arial, sans-serif;
                color: #000;
            }
            .dataTableClass {
                -fs-table-paginate: paginate;
                 border: 1px solid black; 
                 width: 100%;
            }
            .dataTableClass th, .dataTableClass td {
                vertical-align: top;
                text-align: left;
            }
            .dataTableClass .dtColHeader {
                font-size: 9pt;
                font-weight: bold;
            }
            .dataTableClass .dtColData {
                font-size: 9pt;
            }
        </style>
    </head>
  
    <body>
        <apex:outputPanel layout="block" rendered="false">
            <h3>By including these lines the table header...</h3>
            <h3>...renders as expected on all pages</h3>
        </apex:outputPanel>
        <apex:dataTable value="{!accounts}" var="rec" styleClass="dataTableClass" >
            <apex:facet name="header">
                <h3 style="text-align: center;">List of Accounts and Owners</h3>
            </apex:facet>
            <apex:column style="width: 60%;">
                <apex:facet name="header">
                    <apex:outputText value="Account Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Name}" styleClass="dtColData"/>
            </apex:column>
            <apex:column style="width: 40%;">
                <apex:facet name="header">
                    <apex:outputText value="Owner Name" styleClass="dtColHeader" />
                </apex:facet>
                <apex:outputText value="{!rec.Owner.Name}" styleClass="dtColData" />
            </apex:column>
        </apex:dataTable>
    </body>
  
</html>
</apex:page>

public class TestPDFController
{
    public Account[] accounts{get; private set;}

    public TestPDFController()
    {
        init();
    }
  
    private void init()
    {
        this.accounts = [SELECT Id, Name, Owner.Name FROM Account ORDER BY Name LIMIT 100];
    }
}
As per my recent response to this post, newer versions of Data Loader (certainly v26.0 and newer) can be installed silently (i.e. without the need for user intervention).

The installer for v36.0 has added an additional option to install for just the current user or to install for all users.

Data Loader Setup - Select install type

For a silent install, Is there a way to override the Single User default and install for All users
Anyone able to successfully initialize a Date variable at the start of a Flow either using <apex:param> in a Visualforce page or by passing an interview map when constructing a Flow instance within an Apex controller (as per this page)?

I get an error with either technique. When I use <apex:param> it complains that the types don't match.

The only thing that works is initalizing through the URL itself.

I even tried to initialize using a string date (i.e. yyyy-DD-mm), just like with the URL technique. Specifically,  I made the controller property bound to <apex:param> a String type, and for the interview map I used a string value rather than a Date object. But these made no difference.
Hello Everyone,

Can we call a @invocableMethod(which is a part of managed package) from Processbuilder.
As I didnot find any detail about this in Processbuilder documents.

I am actually planning to have an invocableMethod in my managed packaged but not sure wether it can be called from outside the package from ProcessBuilder?

Thanks in Advance
We use IBM WebSphere Cast Iron to integrate between our internal databases and Salesforce.com. Where can I obtain the Salesforce.com IP addresses that should be whitelisted by our company for integrations connectivity and processing? This would include processing regarding Accounts, Assets, Contacts, Opportunities, and Quotes. Thanks, Miki.

Good Morning:

I have the following piece of code that I am having some issues with.

What I am trying to do is to pull all Billing_Account__c records where Billing_Account__c.Zip_Code__c = MTU_Location__c.Zip_Code__c and Billing_Account__c.Address_1__c CONTAINS MTU_Location__c.Street_Address__c. After doing so, I want to update Billing_Account__c.MTU_Location__c with MTU_Location__c.ID.

The query should return multiple records to update, which it does, but that is causing my trigger to erorr out - I am getting the SOQL returned multiple rows for assignment error.

How to I re-write this so that it pulls multiple records but allows me to update multiple records?

Thanks,

Matt

for(MTU_Location__c mtuRecord : addMTUList){
            Billing_Account__c mtuUpdate = [Select ID, Address_1__c, Zip_Code__c, MTU_Location__c from Billing_Account__c where Zip_Code__c = :mtuRecord.Zip_Code__c];
                if(mtuUpdate.Address_1__c.CONTAINS(mtuRecord.Street_Address__c)){
                    mtuUpdate.MTU_Location__c = mtuRecord.ID;}


           
            updateBillingAccountList.add(mtuUpdate);
           
        }
        update updateBillingAccountList;
Hi All,

I am creating standard user with following values .

User:{Generate_new_password__c=true, Phone=34543432, TimeZoneSidKey=Europe/London, UserPermissionsSFContentUser=true, LanguageLocaleKey=en_US, UserPreferencesContentEmailAsAndWhen=true, ProfileId=00eb0000000ct9oAAA, LocaleSidKey=en_GB, LastName=Saravanan, UserPreferencesContentNoEmail=true, EmailEncodingKey=ISO-8859-1, Email=ssaravananbtech@gmail.com, Alias=TeS, Username=ssaravananbtech@gmail.com, FirstName=Selvaraj, MobilePhone=898888665}

For insert i am using below code

                        Database.DMLOptions dmlo = new Database.DMLOptions();
                        dmlo.EmailHeader.triggerUserEmail = true;
                        Database.SaveResult results = database.insert(CreateUser,dmlo);

This code is sending the email to set the password for new user in one org(Sandbox) but not in other org(production). I have checked the below settings in both the org.

1.CRM Content is- Enabled (Because i am using some content related fields)
2. Email deliverability- All email
3. Checked the Test deliverability - receiving email from all IP address.

Is there any thing I need to check apart from these setting.

Thanks in advance!!
Hi,

I have executes test class successfully in sandbox several times. After I do code coverage shows 95%. When I attempt to deploy to production I get error:

Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

I see many threads on this and have tried many things...At first I put all logic in class and merely called class from trigger. Now I moved all logic into trigger. Still test fine in sandbox but not in production.
Here is trigger and test class.

Thanks,

Jon

@isTest
private class USDTestClass {
       static testMethod void validate() {

   
  
        contact[] contacts = new contact[] {
        new contact(LastName='Sand1',FirstName='Debbie'),
        new contact(LastName='Sand2',FirstName='Carla'),
        new contact(LastName='Sand3',FirstName='Bob'),
        new contact(LastName='Sand4',FirstName='Jon'),
        new contact(LastName='Sand5',FirstName='Bill')
        };
      
        insert contacts;


    USD_Eform__c[] eforms = new USD_Eform__c[] {
        new USD_Eform__c(Contact__c=contacts[0].id,Eform_Type__c='Freshman Questionnaire',name='no name'),
        new USD_Eform__c(Contact__c=contacts[1].id,Eform_Type__c='Freshman Questionnaire',Majr_area_of_interest1__c='xxxEngineering', Majr_area_of_interest2__c='Soccer',Pre_Professional_prog__c='Pre-Med', name='one'),
        new USD_Eform__c(Contact__c=contacts[2].id,Eform_Type__c='Freshman Questionnaire',Majr_area_of_interest1__c='Junk Science',Majr_area_of_interest2__c='abcEngineering',Pre_Professional_prog__c='Pre-Dental', name='two'),
        new USD_Eform__c(Contact__c=contacts[3].id,Eform_Type__c='Freshman Questionnaire',Majr_area_of_interest1__c='Junk Science',Majr_area_of_interest2__c='fff jjjj',Pre_Professional_prog__c='Pre-Health',name='three'),
        new USD_Eform__c(Contact__c=contacts[4].id,Eform_Type__c='Freshman Questionnaire',Majr_area_of_interest1__c='abc Engineering Mechanical',Majr_area_of_interest2__c='aaa Engineering',Pre_Professional_prog__c='Pre-Health', name='four honor')
        };
      
        insert  eforms;
      
         
       List<USD_Eform__c> eFormList = [select id, Eform_Type__c, name,  Majr_area_of_interest1__c, Majr_area_of_interest2__c, Pre_Professional_prog__c,  Assignee__c
                                       from USD_Eform__c];
         

      for(USD_Eform__c e: eFormList) {
    
      if(e.name == 'one'){
         System.assertEquals('Rick Olson', e.Assignee__c);
      }
      if(e.name == 'two'){
         System.assertEquals('Rick Olson', e.Assignee__c);
      }
      if(e.name == 'three'){
         System.assertEquals('Casandra Gomez', e.Assignee__c);
      }
      if(e.name == 'four'){
         System.assertEquals('Jim Gump', e.Assignee__c);
      }        
        
      System.debug('Final>>'+e.Assignee__c);  
      }

      
 


//      System.assertEquals(90, b.Price__c);
    }
}

trigger USD_Eform_BI on USD_Eform__c (before insert) {


// USD_Eform__c[] eform = Trigger.new;


   for (USD_Eform__c e: Trigger.new) {
     //USD_Eform_BI.setAssignee(eform);
   
     Integer honorsResult = 0, areaOfInterestResult1 = 0, areaOfInterestResult2= 0,preHealthResult= 0 ;
     string nameValue ,areaOfInterst1Value,areaOfInterst2Value,preHealthValue ;

if(e.Eform_Type__c.equals('Freshman Questionnaire')) {

   nameValue = e.name.toUpperCase();
   
   try{
      areaOfInterst1Value = e.Majr_area_of_interest1__c.toUpperCase();
   }catch(NullPointerException ne){
 
   }

   try{
      areaOfInterst2Value = e.Majr_area_of_interest2__c.toUpperCase();
   }catch(NullPointerException ne){

   }
   try{
      preHealthValue = e.Pre_Professional_prog__c.toUpperCase();
   }catch(NullPointerException ne){

   }
 
   try{
      honorsResult = nameValue.indexOf('HONOR',0);
   }catch(NullPointerException ne){
      honorsResult = -1;
  }

   try{
      areaOfInterestResult1 = areaOfInterst1Value.indexOf('ENGINEERING');

   }catch(NullPointerException ne){
      areaOfInterestResult1  = -1;
   }
 
   try{
      areaOfInterestResult2 = areaOfInterst2Value.indexOf('ENGINEERING');

   }catch(NullPointerException ne){
      areaOfInterestResult2  = -1;
   }

   try{
      preHealthResult = preHealthValue.indexOf('PRE-HEALTH',0);  
   }catch(NullPointerException ne){
      preHealthResult  = -1;
   }

   if(honorsResult>=0) {
      //Honors
      e.Assignee__c = 'Jim Gump';    
   }else
    if(areaOfInterestResult1 >=0 || areaOfInterestResult2 >=0) {
      //Engineering
      e.Assignee__c = 'Rick Olson';   
   }else
    if(preHealthResult >=0) {
     //Pre-Health
      e.Assignee__c = 'Casandra Gomez';  
   }else {
      e.Assignee__c = null;
   }
 
 
   honorsResult = -1;
   areaOfInterestResult1 = -1;
   areaOfInterestResult2 = -1;
   preHealthResult = -1;

  }


   }   

 
}
IN: Dynamic SQOL, Dynamic Search

Based on Jeff Douglas's article Dynamic Search,

Can anyone please provide suggestions as to how to use 'IN' in a  dynamic SOQL

// runs the search with parameters passed via Javascript
        public PageReference runSearch() {



String billcode = Apexpages.currentPage().getParameters().get('billcode');

List<String> parts = billcode .split('\\,');
}

if (!billcode.equals(''))
          
                soql += ' and bill_Code__c IN '+parts+'';

In the search parameter if i pass billcode as BC23,BC42, this is the SOQL that is generated

select Name, Branch__c, F1__c, F2__c, F3__c from Obj__c Where Branch__c!=null and bill_Code__c IN (BC42,BC93) order by Branch__c asc limit 25   // quotes missing

but the search doesn't return anything. it needs to be IN ('BC42','BC93') // quotes for each passed value.

Hi,

I need to know if Apex Sharing overrides Sharing Rules/Organization Wide Defaults/Role Hierarchy?  My orginization has Apex Sharing that we are trying to remove all together but there are still some triggers/class that are active.  We have set up Sharing Rules/Organization Wide Defaults/Role Hierarchy and it is working for all objects (standard and custom) except 2 objects.  It's like the system is not recognizing the private on Organization Wide Defaults for the 2 new objects.  If anyone can help, that would be great.
 

Thanks!

  • April 02, 2014
  • Like
  • 0

I am working with my IT department to get the Apex Data Loader packaged so that it can be installed silently on (pushed out to) a user's computer. They are having issues getting this to work and asked me to post the question here:

"While trying to create a silent install for Apex Data Loader 28.0 and deploy it via SCCM 2007, we are having issues. I would like to know if there are any silent install parameters that can be used with the .exe. Can Data Loader 28.0 be deployed silently?"

 

Please let me know. This is all the info I have at this time.

Thanks,

Cindy

I have the Send Apex Warning Emails option enabled in our full sandbox.

 

When I perform a certain action I receive a warning message. When another user performs the same action I do not receive a warning message.

 

Is this correct? The documentation for Send Apex Warning Emails suggests that warnings should be generated for any user. Is there some other setting I need to enable, perhaps on the other user record?

 

Thanks.

  • September 17, 2013
  • Like
  • 0

I am trying to change the background color of a visual force page. The code I have is not working.  Please help! How do I fix this?

 

<apex:page standardcontroller="Feature_Request_Form__c" >
<style>
body
{
   background-color: blue; }
   </style>
<apex:form >
<div>To complete the request, click on <b>Submit for Approval</b> button located on the <b>Approval History</b> section of this page.</div>
</apex:form>
</apex:page>
                       

i am trying to set value of custom url field to a visualforce page to for that i need domain oring prefix like ap1.salesforce.com or na1.salesforce.com .how to get that in UI it is showing some global objects $Organization,$Profile,$System,$User,$UserRole which object should be used and which field please tell

I have a reference to the Home Page layout itself in my manifest, but the resulting .profile file does not include the Home Page layout assignment.

 

I'm using the latest 18.0 version.

 

-Gino