• AnshulVerma
  • NEWBIE
  • 49 Points
  • Member since 2008
  • Sr. Manager


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 28
    Replies

I am getting the "too many dml statements" error when I do a bulk update.  I realize that the problem is that I have an insert statement inside a for loop but I am unsure of how to resolve the issue.  How do I get the fields I want to update into a map or list so that I can then update them all at once?  I am confused about the syntax...Here is the portion of my code that is giving me a problem... thanks!!!!!

///Part 2 B update //if health, update the health market if (HealthGo) { for(Account a: accts){ a.Health_Market__c=Market; a.Health_Renewal_Date__c=RenewalDate; a.Health_Underwriter_Assigned__c = Underwriter; update accts; } } else{ } //if dental, update the dental market if (DentalGo) { for(Account a: accts){ a.Dental_Market__c=Market; a.Dental_Renewal_Date__c=RenewalDate; update accts; } }

 

  • February 09, 2010
  • Like
  • 0

Hi, pageblockTable is displayed differently in IE & Firefox & others, specifically some borders are missing in some blank cells.

 

 

Showing correctly:

 

 

How to make it display the border for all cells? i have border="1" in myVF markup.

 

Thanks.

 

  • February 05, 2010
  • Like
  • 0
With so much java.. shouldn't it be rechristened as "jVmForce". checkout my blog for more thoughts on this http://mightycoder.blogspot.com/2010/04/vmforce-or-jvmforce.html

Hi,

 

After a long time I have been finally able to devote sometimes to set my blog up and post article on it. I will be adding more and more information as per my experience continuously. Please mind that whatever I would be writing in my blogs would be purely on my experience and would not be in any case influenced by Salesforce team.

 

Link for my blog is:- http://mightycoder.blogspot.com/2010/02/development-time-in-sfdc-vs-net-and.html

 

Hope you like it and follow it.

 

Thanks,

Anshul Verma 

Hi,

We are developing a  fully customized Force.com application, which uses Visualforce totally.

We want to restrict user to view "search" and "recent Items" options. We have closed all the tabs for the user but if user fiddles with the URL box of browser and enters a wrong url, user comes to a custom visualforce error page (provided by salesforce.com), therein user can view the "recent items" and can also edit them. Moreover, there is a link for advanced search, on clicking it user can search for some objects.

Please provide necessary information.

Regards,
Anshul Verma
Hi,

I faced a random issue today, while testing my application i found that my application was not accessible and recieved an error message "Application not available".

Although, other accounts on the same server (na5) were running successfully.

Can somebody please throw some light on it.

Thanks and Regards,
A.V.
Hi,

There is a feature requirement in our application, that requires file to be uploaded on server just by clicking a button.

Is there any option in Apex/ Visualforce/SControls using which we can upload file automatically. Any technique, wether using Javascript/ AJAX.. would do.. its urgent??

Thanks in Advance.

A.V.

Hi,

There is a feature requirement in our application, that requires file to be uploaded on server just by clicking a button.

Is there any option in Visualforce using which we can upload file automatically. Any technique, wether using Javascript/ AJAX.. would do.. its urgent??

Thanks in Advance.

A.V.
Can Somebody please explain an issue I am facing with Apex properties.

I have a combo box(in visualforce). Following is the code for the combobox:-





In Apex I've given below two sets of code
1) New Properties:- property made according to Apex Script 13.0.
2) Old Properties:- property made according to scripts older than Apex Script 13.0.

###############################################################################
//------------------------- New Properties ----------------------------------
public String CurrencyMaster
{
get { return this.m_currencyMaster; }
set { this.m_currencyMaster=value; }
}
//-----------------------------------------------------------------------------

//------------------------- Old Properties ----------------------------------
public String getCurrencyMaster() { return m_currencyMaster; }

public void setCurrencyMaster(String value) { m_currencyMaster = value; }
//-----------------------------------------------------------------------------
###############################################################################

