• Abhinav Gupta
  • SMARTIE
  • 515 Points
  • Member since 2010
  • Salesforce Architect & Founder
  • Concretio


Badges

  • Chatter
    Feed
  • 19
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 28
    Questions
  • 186
    Replies
Hai friends,
i want to display all objects with its keyprefix values for this i done like this

in controller class:
public class GettingObjectsAndKeyPrifix {
    public List<Schema.SObjectType> gd {get;set;}
    public List<String> objectMap {get;set;}

     Public GettingObjectsAndKeyPrifix(){
        gd= Schema.getGlobalDescribe().Values();
        objectMap = new List<String>();
        for(Schema.SObjectType f : gd)
        {
            objectMap.add(f.getDescribe().getKeyPrefix());
        }
        System.debug('--------- --'+gd);
        System.debug('+++++++++ --'+objectMap.size() );
    }
}

in visual force page:
<apex:page controller="GettingObjectsAndKeyPrifix">
    <!--http://srinivas4sfdc.blogspot.in/2013/12/list-of-salesforce-object-key-prefixes.html-->
   <apex:pageBlock >
   <apex:pageBlockSection >
        <apex:pageBlockTable value="{!objectMap}" var="o">
        <apex:column value="{!o}"></apex:column>
        </apex:pageBlockTable>  
      <apex:pageBlockTable value="{!gd}" var="g">
    <apex:column value="{!g}"></apex:column>
    </apex:pageBlockTable>
  
    </apex:pageBlockSection>
   
     </apex:pageBlock>
   
</apex:page>

here output is comming ,but i want output like

account--001
Note-002
like this how can i please help.

i want ouput like this in url
http://srinivas4sfdc.blogspot.in/2013/12/list-of-salesforce-object-key-prefixes.html
How to learn Salesforce1 easily ?

please help me.......
Hi,

I have developed a Scheuled Apex Class for Chatter Feed Post.
Here, The sample code
for(integer i=0;i<cbday.size();i++){
         
         feeditem FI1=new feeditem();
         FI1.parentid=PId[0].id;
         FI1.createdbyid=u.id;
         FI1.Body = 'Happy BirthDay - '+cbday[i].Name+'.';
         FIbday.add(FI1);
         }
         insert FIbday;

Can anyone help me out  to increase the test coverage on this feed item.

Thanks & Regards,
Karthikeyan Chandran.
Hi,

 

 I want to ask one very basic question here - suppose my code is like this:

 

Set<Id> stAcctId = new Set<Id>();
for Account a : trigger.new)
{
   if (a.OwnerId != trigger.oldMap.get(a.id).OwnerId)
      {
         stAcctId.add(a.Id);
      }
}

List<Contact> lstContacts = [SELECT Id, Ownership_Changed__c FROM Contact WHERE AccountId IN :stAcctId AND Contact_Type__c = 'New User'];

 

Even if my collection stAcctId is empty, will the SOQL fire? If yes, will it be counted in the total number of SOQL queries?

Is checking before firing the query whether or not the collection is empty a good practise?

 

Thanks.

Hi,

 

I am currently in the process of building a custom ui which allows for mass edit of records from a resultset.

 

I currently have the edit form wrapped in a DataTable and all fields are hard-coded.

 

My question is: Is there a way to setup a way to allow users to select which fields they will be editting?

 

I am not sure if DataTable is the correct approach to this. Everything is working in terms of hard code, but I wanted to know if there is something more dynamic.

 

Ideal situation: User gets a selection criteria (like the old report editting pages were setup, checkbox per field to display) then click next to get to the edit form containing only the fields they selected.

 

 

Thanks,

  • January 30, 2012
  • Like
  • 0

Hello,

I get the following error during plugin installation. I have ensured Eclipse is not under program files. I tried runninf eclispe as administrator.

Can someone tell me exactly what and how does one configure on windows 7 UAC to ensure this problem goes.

away?

 

I did try to add my login user to administrator group. I also gave all authenticated users modify permissions in eclipse folder

 

regards
Sameer

 

cannot complete the install because of a conflicting dependency.
  Software being installed: Force.com IDE 23.0.2.201201091635 (com.salesforce.ide.feature.feature.group 23.0.2.201201091635)
  Software currently installed: Eclipse IDE for Java Developers 1.4.0.20110615-0550 (epp.package.java 1.4.0.20110615-0550)
  Only one of the following can be installed at once:
    International Components for Unicode for Java (ICU4J) 4.4.2.v20110208 (com.ibm.icu 4.4.2.v20110208)
    International Components for Unicode for Java (ICU4J) 4.0.1.v20090822 (com.ibm.icu 4.0.1.v20090822)
  Only one of the following can be installed at once:
    Structured Source Editor 1.1.102.v200910200227 (org.eclipse.wst.sse.ui 1.1.102.v200910200227)
    Structured Source Editor 1.3.0.v201105101529 (org.eclipse.wst.sse.ui 1.3.0.v201105101529)
  Cannot satisfy dependency:
    From: Force.com IDE 23.0.2.201201091635 (com.salesforce.ide.feature.feature.group 23.0.2.201201091635)
    To: org.eclipse.wst.html.ui [1.0.0,2.0.0)
  Cannot satisfy dependency:
    From: Eclipse IDE for Java Developers 1.4.0.20110615-0550 (epp.package.java 1.4.0.20110615-0550)
    To: org.eclipse.epp.package.java.feature.feature.group [1.4.0.20110615-0550]
  Cannot satisfy dependency:
    From: EPP Java Package 1.4.0.20110615-0550 (org.eclipse.epp.package.java.feature.feature.group 1.4.0.20110615-0550)
    To: org.eclipse.rcp.feature.group 3.7.0

Hi,

 

I am working in integration area and new to salesforce system integration. I am trying to establish a connection with salesforce system using webMethods Integration Tool (via SalesForce Adapter) and getting the below error.

 

Could anyone please help me on what to do to fix this problem?

 

Error message: 

 

; nested exception is:
org.xml.sax.SAXException: Invalid element in com.sforce.soap.partner.GetUserInfoResult - orgAttachmentFileSizeLimit

 

Regards

Satish

I just started to use JavaScript remoting. It seems the function called from JavaScript remoting should be global in a managed package.

Oh no, that is a bummer. I do not like to make any Apex class or function global unless it is extremely necessary. Once it is global I cannot change the name of the controller and the global function.  

 

Thanks,

Dipu

  • January 13, 2012
  • Like
  • 0

when a new record is created in the contacts object a trigger will fire to invoke the CreatePhantom class

 

trigger and class code is as follows.

but i am facing this error

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<Contact> at line 10 column 27

 

trigger CreateAffiliation1 on Contact (after Insert, after Update) {

createPhantom pnt1 = new createPhantom();
for(Contact con : Trigger.new){
if(con.RecordTypeId == '012U00000009ALt'){
Pnt1.Phantom();
}
}
}

 

 

public class createphantom
{
contact cn = new contact();
List<contact> cnt =[select Name, ReportsToId, AccountId from Contact];

phantom__c pnt = new phantom__c();
public void phantom()
{
pnt.Name = 'patient';
pnt.External_Key__c = cnt.Id;
pnt.Last_Name__c = cnt.Name;
pnt.Reports_To__c = cnt.ReportsToId;
pnt.Account_Name__c = cnt.AccountId;

//Insert pnt;
Database.UpsertResult rslt = Database.Upsert(pnt,Phantom__c.External_key__c);
}


}

  • January 13, 2012
  • Like
  • 0

 

