• GauravG
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 8
    Replies
Hello I am using below code to generate JSON and consuming the JSON data to reterive values and render on Visualforce page but it is showing nothing.

VisualForce to Print JSON
-----------------------------
<apex:page contentType="text/html" standardStylesheets="false" controller="P_GenerateJSONString" sidebar="false" showHeader="false" >
    <apex:outputText value="{!lstAccountsJSONString}" ></apex:outputText>
</apex:page>

Controller to Generate JSON
-----------------------------
public with sharing class P_GenerateJSONString {
    List<Account> lstAccounts {get;set;}
    public String lstAccountsJSONString {get;set;}
    
    public P_GenerateJSONString() {
        lstAccounts = [SELECT id, name FROM Account LIMIT 1];    
        printJSON();
    }
    
    public String printJSON() {
        lstAccountsJSONString = JSON.serializePretty(lstAccounts);
        return lstAccountsJSONString;
        
    }
}

VisualForce Page Consume JSON Data
----------------------------------------
<apex:page >
    <script>
        <apex:includeScript value="{!$Resource.AngularJS}"/>
            var app = angular.module('myApp',[]);            
            app.controller("customersController", function($scope,$http) {
                   $http.get("http://www.w3schools.com/website/Customers_JSON.php").success(function(response) {$scope.names = response;});                   
            });
    </script>
    <body ng-app="myApp" > 
    <div ng-controller="customersController">
        <ul>
            <li ng-repeat="acct in names">                                         
                {{acct.City}}
            </li>
          </ul>
    </div>
    </body>
</apex:page>

Please suggest what is wrong.

Thanks
I am using Eclipse Juno(4.2) and trying to install Force.com IDE ver 30, however eclipse could not find this from below link:
           http://media.developerforce.com/force-ide/eclipse42
There is no proxy server settings on my computer. I have tried the same force.com ide ver 30 on Eclipse Indigo and it is giving the same issue. Force.com IDE Version 28 is working fine using http://www.adnsandbox.com/tools/ide/install/ link.

Please suggest.

Thanks
Gaurav
 
Hello
I am running a test class on apex class and inserting a record. I am getting error while inserting a record. Below SOQL in Apex class is not returning any row and due to this test is returning null object error. Although I have records in my contact object.
Map<Id, Contact> contUpd = new Map<Id, Contact>([SELECT Id, otherstreet
                                                                        FROM Contact
                                                                        WHERE Id = : setOfCont]);

Please suggest.

Thank you
trigger DuplicateService on Site__c (before insert) {
    for(Site B : Trigger.New) {
        try {
            Integer i = [SELECT count() FROM Site WHERE Account__c = :B.Account__c AND RecordTypeId = :B.RecordTypeId];

            if (i > 0) {
            String RT = [SELECT Name FROM RecordType WHERE Id = :B.RecordTypeId].Name;
            String TS = [SELECT Name FROM Site__c WHERE Account__c = :B.Account__c AND RecordTypeId = :B.RecordTypeId].Name;
               B.addError('Already existing ' + RT + ': <<<' + TS + '>>>, !!');
            }
        }
        catch (DmlException e) {
            System.debug('Trigger DuplicateService: ' + e.getMessage());
        }
    }
}

 
Hi All
I have Proposal ( fields P1,P2,P3... Pn) & System Product (S1, S2,.. Sn)  two custom objects with Master Detail Relationship with Accounts. I need to access some of the fields between these two custom objects. How can I do this.

Since Proposal & System Products are childs to Accounts, I cannot create lookup between these two.
Is there any way to access fields or any sample code could help me a lot.


Thank you
Hi, 
I am created a datatable on VF page which displays the subjects of a custom object instances.
I want to display the body of the instance  on a small pop up window when the mouse hover on a specific row. 

What are the basic steps to realize this or can I get some sample code on this ?

Thanks in advance!
I want to put condition to calculatre amount in Last 12 months. How to  write this  condition in formulae.
  • September 26, 2014
  • Like
  • 0
where from can we create joined reports ,

in the create report i could find only tabular , matrix and summary format.
but i couldnt find joined  table option.
also the documentation available   on the blog/post about joined report is of the older version and  the everying about reports is changed now in the new updation
Currently the field is displayed as Number.  We want the amount to be displayed in USD or any other currency on the deal. Below is the Nubmer formula


IF(OM_R1_Work_Hours__c <> 0, OM_R1_Services_Revenue__c / OM_R1_Work_Hours__c, 0)
I looked at the other posts with a similar issue and didn't find what looked like my problem there. 

I have a user-driven SOQL query, and now that I've loaded a larger data set in the App (via dataloader.io, FYI) I'm seeing this problem whenever i run a query.

Help!
Hi.

I have a custom object (TargetX_SRMb__Application__c) It has a relationship to Contact defined in WSDL by:

  <complexType name="TargetX_SRMb__Application__c">
                <complexContent>
                    <extension base="ens:sObject">

...
                       <element name="TargetX_SRMb__Contact__c" nillable="true" minOccurs="0" type="tns:ID"/>
                        <element name="TargetX_SRMb__Contact__r" nillable="true" minOccurs="0" type="ens:Contact"/>

However, when I run SOQL test as:

 Contact contact = [SELECT  c.Id, c.lastName, (Select CreatedDate  FROM TargetX_SRMb__Contact__r) FROM Contact c]

I get error:

Error: Compile Error: Didn't understand relationship 'TargetX_SRMb__Contact__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name

I also tries adding a "s" as follows: Same error.

 Contact contact = [SELECT  c.Id, c.lastName, (Select CreatedDate  FROM TargetX_SRMb__Contacts__r) FROM Contact c]

 Is this not the correct syntax to query child records from a custom object?

Thanks in advance,

Jon
Hi,

I want to access SQL with commandline data loader, Can any one help me out the process of doing it.


Thanks,
Ra.
  • December 31, 2014
  • Like
  • 1