Now, the problem is that I am successfully getting the value of selected item in case of "Old Properties" but if I use "New Properties", its value doesn't gets set. It gives me a Null value.

Please Explain????

Thanks in Advance.

A.V.
Hi,

I'm developing an application using Visualforce and Apex. We are developing a whole new User Interface and the user would use that itself. How can we restrict users to access only our visualforce pages and nothing else (even if user tried to navigate default Salesforce.com pages by placing the correct path of any other page e.g. home page in the address bar).

E.g. i have a page called messages (visualforce), now i don't want user to access any of the pages available by default from Salesforce (e.g. home page etc.). What i want is that, even if user enters the correct path of home page in the navigation bar, the application should detect it and stop him to do so.

Thanks in advance.

Regards,
A.V.
Hi,

I'm developing an application using Visualforce. We are developing a whole new User Interface and the user would use that itself. How can we restrict users to access only our visualforce pages and nothing else (even if user tried to navigate default Salesforce.com pages by placing the correct path of any other page e.g. home page in the address bar).

E.g. i have a page called messages (visualforce), now i don't want user to access any of the pages available from Salesforce (e.g. home etc.). What i want is even if users enters the correct path of home page in the navigation bar, the application should detect it and stop him to do so.

Thanks in advance.

Regards,
A.V.
Hi,

As I see static variables (in Java, C/C++, C# etc.) static variables are values that remain persistent throughout the application, it can be read/set in all sessions and would access the same variable(the value would persist across the whole application). But, when I was working with the static members of Apex classes I found that their values do not persist and

Please refer the following code

//Static class
Class ABC
{
public static Integer myVal;
static
{
myVal = 0;
System.debug('static constructor is called');
}
}

Visualforce page


All

value = {!val}





Apex Page Controller

Class SampleCon
{
public PageReference test()
{
System.debug('----------------val='+ ABC.myval);
CommonHelper.myval = CommonHelper.myval + 2;
System.debug('----------------val='+ ABC.myval);

CommonHelper.myval = CommonHelper.myval + 2;
System.debug('----------------val='+ ABC.myval);

CommonHelper.myval = CommonHelper.myval + 2;
System.debug('----------------val='+ ABC.myval);
return null;
}
}


Now, what happens is that each time test is initiated ABC.myval comes as zero. As far as my experience with other technologies (.NET, Java etc.), i think that statics should persist their values.

Please suggest if there is something that i'm missing.

Thanks in advance,
Anshul Verma
Hi,

In my application(apex) i want:-

1)Certain values to be accessible to whole organization. Like an array of all countries and states etc. that would be used by all the users.

2) Certain values to be accessible in entire user's session. i.e. once set for one user session would be accessible to all classes when called from the same session. e.g. if I place user's company id in session/cache then it should be accessible across multiple pages(wherever user navigates). something like we do with Cache/Sessions in .NET/Java.

Please reply how to achieve the above mentioned features.

Thanks in advance,
A.V.
Hi,

I want to search certain objects based on the ID's that have been stored in a string (coma separated), as we do in SQL