Hi Friends,

 

Below given is the code ,I need to access the contacts last name assiciated with the acocunts.I am  not able to .Can somebody tell me how to access the contacts asscoaied wih the account.How do I display lastname and name of the contacts asscoaited with the particular account.

 

trigger Trigger1 on Account (before insert,before update) {

account []a=[SELECT Name,(SELECT LastName,name FROM Contacts)FROM Account];

  //account []acc =[Select a.Name, a.Id, (Select AccountId, LastName, FirstName From Contacts) From Account a];

for(Account p:a)
{

System.debug('The values in the list account is ........................'+p.name);
//System.debug('The values in the list account  related contact lastname is ........................'+p.lastname);
}
}

Thanks,

trick

 

 

  • January 12, 2012
  • Like
  • 0

Newbie here,

 

Say I have 2 different enterprise wsdl files for two different orgs how do I use WSC to generate different package names for code compiled so that I can connect, query and use sobject.xxxx from these two different orgs seperately?

 

I tried replacing the package name everywhere in the WSDL (changed every occurence of enterprise.soap.sforce.com to xyz.enterprise.soap.sforce.com) but when I do that seems like the EnterpriseConnection class isn't getting created by the wsc.

 

Thanks

 

  • January 31, 2011
  • Like
  • 0

Hi, 

 

 I am implementing a client using Axis2, and partner.wsdl 

 

 I've read that creation of multiple stubs will lead to performance issues. 

 

 In the Axis2, we need to pass each and every parameter like sessionheader, calloptions, etc for each call (query, update, etc) we make.

 

- So, I am just thinking of reusing the same stub once it's endpoint is changed after the login 

   - across a single session

   - or for an entire application. (Does the URL change every time we login?)

 

BTW, are there any other points  to consider to improve performance.

 

Please clarify. 

Hi I am doing a project to Integrate salesforce with java.

 

I am successfully getting login which returns session id and server Url.

 

I set the server url, but dont know how to set the session header.

 

I created an object for the session header and set the session id, but dont know how to use that object.

 

I am using Netbeans 6.9.1.

 

Is it necessary to use wsc to parse the enterprise WSDL file.

 

Please give me a solution...

 

API referred : http://www.salesforce.com/us/developer/docs/api/index.htm  

                         subsection: reference->standard objects

 

Client side details : partner.wsdl, Axis2 1.5

                                    generated stubs using unpacked option (-u). 

 

I was hoping to find some basic objects like Account, Contact, etc so that I can do something like

 

-> SObject[] sObjArray = queryResult.getRecords(); 

     for(SObject sObj : sObjArray){

 Account acc = [Account] sObj;

 

 }

[used above approach successfully in another webservice]

 

  However, I could not find Account class in the generated classes. I guess I am into wrong approach, but atleast I should be finding the classes listed in the reference API.

 

Please help. 

I have to update Opportunity and Opportunity line item detail into sforce.com from my application. When i update one of the line item into sforce.com and if it fails for some reason can i rollback the whole SObject ?

 

Thanks,

Gubs

  • October 14, 2010
  • Like
  • 0

Hi Guys,

I am attempting to call a simple web service that I have written in Apex from a Java Program.

The steps I have taken so far.

1. Create a webservice method inside a global class. (compiles ok).
2. Generate wsdl files for both my WebService and the org.
3. Install Apache Axis
4. Use Axis to generate proxy stubs (runs ok - and generates Java source files.)
5. Compile All Java sources generated (all compile first time without changes).
6. Construct Client code (as shown below).

import com.sforce.soap.schemas._class.MyWebService.*;
import java.net.*;


public class TestCall{

 

 public static void main(String[] args){

  System.out.println("start of program");
  try{

                 //        SoapBindingStub  binding = (SoapBindingStub) new SforceServiceLocator().getSoap();

   MyWebServiceBindingStub stub =
                              new MyWebServiceBindingStub
                               (new URL("https://na1-api.salesforce.com/services/Soap/class/MyWebService"),null);
   //com.sforce.soap.schemas._class.MyWebService.MyWebServicePortType pt =
                                //  stub.getMyWebService();
   System.out.println("about to make call");
   stub.myMethod();
  }
  catch(Exception e){
   System.out.println("exception thrown");
   System.out.println(e.getMessage());
  }
 }

 


}


7. The code above compiles fine.
8. On running I get:

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session.

Can you please tell me where I am going wrong. (While I still have some hair left to pull out please :)  )

Thank you , in advance.


Kevin Wright.

 

Hi,

 

 

I'm trying to create an update  function for a custom object. In my Visualforce code, there's a commandLink to perform the work. When pressing the link I call a method in my controller that updated the record which ID is passed as a parameter. However, it doesn't work and I get the following error:

 

 

 


System.LimitException: DML currently not allowed

 

 

Class.MyRequestsController.approveRequest: line 135, column 3 External entry point

 

here is part of my code:

 

 

<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
		            <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
		            <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
		            <apex:column headerValue="Status" value="{!query.Status__c}"/>
		            <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
		            <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
		            <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
		            <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
		            <apex:column rendered="{!approvalQueriesDisplayed}">
                		<apex:facet name="header">Action</apex:facet>
                        	<apex:commandLink value=" Approve " action="{!approveRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandLink>
            	            </apex:column>
</apex:pageBlockTable>

 please, help

 

<apex:pageblock id="openqueries">
<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
           <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
           <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
           <apex:column headerValue="Status" value="{!query.Status__c}"/>
           <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
           <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
           <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
           <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
           <apex:column rendered="{!approvalQueriesDisplayed}">
                 <apex:facet name="header">Action</apex:facet>
                         <apex:commandLink value=" Approve " action="{!approveRequest}">
                         <apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                         </apex:commandLink>
                         <apex:commandLink value=" Reject " action="{!rejectRequest}">
                         <apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                         </apex:commandLink>
               </apex:column>
</apex:pageBlockTable>
</apex:pageblock>

 

Hi,

I want to make a reusable Component that has a Select Box on it. (made using apex:repeater and HTML)

 

From the page how can I deteremine the currently selected value?

 

I have read http://wiki.developerforce.com/index.php/Controller_Component_Communication

already but that uses APEX controllers to comunicate I want to do it all client side if possible. 

 

e.g.    When I press save on the form I want to get a textbox value from my main page, the select list selected value from my component in the one click.

  • February 17, 2010
  • Like
  • 0

I am planning to develop a mobile app using Appcelerator and force.com platform. I am new to Appcelerator platform and my top fear is stablity of Appcelerator connector, because of following reasons

  1. Its not part of core salesforce  mobile sdk, I doubt its regularly updated and maintained.
  2. On the connector listing it says "iOS" as  supported operating system. Does this means no other os like Android, Windows etc are supported ?

 

My goal is to get native looking app, rather HTML for performance and other reasons. So I am opting for Appcelerator as it gives native binaries, otherwise could have opted for PhoneGap.

 

Based on above summary, can any experienced developers recommend me going forward on this path with Appcelerator ?

I noticed this issue while writing an Apex test case for some chatter related functionality. For sake of this post, I am just posting the simplified test case. Here is the code

 

public static testmethod void testFeeds() {
  Test.startTest();
    // Create a Test Account
    Account acc = new Account(Name = 'Demo Account');
    insert acc;
    
    // Create FeedItem using this Account as a Parent Record
    FeedItem fp = new FeedItem();
    fp.Body = 'Testing via Apex';
    fp.parentId = acc.id;
    insert fp;
    
    // Query AccountFeed back to verify if the post was created correctly
    AccountFeed[] accFeed = [Select Id, Body From AccountFeed Where ParentId =:acc.Id];
    // should be 1 record in the feed for this accountid
    System.assertEquals(1, accFeed.size());
  Test.stopTest();
}

 

This test case fails, because there are no rows in AccountFeed for the given “parentId”. This happens only if Apex class API version is “24”, but the same tests passes if the API version is lowered, for ex. “23”.

Seems something is broken in Apex Test fixture.

Getting MD5 hash problem regularly, even on repeated attempts to download. I am using Mac OS X, tried the same on both Eclipse Helios and Indigo.

 

An error occurred while collecting items to be installed
session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Problems downloading artifact: osgi.bundle,com.salesforce.ide.api,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 7251ab037ae632a5a9835c7c07210451 and found 05a56de55eb3b8d037cc729bd545fadc.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.core,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 44db36699ca7fdd38917fced4e63c3b3 and found 2ea711a96078fd4201bd0a330b47d4a5.
Problems downloading artifact: osgi.bundle,com.salesforce.ide.documentation,24.0.0.201202291629.
MD5 hash is not as expected. Expected: 6d87eb2e76e7e19f7b709682e5272dfc and found 5d7e9d6f079bc6b0a96d9da827d5145e.

 

 

 

I am getting this error in a Apex/Visualforce page/controller.

 

Unable to retrieve object

 

I am trying to use Page.PageName.getContent() in my controller. This code works well and fails randomly for this error, with same inputs and same state.

 

Please suggest a fix, tried searching on discussion boards, its mentioned that this error only comes in Apex test cases. But for me its coming in normal visualforce page controllers, and the pain is its coming randomly.

 

Please help !

Hi,

 

We have developed a simple page with an Apex extension. This page works normally most of the times, but it randomly stops working and shows strange bugs. The way to fix this is to save the extension class again via browser. 

 

Is it somehow related to new Java runtime being used in Apex and that is enabled for sandbox orgs ? 

 

We are already seeing lot of code coveage difference issues posted across, and solutions like : http://th3silverlining.com/2011/11/30/salesforce-different-percentage-code-coverage-in-different-environments/

 

Is anybody else facing similar issues ? 

 

 

I am making this callout to CrunchBase 

 