SELECT <fields> FROM <Table_name> WHERE ID IN ( <Comma seperated ID's> ).

I have tried to do the same in SOQL but didn't succeed in doing so. Although, when i execute the SOQL query in SOQL Explorer it runs fine and returns correct data back.

-> Secondly, while searching for probable solutions, I found the concept of Polymorphic keys in Salesforce. But, I was not able to find much data on that. Can somebody please give more information on that.

Any help would be apreciated.

Thanks,
AV
Are deterministic formula fields auto indexed by salesforce platform?
We have a requirement where we need to connect to salesforce from an intranet website with code written in JavaScript. We have the ConnectedApp created in Salesforce and we are following Username-Password OAuth2 flow. We are passing all the required parameters given below. We are POSTing this to the request URL given below.

var requestUrl = 'https://login.salesforce.com/services/oauth2/token';
requestUrl += '?username=USERNAME&password=PASSWORD_SECURITY_TOKEN&grant_type=password&client_id=CLIENT_ID_FROM_CONNECTED_APP&client_secret=AGAIN_FROM_CONNECTED_APP;
We tried connecting using JQuery AJAX call and JSforce libraries. We have also whitelisted the required domain in Salesforce via Setup --> Security Controls --> CORS.

We tried connecting to salesforce via the intranet site as well as another salesforce org using the same code. for both of the situations we are getting below error. 

User-added image

In case if image does not load 
 
XMLHttpRequest cannot load https://login.salesforce.com/services/oauth2/token. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://lightningcheck-dev-ed--c.ap2.visual.force.com' is therefore not allowed access.

The origin is there in the Request Header as checked in Browser Console, however, the 'Access-Control-Allow-Origin' parameter is not there in response header from Salesforce.

Am I missing any setting here or it is not something Salesforce currently supports? Any help appreciated, thanks.
 
How would I go about making two separate lists of items in my scope in a batch that return different records based on criteria? I want to send out separate emails to each list.
Hi Trailheaders!  Has anyone completed the Challenge for the "Automated Time-Based Actions with Workflow" section.

I am getting this reason: The 'Set Case to Escalated' Workflow field update action was not found

It states in the Challenge: NOTE: Since Workflow rules only fire on record save, normally you would implement this with a time-triggered workflow action...so I created it as a Time-Based action.

User-added image

Has anyone completed this Challenge successfully?



 

Hi All,

 

When we can use permission set ?Give Examples 

 

 

Thanks,

 

Vicky

Hi,

 

How can i get details of related to ie the WhatId of Task Object in SOQL.

CustomObject has a field as Name

Example : Task t1 is related to CustomObject

SOQLQuery could be [SELECT id,whatid from Task];

This will result me in taskid and the customObject record id but what if i need that complete record of customObject.

 

 

 

Appriciate any inputs on this in advance
Thanks.

Hi,

 

I have create Force.com Sites login and enabled it for our Customer Portal Users and it is working fine. We created the Site Login page using the standard page provides by Salesforce and customized css and designs for the page keeping the core functions and code of the page intact.

 

We provide the link to the login page to our users or redirected them to the login page when they clicked on the links in our website.

 

Now we have a requirement where we want the login available in the same page instead of a link. (meaning no redirects to the existing login page) For example like the Facebook login page. So when the user go to our website

http://ourwebsite.com/customerportal, they will have the login, forgotpassword and new user registration options there. So they can enter their username and password there and then go to the portalHome page.

 

The existing loginpage (visualforce and apexcontroller) still works fine. Need to move the login to our website which is using ASP .Net and C#.

 

Can this by achieved? What is the best way to get this done?

 

Thanks

KD

  • September 08, 2011
  • Like
  • 0

Hi,

Am unable to refresh any of the resources in the IDE from the server.

When am trying to refresh a page from the web, getting an Exception saying:

 

 

Unable to refresh resource 'MileaeExension.cls':
com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Unable to refresh resource 'MileaeExension.cls':


com.salesforce.ide.api.metadata.types.Metadata$JaxbAccessorF_fullName cannot be cast to com.sun.xml.bind.v2.runtime.reflect.Accessor

 

Please assist to rectify the issue. 

 

Thanks in advance,

VNath

I'm curious what is the best way to host images for CMS type sites. Let's say I have a custom object called Building. It has some fields such as Height, Number of Floors, Year Built, etc. I'd also like to attach an image of the building to the record. Then I have a custom visualforce component that pulls all this data and image into a nice clean output.

 

There appears to be no good way to handle the images. RTF are not an option as the output is impossible to work with. Attaching as documents is like building something with toothpicks and bubble gum as it requires exact naming of the documents so they can be queried properly.

 

There used to be an idea for an image field type that would address this issue perfectly. Upload a single image to a field and then when outputting this field you would get a simple <img> tag. Ideally there would also be something like this: http://sites.force.com/ideaexchange/ideaView?c=09a30000000D9xt&id=08730000000BrdBAAS

Hi,

 

Here I am doing some crazy stuff. I get givenDateTime from controller and capturing it to a dattime variable using constructor of BatchApex. I want to use this dattime variable in quey. But when I use 'dtGMT' variable in quey i got some conversion errors. so, I converted GMT time(default sFDC object store GMT time) to MST time. then its working fine. But now i thought I did crazy stuff for date.. Do any work around for this without converting from GMT to MST. 

 

Appreciate any suggestions. Following is the sample code I created.

 

 

 

    global BatchMemberList (ID CampId, dateTime givenDateTime)
    {
        CampaignId=CampId;
        dtGMT= givenDateTime;
    }

    global Database.Querylocator start(Database.BatchableContext BC)
    {
      
        //converting GMT to MST and getting individaul values from the datetime

        String dtMST = dtGMT.format('yyyy-MM-dd HH:mm:ss', 'MST');
       
        String Year = String.valueOf(dtMST.substring(0, 4));
       
        String Month = String.valueOf(dtMST.substring(5, 7));  
       
        String Day = String.valueOf(dtMST.substring(8, 10));
       
        String Hours = String.valueOf(dtMST.substring(11, 13));
       
        String Mins = String.valueOf(dtMST.substring(14, 16));
       
        String Secs = String.valueOf(dtMST.substring(17, 19));

        system.debug('dtGMT'+dtGMT);
        //Datetime format
        system.debug('dtPST'+dtMST);

        string stringDateFormat = Year + '-' + Month
                                       + '-' + Day+'T'+Hours + ':'
                                       +Mins + ':' + Secs+'Z';

        system.debug('stringDateFormat'+stringDateFormat);
       
        //Query

        query = ' select  First_Name__c,Last_Name__c,State__c, '+
                '    Zip_Postal_Code__c,Comments__c ' + 
                '  from Member_List_Stage__c '+
                ' where createdDate > '+stringDateFormat+'' ;

I am getting the "too many dml statements" error when I do a bulk update.  I realize that the problem is that I have an insert statement inside a for loop but I am unsure of how to resolve the issue.  How do I get the fields I want to update into a map or list so that I can then update them all at once?  I am confused about the syntax...Here is the portion of my code that is giving me a problem... thanks!!!!!

///Part 2 B update //if health, update the health market if (HealthGo) { for(Account a: accts){ a.Health_Market__c=Market; a.Health_Renewal_Date__c=RenewalDate; a.Health_Underwriter_Assigned__c = Underwriter; update accts; } } else{ } //if dental, update the dental market if (DentalGo) { for(Account a: accts){ a.Dental_Market__c=Market; a.Dental_Renewal_Date__c=RenewalDate; update accts; } }

 

  • February 09, 2010
  • Like
  • 0

Hi all,

 

I have an issue about upload a *csv file to Force.com. My customers want to upload a *csv file to force.com but do not like to use dataloader, I must develop VisualForce page that allows customers can upload file, so anyone can help me this problem??? Please!!!

Hi, pageblockTable is displayed differently in IE & Firefox & others, specifically some borders are missing in some blank cells.

 

 

Showing correctly:

 

 

How to make it display the border for all cells? i have border="1" in myVF markup.

 

Thanks.

 

  • February 05, 2010
  • Like
  • 0
I have a workflow rule with an outbound message action and an email alert. I'm receiving the email but the outbound message doesn't seem to hit my web service (IIS log stopped showing activity).  If I hit the web server, I see the activity but I'm not seeing anything from SalesForce (Jakarta).

Also, there are no entries in the outbound messaging monitor.

How do I verify that messages are being sent?  Is there a log that shows every outbound message and the message body?

I've been pouring over the docs and forums but haven't been able to determine if there's a way to set the http response code on a call to a visualforce page.

 

For example, I'd like to return 500 if I encounter an error in my Apex code and 200 if everything works.

 

 

Thanks,
Can we enable Salesforce Content for Dev Orgs? If so, how?
  • February 24, 2009
  • Like
  • 0