HttpRequest[Endpoint=http://api.crunchbase.com/v/1/search.js?query=square, Method=GET]

 

and getting this JSON Response and error, Seems I need to wipe out a bad char, but how to find the one ? how should I get rid of this one ? 

Also checked char location 26924 in VIM, its end of string.

 

16:47:53.321 (321102000)|FATAL_ERROR|System.JSONException: Illegal unquoted character ((CTRL-CHAR, code 11)): has to be escaped using backslash to be included in string value at input location [26,924]

 

16:47:53.237 (237876000)|USER_DEBUG|[6]|DEBUG|{"total": 253,
 "page": 1,
 "crunchbase_url": "http://www.crunchbase.com/search?query=square",
 "results":
  [{"name": "Square Enix North America",
    "permalink": "square-enix-north-america",
    "crunchbase_url": "http://www.crunchbase.com/company/square-enix-north-america",
    "namespace": "company",
    "overview": "Square Enix, Inc. develops, publishes, distributes and licenses SQUARE ENIX, EIDOS and TAITO branded entertainment content throughout the Americas as part of the Square Enix Group. The Square Enix Group operates a global network of leading development studios and boasts a valuable portfolio of intellectual property, including: FINAL FANTASY\u00ae, which has sold over 97 million units worldwide; DRAGON QUEST\u00ae, which has sold over 54 million units worldwide; TOMB RAIDER\u00ae, which has sold over 35 million units worldwide; and the legendary SPACE INVADERS\u00ae. Square Enix, Inc. is a U.S.-based, wholly-owned subsidiary of Square Enix Holdings Co., Ltd.",
    "image":
     {"available_sizes":
       [[[150,
          12],
         "assets/images/resized/0012/4564/124564v1-max-150x150.png"],
        [[250,
          21],
         "assets/images/resized/0012/4564/124564v1-max-250x250.png"],
        [[273,
          23],
         "assets/images/resized/0012/4564/124564v1-max-450x450.png"]],
      "attribution": null}},
   {"name": "D square nv",
    "permalink": "d-square-nv",
    "crunchbase_url": "http://www.crunchbase.com/company/d-square-nv",
    "namespace": "company",
    "overview": "D square assists plant management in the process industry to detect, analyze and solve\r\ncritical bottlenecks to reach and surpass even the most challenging production targets, through the combination of high-end business consultancy services and innovative and market leading data mining know-how, packaged as real-time software products enabling custom support and interaction for each operational role.\r\n\r\nD square embeds state-of-the-art data mining and statistical learning techniques into software appliances and tailored solutions for process performance optimization. The research and development roadmap is driven by a combination of domain knowledge and experience, partner contacts and service projects that act as a probe in the market. The company's strong research backbone includes research initiatives on plant monitoring that are funded by IWT Vlaanderen.\r\n\r\nD square is a spin-o company of K.U.Leuven and won in 2009 the award of \"best spin-o of the year\". It is currently developing a software suite to improve overall plant eciency and increase the current plant safety level.",
    "image":
     {"available_sizes":
       [[[130,
          150],
         "assets/images/resized/0011/0089/110089v2-max-150x150.jpg"],
        [[218,
          250],
         "assets/images/resized/0011/0089/110089v2-max-250x250.jpg"],
        [[344,
          394],
         "assets/images/resized/0011/0089/110089v2-max-450x450.jpg"]],
      "attribution": null}},
   {"name": "Square",
    "permalink": "square",
    "crunchbase_url": "http://www.crunchbase.com/company/square",
    "namespace": "company",
    "overview": "Square is a revolutionary service that enables anyone to accept credit cards anywhere. Square offers an easy to use, free credit card reader that plugs into a phone or iPad. It's simple to sign up. There is no extra equipment, complicated contracts, monthly fees or merchant account required.\r\n\r\nCo-founded by Jim McKelvey and Jack Dorsey in 2009, the company is headquartered in San Francisco with additional offices in Saint Louis and New York City.\r\n",
    "image":
     {"available_sizes":
       [[[130,
          34],
         "assets/images/resized/0006/8147/68147v15-max-150x150.png"],
        [[130,
          34],
         "assets/images/resized/0006/8147/68147v15-max-250x250.png"],
        [[130,
          34],
         "assets/images/resized/0006/8147/68147v15-max-450x450.png"]],
      "attribution": null}},
   {"name": "Genetics Squared",
    "permalink": "genetics-squared",
    "crunchbase_url": "http://www.crunchbase.com/company/genetics-squared",
    "namespace": "company",
    "overview": "Genetics Squared, Inc. provides solutions for personalized medicines in Michigan. The company focuses on offering life sciences solutions. Its Evolver technology, a machine learning technique that produces mathematical models that describe a dataset based on what specific questions are being asked about that dataset. The company\u2019s technology is applied in various areas of clinical and preclinical biomedical research, such as for clinical oncology, infectious disease, nephrology, and autoimmune disease. Genetics Squared, Inc. was founded in 2001 and is based in Ann Arbor, Michigan.\r\n",
    "image":
     {"available_sizes":
       [[[150,
          41],
         "assets/images/resized/0011/9606/119606v1-max-150x150.jpg"],
        [[250,
          69],
         "assets/images/resized/0011/9606/119606v1-max-250x250.jpg"],
        [[386,
          108],
         "assets/images/resized/0011/9606/119606v1-max-450x450.jpg"]],
      "attribution": null}},
   {"name": "Pay It Square, LLC",
    "permalink": "payitsquare-llc",
    "crunchbase_url": "http://www.crunchbase.com/company/payitsquare-llc",
    "namespace": "company",
    "overview": "Pay It Square helps people collect money from groups of friends.\r\n\r\nIt is ideal for:\r\n\r\n- Organizing a bachelor or bachelorette party.\r\n- Team managers who need to collect league dues.\r\n- Organizers collecting for group outings.\r\n- Collecting rent from roommates.\r\n- Buying a gift on behalf of a group.\r\n- Buying tickets to an event for a group of people.\r\n- Organizing a group vacation.\r\n- Collecting association dues.\r\n\r\nYou get the idea. People are constantly collecting these types of payments.  Pay It Square makes it easier.",
    "image":
     {"available_sizes":
       [[[150,
          26],
         "assets/images/resized/0005/7770/57770v2-max-150x150.jpg"],
        [[156,
          28],
         "assets/images/resized/0005/7770/57770v2-max-250x250.jpg"],
        [[156,
          28],
         "assets/images/resized/0005/7770/57770v2-max-450x450.jpg"]],
      "attribution": null}},
   {"name": "Kee Square",
    "permalink": "kee-square",
    "crunchbase_url": "http://www.crunchbase.com/company/kee-square",
    "namespace": "company",
    "overview": "Kee Square S.r.l., a spin-off company of the Politecnico di Milano, develops innovative techniques in video and audio signal processing for biometric identification and tracking, detection of hazardous events, and security applications in general.\r\n\r\nKee Square products are designed and customized to fulfill the Law Enforcement and Commercial Markets requirements. ",
    "image":
     {"available_sizes":
       [[[150,
          76],
         "assets/images/resized/0007/0993/70993v1-max-150x150.jpg"],
        [[250,
          126],
         "assets/images/resized/0007/0993/70993v1-max-250x250.jpg"],
        [[298,
          151],
         "assets/images/resized/0007/0993/70993v1-max-450x450.jpg"]],
      "attribution": null}},
   {"name": "Colton Square Business Park",
    "permalink": "colton-square-business-park",
    "crunchbase_url": "http://www.crunchbase.com/company/colton-square-business-park",
    "namespace": "company",
    "overview": "Where the city\u2019s past and future dovetail Colton Square is the cornerstone of Leicester\u2019s dramatic Business Quarter renaissance.\r\n\r\nThis unique development represents the fusion of the listed former police station on Charles Street with striking high profile contemporary office space. The result is breathtaking in its vision.\r\n\r\nNow complete and ready for occupation One and Two Colton Square provide corporates and professionals with the cachet of locating in the city\u2019s most prestigious and dramatic commercial address. No other business space in Leicester makes such a bold statement.",
    "image":
     {"available_sizes":
       [[[81,
          71],
         "assets/images/resized/0010/3576/103576v2-max-150x150.png"],
        [[81,
          71],
         "assets/images/resized/0010/3576/103576v2-max-250x250.png"],
        [[81,
          71],
         "assets/images/resized/0010/3576/103576v2-max-450x450.png"]],
      "attribution": null}},
   {"name": "SDP Squared, LLC",
    "permalink": "sdp-squared-llc",
    "crunchbase_url": "http://www.crunchbase.com/company/sdp-squared-llc",
    "namespace": "company",
    "overview": "SDP Squared was founded to help small businesses in the Maryland, Metro Baltimore and Southern New Jersey areas get the most out of their business technology. They provide affordable IT support services especially taylored for non-profits and small business companies.",
    "image":
     {"available_sizes":
       [[[137,
          76],
         "assets/images/resized/0006/8027/68027v2-max-150x150.jpg"],
        [[137,
          76],
         "assets/images/resized/0006/8027/68027v2-max-250x250.jpg"],
        [[137,
          76],
         "assets/images/resized/0006/8027/68027v2-max-450x450.jpg"]],
      "attribution": null}},
   {"name": "PE Squared",
    "permalink": "pe-squared",
    "crunchbase_url": "http://www.crunchbase.com/company/pe-squared",
    "namespace": "company",
    "overview": "PE SQUARED is a North Carolina Civil Engineering Firm licensed in North and South Carolina specializing in Land development services. We have a focus on sustainable site development practices that can be both economical and sustain the environment into the future. Additionally our services include floodplain studies, preliminary site analysis, cost estimating, and project management.",
    "image":
     {"available_sizes":
       [[[103,
          150],
         "assets/images/resized/0008/0163/80163v2-max-150x150.jpg"],
        [[103,
          150],
         "assets/images/resized/0008/0163/80163v2-max-250x250.jpg"],
        [[103,
          150],
         "assets/images/resized/0008/0163/80163v2-max-450x450.jpg"]],
      "attribution": null}},
   {"name": "Jackson Square Group",
    "permalink": "jackson-square-group",
    "crunchbase_url": "http://www.crunchbase.com/company/jackson-square-group",
    "namespace": "company",
    "overview": "Jackson Square Group is a market research technology firm. Based in New Orleans, the firm creates technologies that maximize the efficiency and effectiveness of gathering data and intelligence from consumer markets.",
    "image":
     {"available_sizes":
       [[[150,
          150],
         "assets/images/resized/0009/9935/99935v2-max-150x150.png"],
        [[250,
          250],
         "assets/images/resized/0009/9935/99935v2-max-250x250.png"],
        [[300,
          300],
         "assets/images/resized/0009/9935/99935v2-max-450x450.png"]],
      "attribution": null}}]}

16:47:53.321 (321102000)|FATAL_ERROR|System.JSONException: Illegal unquoted character ((CTRL-CHAR, code 11)): has to be escaped using backslash to be included in string value at input location [26,924]

 

16:47:53.098 (98603000)|CALLOUT_REQUEST|[130]|System.HttpRequest[Endpoint=http://api.crunchbase.com/v/1/search.js?query=square, Method=GET]

16:47:53.098 (98603000)|CALLOUT_REQUEST|[130]|System.HttpRequest[Endpoint=http://api.crunchbase.com/v/1/search.js?query=square, Method=GET]

Here is the complete Test class with all comments and required code. To test it one can deploy this to their DE org directly, it has no dependencies.While writing an apex test case I noticed a strange behavior with System.runAs(). My tests were failing incorrectly, because system.runAs() was somehow not resetting the CRUD/FLS context for different profiles across same or different test method executions.

 

Here is the complete Test class with all comments and required code. To test it one can deploy this to their DE org directly, it has no dependencies.

 

@isTest
private class Test_System_RunAs {
 
/*
 This test class has two test methods, i.e.
  1. testWithSysAdmin() executes a FLS check with SYS Admin profile
  2. testWithChatterFree()  executes a FLS check with Chatter Free profile
   
  PROBLEM :
  Both of these methods doesn't execute correctly. 
  The one that executes first sets the profile context via System.runAs()
  and somehow its not reset internally for the second testMethod execution,
  this makes the testMethod executing later fail (as profile permissions mismatch)
  Though if we comment and execute both these testMethods one at a time, they will behave correct.
  So that means each of these testXXX() methods are correct, somehow context is not reset correctly
  when they execute one after another.
   
  QUESTION :
   
  Am I doing something wrong or is this some bug in System.runAs() context, I feel it takes care
  of sharing rules etc, but doesn't enforces the FLS correctly ?
   
*/
 
public static testMethod void testWithSysAdmin() {
  System.runAs(createMockUserForProfile('System Administrator')) {
    // This debug indicates different profiles
    System.debug('ProfileId:' +Userinfo.getProfileId());
    System.assertEquals(true, Account.BillingCity.getDescribe().isUpdateable());
  }          
}
 
public static testMethod void testWithChatterFree() {
  System.runAs(createMockUserForUserLicense('Chatter Free')) {
    // This debug indicates different profiles
    System.debug('ProfileId:' +Userinfo.getProfileId());
    // Chatter Free user has no permission on the Account, so it should be false
    System.assertEquals(false, Account.BillingCity.getDescribe().isUpdateable());
  }          
}
 
static User createMockUserForUserLicense(String licenseName) {
  Profile p = [SELECT Id FROM profile WHERE UserLicense.Name like :licenseName LIMIT 1];
  return createMockUser(p.id);
}
 
static User createMockUserForProfile(String profileName) {
  Profile p = [SELECT Id FROM profile WHERE name like :profileName];
  return createMockUser(p.id);
}
 
static User createMockUser(Id profileId) {
  User u = new User(alias = 'newUser', email='newuser@tgerm.com.test',
  emailencodingkey='UTF-8', lastname='Testing', 
  languagelocalekey='en_US', localesidkey='en_US', profileid = profileId,
  timezonesidkey='America/Los_Angeles', username= System.now().millisecond() + 'newuser@tgerm.com.test');
  insert u;
  return  u; 
}
}

 

Please let me know what's the gap ?

 

I am also discussing the same on my blog here : http://www.tgerm.com/2011/09/apex-systemrunas-different-profiles.html

 

Thanks ! 

Its great experience to work full screen in Eclipse (Force.com IDE), for details about setup please check this post : Link

API and helper classes are created If you need to call Marketo SOAP API from Apex. Not creating a code share entry, as its a simple helper api for that specific requirement.

 

Full Source on github.com : https://github.com/abhinavguptas/apex-marketo-soap-api-helper

 

For more details : http://www.tgerm.com/2011/08/apex-marketo-soap-api-wsdl.html

Created a simple and easy to use API for sorting SelectOption collection by Label/Value. Not creating a codeshare project for it, as its a single class. All source code is available here : https://github.com/abhinavguptas/Apex-Select-Option-Sorting For more details, please check this post : http://www.tgerm.com/2011/08/salesforce-apex-selectoption-sort.html

I tried calling this function from both APEX and WS API, with a simplest soql fragement mentioned in salesforce docs itself i.e.

 

SELECT convertTimezone(CreatedDate) FROM Opportunity

 

I always got this error : MALFORMED_QUERY: Invalid aggregate function: convertTimezone How does this guy works ?

 

I also posted this in general development discussion boards, but no reply till yet, so posting here also. Simon, you there :) ?

I tried calling this function from both APEX and WS API, with a simplest soql fragement mentioned in salesforce docs itself i.e. 

 

SELECT convertTimezone(CreatedDate) FROM Opportunity

 

I always got this error : MALFORMED_QUERY: Invalid aggregate function: convertTimezone

 

How does this guy works ?

Hi Everyone,

 

I can easily query and play around with results using Javascript remoting, but when trying to update the record using the remoting again. It seems its rolling back my changes without any errors.

 

Here is code snippet

 

Controller Class

 

 

public global with sharing class  testremotingcontroller {
    
     
    @RemoteAction
    global static Account[] searchAccounts(String accountName) {
        accountName = accountName.replaceAll('[*]', '%');
        return [select id, name, phone, type, numberofemployees from 
             Account where name like :accountName ];
        
    }   
    
    @RemoteAction
    global static boolean updateAccount(String accountId, String phoneNum) {
        Account a = [Select Phone from Account where Id = :accountId];
        a.Phone = phoneNum;
        update a;
        // querying again to see if its fixed.
        a = [Select Phone from Account where Id = :accountId];
        // This debug always prints the updated value
        system.debug('>>> accId'+ accountId + 
                    ' phone ' +  phoneNum +
                     ' ' +a );
        return true;
    }
}

 

 

Visualforce Page

 

<apex:page controller="testremotingcontroller">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"/>
<apex:includeScript value="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"/>

<apex:sectionHeader title="Javascript Remoting & jQuery Templates !"/>

<apex:pageBlock title="Accounts">
    <apex:pageBlockSection title="Search Accounts" columns="2">
        <apex:pageBlockSectionItem >
            Account Name :
            <input type = "text" id = "accountNameToSearch" />
            <button onclick="searchAccounts()">Get Account</button>
        </apex:pageBlockSectionItem>        
    </apex:pageBlockSection>
    <apex:pageBlockSection title="Matching Accounts !" columns="1">
    <!-- 
	Created Empty table using the CSS styles of visualforce pageBlockTable 
	This gives same look and feel 
    -->
    <table cellspacing="0" cellpadding="0" border="0" id="searchResults" class="list ">
        <colgroup span="2"></colgroup>
        <thead class="rich-table-thead">
            <tr class="headerRow ">
                <th colspan="1" scope="col" class="headerRow">Id</th>
                <th colspan="1" scope="col" class="headerRow"> Name</th>
                <th colspan="1" scope="col" class="headerRow"> Phone</th>
                <th colspan="1" scope="col" class="headerRow">Type</th>
                <th colspan="1" scope="col" class="headerRow"> Number of Employees</th>                                 
            </tr>
        </thead>
	<!-- table body left empty for populating via row template using jquery -->
        <tbody />
    </table>
    </apex:pageBlockSection>
</apex:pageBlock>

<!-- Create a named jquery template -->
<script id="resultTableRowTemplate" type="text/x-jquery-tmpl">
<tr onfocus="if (window.hiOn){hiOn(this);}" onblur="if (window.hiOff){hiOff(this);}" onmouseout="if (window.hiOff){hiOff(this);} " onmouseover="if (window.hiOn){hiOn(this);} " class="dataRow even  first">
    <td class="dataCell">${Id}</td>
    <td class="dataCell">${Name}</td>
    <td class="dataCell"><input type="text" value="${Phone}" /></td>
    <td class="dataCell">${Type}</td>        
    <td class="dataCell">${NumberOfEmployees}</td>
</tr>           
</script>


<script type="text/javascript">
// if you are inside some component
// use jquery nonConflict
// var t$ = jQuery.noConflict();

function searchAccounts() {
    var accountName = $('#accountNameToSearch').val();
    // clear previous results, if any
    $("#searchResults tbody").html('');
    
    // The Spring-11 gift from force.com. Javascript remoting fires here
    // Please note "abhinav" if my org wide namespace prefix
    // testremotingcontroller is the Apex controller
    // searchAccounts is Apex Controller method demarcated with @RemoteAction annotation.
    abhinav.testremotingcontroller.searchAccounts( accountName, function(result, event){            
        if (event.status && event.result) {  
          $.each(event.result, function () {                
          // for each result, apply it to template and append generated markup to the results table body.
                  var row = $("#resultTableRowTemplate" ).tmpl(this);
		  // locate the Phone field and bind this account and blur handler to it
		  row.find('td input').data('account', this).blur(
			function () {
				var orginalAcc = $(this).data('account');
				if (orginalAcc.Phone != $(this).val()) 
					updateAccount(orginalAcc, $(this).val());
			}
		  );
		  row.appendTo( "#searchResults tbody" );
              }
          );            
        } else {
           alert(event.message);
        }
    }, {escape:true});
}

function updateAccount(acc, newPhoneVal) {
	abhinav.testremotingcontroller.updateAccount( acc.Id, newPhoneVal, function(result, event){            
        if (event.status && event.result) {  		
	   alert('Account - '  + acc.Name + ' updated  !');
        } else {
           alert(event.message);
        }
    }, {escape:true});
}
</script>

</apex:page>

 I am pasting the whole code as it is without any trimming. So that one can easily reproduce this by copy pasting it directly.

 

I have a Java integration working well using Partner API with my sandbox org. This integration deletes some chatter comments/posts, but now as of Spring'11 it needs special permissions "Moderate Chatter" to do so. 

 

So I tried searching for a way to assign that permission to my user/profile. Tried searching for a way to assign that permission, but it seems on chatter free user's can be marked as moderators and then they can further delegate this permission to any body else. But I was not able to create a chatter free user too. 

 

So I tried reverting code back to API version 20, but I am still facing the same issue. Is this "Moderate Chatter" change applied globally to all API versions or its a bug ? I am using Force.com Connector API (WSC)

Hello Everyone,

 

I am dealing with FeedPost (Type=ContentPost) with file attachments in a visualforce page. I need to render a download link for the document attached in the Feed Post. I can't use visualforce chatter tags.

 

Is their any other way similar to what we do for attachment, as shown in code snippet below.

 

 <apex:outputLink 
      value="{!URLFOR($Action.Attachment.Download,
                      attachment.id)}">
      Download Now!
 </apex:outputLink>

 

 

 

This blog post explains this in detail : post link

In my project, we follow certain records via after update triggers, if some conditions match.

 

I am getting this error on follow code that creates an EntitySubscription via trigger

 

Description: Error:Apex trigger FollowXYZ caused an unexpected exception, contact your administrator: FollowXYZ: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: LIMIT_EXCEEDED, Maximum per user subscription limit reached.: []: Class.eng.ChatterUtil.followRecords: line 27, column 13

 

Seems their is some governor limit on following the entities also, i tried figuring out what the exact count is. It seems "500".

Can anyone tell me the exact count, I can't find this documented anywhere ??

I created a helper class named "WSCSession" for WSC. WSCSession allows you to flexibly login either via Partner or Enterprise WSDL. The best part is it doesn’t depends on either Partner or Enterprise WSDL2Java classes. So if you are working on Enterprise WSDL, you don’t need to include WSDL2Java classes for Partner WSDL in classpath and vice versa. It internally works on dynamic class loading to ensure right WSC Connectors are used to create SFDC Sessions.

 

Full API details available here

Hi,

I am having an issue with displaying trigger error on a Visualforce page. In my trigger, I'm having the following piece of code to throw the error:

myCustomObjectInstance.addError('You are not allowed to do this...');

Again, on my VF page, I have added the following snippet:
<apex:pagemessages/>
The problem is that when I simulate the error condition, it does not display the error message on the VF page, but the same is visible in debug log as follows:
VF_PAGE_MESSAGE|You are not allowed to do this...


Anyone has any idea about it?

Thanks..

Hi,

Please help me to write  a test class for the below trigger

/**
**
**/
trigger AF_processETBouncebacks on et4ae5__IndividualEmailResult__c (after insert) {

   Map<String,String> aeMap = new Map<String,String>();
   List<Case> casesToInsert = new List<Case>();
   List<Task> tasksToInsert = new List<Task>();
   List<et4ae5__IndividualEmailResult__c> bouncedEmails = new List<et4ae5__IndividualEmailResult__c>();
   Map<String,String> acEmailMap = new Map<String,String>();
        
   for (et4ae5__IndividualEmailResult__c bouncedEmail: Trigger.New) {
  
      if (bouncedEmail.et4ae5__HardBounce__c) {
           bouncedEmails.add(bouncedEmail);
       }
   }

   if (bouncedEmails.size() > 0) {
     
      for (et4ae5__IndividualEmailResult__c tempList : [Select et4ae5__Contact__r.AccountId from et4ae5__IndividualEmailResult__c Where Id IN :bouncedEmails]){ 
          acEmailMap.put(tempList.Id,tempList.et4ae5__Contact__r.AccountId);
      }
     
      Map<String, RecordType>  caseRecordTypeMap = AF_DealerCRM_Utility.getRecordTypes('Case'); 
      Map<String,Group> dealerCrmQueueMap = AF_DealerCRM_Utility.getDealerCrmQueue();
      aeMap = AF_DealerCRM_Utility.getAE(acEmailMap.values());
     
      for (et4ae5__IndividualEmailResult__c email: bouncedEmails) {
     
          String acId = acEmailMap.get(email.id);
         
          if (aeMap.containsKey(acId)) { 
             Task tsk = new Task();
             tsk.WhoId = email.et4ae5__Contact__c;
             tsk.OwnerId = aeMap.get(acId); 
             tsk.Subject = 'Bounceback Correction';
             tsk.ActivityDate = date.today()+5;
             tsk.CreatedById = System.Label.ExactTarget_Admin;
             tsk.Description = 'There was a bounceback for this Contact. The email send id : ' + email.et4ae5__SendDefinition__c;
             tasksToInsert.add (tsk);
          }
          else {
              // If no Autofinance AE or Additional AE exists, then create a case and assign to Sales Performance Queue.
              Case cs = new Case();
              cs.AccountId = acId;
              cs.Priority = 'Medium';
              cs.Subject = 'No AE found on Account Team';
              cs.Status = 'New';
              cs.Description = 'Please navigate to the contact on this case to re-assign the task owner';
              cs.ContactId = email.et4ae5__Contact__c;
              cs.Case_related_to__c = 'Contact';
              cs.RecordTypeId = caseRecordTypeMap.get('Sales').Id;
              cs.OwnerId = dealerCrmQueueMap.get('Case Mgmt Sales Performance').Id;
              casesToInsert.add(cs);
          }
            
      }    

      /* New Cases for AE that are not found.*/
      if (casesToInsert.size() > 0 ) {
       
         try {
            AF_DealerCRM_DML_Utility.insert_op(casesToInsert); 
         }
         catch(Exception ex) {
            system.debug('Exception while creating Case' + ex.getMessage());
         }    
      }
     
      /* New Tasks to create for bounced emails */
      if (tasksToInsert.size() > 0) {
     
         try {
             AF_DealerCRM_DML_Utility.insert_op(tasksToInsert); 
         }
         catch(Exception ex) {
             system.debug('Exception while creating Tasks for bounced emails : ' + ex.getMessage());
         }    
           
      } 
   }
 
}



Thanks in Advance
 

I'm still trying to develop a Visualforce page that will look like it fits into the rest of the standard Salesforce1 app. (See https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AZRyIAO for my last question on the subject.)

I'd like to display an input box for a date value that displays a date picker that looks like the native Salesforce1 date picker.

I've scanned the Mobile Design Templates, but don't see any examples of how to create a form field that has a date picker that looks like the native Salesforce1 date picker.

I'd really like to develop a VF page that looks like it belongs in the Salesforce1 app, using Salesforce1 styling. Is anyone else having the same problems I am in trying to accomplish this?
Someone could help me with my class test for this?
public class CallOutMaps {
	
	public class Geocode{
	  public double lat {get; set;}
	  public double lon {get; set;}
	  
	}

    private static Geocode geocodificar(String address) {
    	
        // construtor callout
        Geocode g = new Geocode();
      
        
        Http h = new Http();
        HttpRequest req = new HttpRequest();
       //System.Debug ('http://maps.googleapis.com/maps/api/geocode/json?address='+address+'&sensor=false');
        req.setEndpoint('http://maps.googleapis.com/maps/api/geocode/json?address='+address+'&sensor=false');
        req.setMethod('GET');
        req.setTimeout(60000);
 
        try{
            // callout
            HttpResponse res = h.send(req);
 
            // Analisa as coordenadas de resposta
            //System.debug(res.getBody());
            JSONParser parser = JSON.createParser(res.getBody());
            double lat = null;
            double lon = null;
            while (parser.nextToken() != null) {
                if ((parser.getCurrentToken() == JSONToken.FIELD_NAME) &&
                    (parser.getText() == 'location')){
                    	
                       parser.nextToken(); // objeto início
                       while (parser.nextToken() != JSONToken.END_OBJECT){
                           String txt = parser.getText();
                           parser.nextToken();
                           if (txt == 'lat'){
                               lat = parser.getDoubleValue();
                               //g.lat = parser.getDoubleValue();
                           }
                           else if (txt == 'lng')
                               lon = parser.getDoubleValue();
                       }
 
                }
            }
 			//System.debug(lat + '  '+lon);
            g.lat = lat;
            g.lon = lon;
            System.debug(g);
        } catch (Exception ex) {
        }
        return g;
    }
	
 
 
     @future (callout=true)  // Método futuro necessário para executar chamadas da trigger
      public static void geocodificarAccount(Id accountId){
      	/*
      	TipoEndereco:
      	0 = Billing
      	1 = Shipping
      	*/
      	
        // Reuni informações da conta
        Account a = [SELECT Id,BillingCity,BillingCountry,BillingPostalCode,BillingState,BillingStreet ,BillingLatitude,BillingLongitude,ShippingState, ShippingStreet,ShippingPostalCode, ShippingLongitude, ShippingLatitude, ShippingCountryCode, ShippingCountry, ShippingCity,Futuro__c FROM Account WHERE id =: accountId]; 
 	
         // cria um endereço string
        String address = '';
			
	        if (a.BillingStreet != null)
	            address += a.BillingStreet +', ';
	        if (a.BillingCity != null)
	            address += a.BillingCity +', ';
	        if (a.BillingState != null)
	            address += a.BillingState+', ';
	        if (a.BillingPostalCode != null)
	            address += a.BillingPostalCode +', ';
	        if (a.BillingCountry != null) 
	            address += a.BillingCountry +', '; 
	            
        address = EncodingUtil.urlEncode(address, 'UTF-8');
        
		String endereco  = '';
	        if (a.ShippingStreet != null)
	            endereco += a.ShippingStreet +', ';
	        if (a.ShippingCity != null)
	            endereco += a.ShippingCity +', ';
	        if (a.ShippingState != null)
	            endereco += a.ShippingState+', ';
	        if (a.ShippingPostalCode != null)
	            endereco += a.ShippingPostalCode +', ';
	        if (a.ShippingCountry != null) 
	            endereco += a.ShippingCountry +', '; 
		    
		endereco = EncodingUtil.urlEncode(endereco, 'UTF-8'); 	
        
        Geocode g = geocodificar(address);
        Geocode e = geocodificar(endereco);
            
 		System.debug('Passou!'+a.Id);
            // Atualiza as coordenadas caso voltarmos

            
                 a.BillingLatitude  = g.lat;
                 a.BillingLongitude = g.lon;
            
            	a.Futuro__c = true;
                 a.ShippingLatitude  = e.lat;
                 a.ShippingLongitude = e.lon;

            
            update a;
      
    }
     
}


my test class is that so far but gives me a error system.dmlException

 

@isTest
private class tst_CallOutMaps {

    static testMethod void myUnitTest() {
    	
    	Account acc = new Account();
		acc.Name = 'nome';
		acc.ShippingStreet = 'Av das Nacoes unidas';
		acc.ShippingCity = 'Cubatao';
		acc.ShippingState = 'sp';
		insert acc;
		
	//Test.startTest();
	//SingleRequestMock fakeResponse = new SingleRequestMock(200,'Complete','[{"location" : {"lat" : 37.42291810, "lng" : -122.08542120}}]',null);
	//Test.setMock(HttpCalloutMock.class, fakeResponse);
	//LocationCallouts.getLocation(tmo.id);
//System.assertEquals(/*check for expected results here...*/);
      
    }
}


 

<apex:page id="thepage">
<script>
function changefont(input,textid)
{
if(input.checked)
{
document.getelementbyid(textid).style.fontsize="100px";
}
else
{
document.getelementbyid(textid).style.fontweight="normal";
}
}
</script>
<apex:outputPanel layout="block">
<label for="checkbox">click</label>
<input id="checkbox" type="checkbox" onclick="changefont(this,'{!$component.thepanel}');"/>
</apex:outputpanel>
<apex:outputPanel id="thepanel" layout="block">change my font</apex:outputPanel>
</apex:page>
I have a visualforce page and controller, part us which grabs "oppid" from the url and inserts it as part of the record.

a.Opportunity__c = ApexPages.currentPage().getParameters().get('oppId');
This works fine, if I have a URL such as:
salesforce.com/oppid=000013456789123

But sometimes, I get a URL such as:
salesforce.com/oppid=000013456789123?srPos=0

I would like to strip off everything after oppid=(first 15 chars). I was thinking about using something like LEFT,15 to do it. I have yet to get the formating right. Any suggestions?
Hi all!
I need to pass a value from javascrip (in vf page) to inputField
Here code:
<apex:page standardController="Travel_Expenses__c" extensions="TE_Object" action="{!Parameters}">
    <apex:form >
        <apex:pageBlock title="Travel Information Edit"  mode="edit">
            <apex:pageBlockButtons >
                    <apex:commandButton action="{!Save}" value="Save"/>
                    <apex:commandButton action="{!SaveAndNew}" value="Save & New"/>
                    <apex:commandButton action="{!Cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Information" columns="2">
                      <apex:inputField value="{!NewTE.Traveler__c}" id="Traveler" required="true" 
                                       onchange="TakeCountry(this.id);">
                        <apex:actionsupport event="onchange" reRender="CountryName"/>
                    </apex:inputField>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Country" for="CountryName"/>
                    <apex:inputField value="{!NewTE.Country_Name__c}" id="CountryName" />     
                </apex:pageBlockSectionItem>    
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
    <script language="JavaScript1.2" src="/js/functions.js"></script>
    <script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script>
    <script type="text/javascript">
        function TakeCountry(id)
        {
            try
            {
                sforce.connection.sessionId = '{!$Api.Session_ID}';
                var cval = document.getElementById(id).value;
                if (cval!=null)
                {   
                    country=sforce.connection.query("Select Country_Names__c from Travel_Information__c WHERE name='"+cval+"'");
                    alert('Selected '+country);
                    records = country.getArray("records");
                    c=records[0].Country_Names__c;
                    alert('C '+c);//after this message I have an error
                    countryname=document.getElementById({!$Component.CountryName}).value;
                    alert('done ');
                    countryname.value='country';
                    alert('Country '+countryname.value);

                }
            }
            catch (error)
            {
                alert('Error: '+error.faultstring);
            }
        }
    </script>
    
</apex:page>
I add a comment where script failed (Error: undefined)

Thanks!

Since I am testing Salesforce, I can´t see my Developer Console.

The first message is "Loading configuration...". 
Then I read "Loading workspace...", and that´s all.
I can´t see nothing else.

My Internet connection is perfect, and I´m using Firefox and Google Chrome.

I don´t understand what´s happening.

Please, help me!

Thank you.
I am using apex:repeat inside of a datatable/pageblocktable. Here is my code:

<apex:PageblockTable value="{!List}" var="fieldName"  cellPadding="4">
<apex:column value="{!fMap[fieldName]}" width="30"/>      
        <apex:repeat value="{!ListWrapCls}" var="acc">
                  <apex:column width="20">
                  <input type="radio" name="{!fieldName}" class="{!acc.Acct.id}" />
                 <apex:facet name="header" >
                           <apex:inputCheckbox value="{!acc.Bl}" title="{!acc.Acct.Name}"                                                       label="{!acc.Acct.Name}"/>
                </apex:facet>
                </apex:column>
        </apex:repeat>
</apex:PageblockTable>

how can i display radiobuttons inside of a repeat inside of a datatable/pageblocktable and maintain there values(true/false) using wrapper class?
Please help me regarding this.
I am using pahe block table and in this i am using :

<apex:repeat value="{!WrapCls}" var="obj">
            <apex:column width="20">
                    <apex:facet name="header" >
<apex:inputCheckbox value="{!obj.BoLn}" title="{!obj.Acct.Name}" label="{!obj.Acct.Name}"/>
                </apex:facet>
                                   {!obj.Acct.Name}    
            </apex:column>
</apex:repeat>

here in header checkbox is comming but its label is not comming.
What could be the issue, please help me regarding this.
How to create custom field on Lead using Rest API java program
I want to update the field in multiple records based on the unique_pile_id__c that is unique for all the multiple records. I am trying to write trigger like this

trigger opMetricsTrigger on Operational_Metrics__c (before insert,before update)
{
Operational_Metrics__c[] op=null;
Set<Id> opIds = new Set<Id>();
public static boolean run = true;
if(run)
{

   run=false;
for (Operational_Metrics__c e : Trigger.new)
{
     if(e.Unique_Pile_ID__c != null)
     opIds.add(e.Unique_Pile_ID__c );
}

  Map<Id, Operational_Metrics__c> y = new Map<Id, Operational_Metrics__c>([select Unique_Pile_ID__c,unique_id__C, Project__c,Composting_Method__c,Pile_Monitoring_Date__c,Average_Temperature__c,Moisture_Test__c,Pile_Monitoring_Action_Taken__c,Other_Action__c,Pile_Input_Register_Date__c,Total_Waste_Input_on_the_Pile__c,Pile_Completion_Stage__c,Date_Pile_COmpleted__c,Curing_Batch_Register_Date__c,No_of_Days__c  from operational_metrics__c where Unique_Pile_ID__c in :opIds]);
for (Operational_Metrics__c oc : [select Unique_Pile_ID__c,unique_id__C, Project__c,Composting_Method__c,Pile_Monitoring_Date__c,Average_Temperature__c,Moisture_Test__c,Pile_Monitoring_Action_Taken__c,Other_Action__c,Pile_Input_Register_Date__c,Total_Waste_Input_on_the_Pile__c,Pile_Completion_Stage__c,Date_Pile_COmpleted__c,Curing_Batch_Register_Date__c,No_of_Days__c  from operational_metrics__c where Unique_Pile_ID__c in :opIds])
{
      System.debug('oc '+y.get(oc.Unique_Pile_ID__c));
}


}
}

but when i am saving a records it is throwing execution of BeforeUpdate caused by: System.StringException: Invalid id: 10-Ber1: External entry point here 10-Ber1 is the unique_pile_id__c could any one help me out
Hi,
I am trying to login as customer user through Connect Api to create a feedItem in a community but it is throwing exception as
exceptionCode='INVALID_LOGIN'
exceptionMessage='Invalid username, password, security token; or user locked out.'

I am using AuthEndPoint as "http://ip:port/services/Soap/c/32.0" in Enterprise Connection & then after I want to create the feedItem through Api only.

Moreover in SOAP Api, How can I create feedItem as customer & partner user in the community after login?


Hi,

Cannot able to access button which is executing webservices with namespace - It becomes javascript error in IE9 but works in other browsers.

Code Line where i am getting error :  Namespace.webserviceClassname(params,params,etc.,);

Error I got: Onclick Javascript Error , Unable to get value of the property 'execute': object is null or undefined

Thanks in Advance
Hi ,


I am trying to connect salesforce to salesforc connection.Please help me.


Before I start doing anything I want to have some clarity on thw whole procedure
Following are the steps which I have in my mind.

1)I will start from trigger and in the trigger I am going to call the rest Api which i will develop in

another salesforce org and pass some paremeters to it.


I have some confusion about the redirect_uri paraemeter.I am not sure about it

What's gonna be the URI redirect_uri in my case.I have gone through the docs but still not sure.

Will redirect uri be the URL of source org from which I am calling the destination salesforce org Api's

Can somebody please explain?.I need to start soon as it is critical .Please help
Is it just me, or has Salesforce not released a stylesheet for Visualforce code developed for use with the Salesforce1 app?

I've looked through developer.force.com, and while I see lots of presentations with very simple demos Salesforce and others, and lots of third-party code (including components and stylesheets) in Github, I don't see anything that says, "if you're developing Visualforce that will be used in the Salesforce1 app, here is the stylesheet you should use."

I've seen the Heroku style guide, but that's general guidelines - it doesn't go the extra step of providing actual CSS styles.

I know there's more to developing VF for SF1 than just CSS styles, like components for page layouts (headers, footers, etc.), carousels, input fields, etc., and I've seen some managed packages containing these things that some third-parties have put together, but I don't see a set of standard VF for SF1 components.

Without this kind of standardization, isn't every app developed for SF1 going to look different - won't my org have apps with a mish-mash of styles?

If I'm building VF pages that will run in the SF1 app, what resources does Salesforce provide to ensure that my app appears somewhat consistent with the rest of the SF1 app and with VF pages developed by others?