• Rishav
  • SMARTIE
  • 1001 Points
  • Member since 2014
  • Salesforce Developer
  • Steadfast Technology Services

  • Chatter
    Feed
  • 29
    Best Answers
  • 2
    Likes Received
  • 11
    Likes Given
  • 30
    Questions
  • 244
    Replies

Hi All,

I have one JSON Data , i am serializing that data, but it is becoming NULL after deserialization.
I want to access the value form JSON data into the VF page. 

Here is my JSON Data: 

{  
   "mindTouchPage":{  
      "id":"1",
      "guid":"00000000000000000000000000000000",
      "draftstate":"inactive",
      "href":"https://steadfast-prod.mindtouch.us/@api/deki/pages/1?redirects=0",
      "deleted":"false",
      "datecreated":"Fri, 10 Jun 2016 20:30:17 GMT",
      "language":"en-US",
      "namespace":"main",
      "path":{  
         "seo":"true",
         "type1":"fixed",
         "text":""
      },
 
          
                        "subpages":{  
                           "mindTouchPage":[  
                              {  
                                 "id":"288",
                                 "guid":"a7afffb2634b453485bff59faed455f6",
                                 "draftstate":"inactive",
                                 "href":"https://steadfast-prod.mindtouch.us/@api/deki/pages/288?redirects=0",
                                 "deleted":"false",
                                 "datecreated":"Fri, 10 Jun 2016 21:33:04 GMT",
                                 "language":"en-US",
                                 "namespace":"main",
                                 "path":{  
                                    "seo":"true",
                                    "type1":"custom",
                                    "text":"The_MindTouch_Workbook/Chapter_I_-_Understand_users_&_groups/010_User_types_defined"
                                 },
                                 "subpages":"",
                                 "title":"1. User types defined",
                                 "uriui":"https://steadfast-prod.mindtouch.us/?title=The_MindTouch_Workbook/Chapter_I_-_Understand_users_%26_groups/010_User_types_defined"
                              },
                              {  
                                 "id":"289",
                                 "guid":"88eae1c3ae25449eb27a518bfabf51ae",
                                 "draftstate":"inactive",
                                 "href":"https://steadfast-prod.mindtouch.us/@api/deki/pages/289?redirects=0",
                                 "deleted":"false",
                                 "datecreated":"Fri, 10 Jun 2016 21:33:09 GMT",
                                 "language":"en-US",
                                 "namespace":"main",
                                 "path":{  
                                    "seo":"true",
                                    "type1":"custom",
                                    "text":"The_MindTouch_Workbook/Chapter_I_-_Understand_users_&_groups/011_Create_groups"
                                 },
                                 "subpages":"",
                                 "title":"2.  Create groups",
                                 "uriui":"https://steadfast-prod.mindtouch.us/?title=The_MindTouch_Workbook/Chapter_I_-_Understand_users_%26_groups/011_Create_groups"
                              },
                              {  
                                 "id":"290",
                                 "guid":"e6da4dab743846f3bef6cd2826964937",
                                 "draftstate":"inactive",
                                 "href":"https://steadfast-prod.mindtouch.us/@api/deki/pages/290?redirects=0",
                                 "deleted":"false",
                                 "datecreated":"Fri, 10 Jun 2016 21:33:20 GMT",
                                 "language":"en-US",
                                 "namespace":"main",
                                 "path":{  
                                    "seo":"true",
                                    "type1":"custom",
                                    "text":"The_MindTouch_Workbook/Chapter_I_-_Understand_users_&_groups/012_Create_users"
                                 },
                                 "subpages":"",
                                 "title":"3.  Create users",
                                 "uriui":"https://steadfast-prod.mindtouch.us/?title=The_MindTouch_Workbook/Chapter_I_-_Understand_users_%26_groups/012_Create_users"
                              }
                           ]
                        }

       }
	   
	}

Here is My Wrapper Class
public class JSON2Apex {
    public list<MindTouchPage> mindTouchData;
    public list<path> pathData;

	public class Path {
		public String seo;
		public String type1;
		public String text;
	}

	public class MindTouchPage {
		public String id;
		public String guid;
		public String draftstate;
		public String href;
		public String deleted;
		public String datecreated;
		public String language;
		public String namespace;
		public Path path;
		public Subpages subpages;
		public String title;
		public String uriui;
	}

	public class Subpages {
		public List<MindTouchPage> mindTouchPage;
	}

	public static JSON2Apex parse(String json) {
		return (JSON2Apex) System.JSON.deserialize(json, JSON2Apex.class);
	}
}

controller class
global with sharing class ViptelaCustLandingController {
    
   global static String responseData{get;set;}
    
   global static String status{get;set;}
   public boolean isUserAuthenticated{get;set;}
   Public Integer closeCaseCount{get;set;}
   public Integer openCaseCount{get;set;} 
   public JSON2Apex mindTouch{get;set;}
   
    public MindTouchDataWrapper wrapper {
        get;
        set;
    }
    
    // Constructor
    public ViptelaCustLandingController(){
     // Get the count of closed Cases
     closeCaseCount = [SELECT COUNT() FROM CASE WHERE status = 'closed'];
     openCaseCount = [SELECT COUNT() FROM CASE WHERE status !='closed'];  
    }
    
    // Code will invoke on pageLoad
    public pageReference redirectToCustomAuthPage(){
        if(UserInfo.getUserType()=='Guest'){
            return new pagereference ('/viptelaLoginController');
        }
        else{
            // status = 'User Authenticated';
            // Call the webService Function
           // getDataFromMindTouch();
             isUserAuthenticated = TRUE;
             getDataFromMindTouch();
                     
             return null;
        }
    }

    // WebService Method to Call the "MindTouch" API
  //  @future(callout = true)
        public void getDataFromMindTouch(){
            status = 'method Called';
            System.debug('WebService Method Called');
            // MindTouch User Name
            String userName = '**********';
            String password = '***********';
            String mindTouchURL = 'https://***************';
            
            
            //  Prepare the HTTP request and response
            HttpRequest req = new HttpRequest();
            HttpResponse res = new HttpResponse();
            Http http = new Http();
            
            // Construct Authorization and Content Header
           // Blob headerValue = Blob.valueOf(userName+':'+password);
              Blob headerValue = Blob.valueOf(username + ':' + password);
              String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
            
           // String authorizationHeader = 'Basic'+ EncodingUtil.base64Encode(headerValue);
           // req.setHeader('Authorization', 'Basic UmlzaGF2OlJpc2hAMTk5MSo=');
            req.setHeader('Authorization', authorizationHeader);
            req.setHeader('Content-Type','application/json');
            
            // Set Method,endpoint,and body
            req.setMethod('GET');
            req.setEndpoint(mindTouchURL);
            
            try{
                res = http.send(req);
                System.debug('Response is =======' + res.getBody());
                //responseData = res.toString();
                responseData =res.getBody();
                status = 'TRUE';
                System.debug('response data variable value is' +responseData );
                
                //**************************Added by V******************************************
                
                //To overcome the limitation of @ variable in response, it is converted to the SFDC acceptable form using replace keywork
                //and same is reference in the MindTouchWrapper Class
                responseData = responseData.replace('"page"', '"mindTouchPage"');
                responseData = responseData.replace('"@id":', '"id":');
                responseData = responseData.replace('"@guid":', '"guid":');
                responseData = responseData.replace('"@draft.state":', '"draftstate":');
                responseData = responseData.replace('"@href":', '"href":');
                responseData = responseData.replace('"@deleted":', '"deleted":');
                responseData = responseData.replace('"date.created":', '"datecreated":');
                responseData = responseData.replace('"@seo":', '"seo":');
                responseData = responseData.replace('"@type":', '"type1":');
                responseData = responseData.replace('"#text":', '"text":');
                responseData = responseData.replace('"uri.ui":', '"uriui":');
                
                System.debug('response2 data variable value is' +responseData);
                
                //Parse is the deserialize method in the MindTouchWrapper class
               // MindTouchWrapper mindTouch = MindTouchWrapper.parse(responseData); 
                  mindTouch = JSON2Apex.parse(responseData);
                
                System.debug('Deserialized data is '+mindTouch);
                
                 //*************************Added by V*******************************************
           
            }Catch(System.CalloutException e){
                System.debug('ERROR' +e);
                System.debug('Response is ' + res.getBody());
                 
            }
        }
  
}

VF Code to get Data
<apex:pageBlock >
                    <apex:pageBlockSection columns="2">
                         <apex:repeat value="{!mindTouch}" var="data">
                                  <apex:outputText value="{!data.id}"></apex:outputText>
                        </apex:repeat>  
                   </apex:pageBlockSection>
               </apex:pageBlock>

Please hlep me to show data from JSON into VF page.
 
hi,
Wil u help me what is MD5 alogorithm how it is implimented in salesforce why we have to go for that algorithm...
Hi,

I'm creating a Lightning component, and to farmiliarize myself with the process I followed the Salesforce Lightning component creation tutorial (https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/events_one_demo_load.htm). I followed the tutorial to the letter, and everything works fine until either of the .cmp files (one for contacts, one for contactList) change at all from the tutorial version. And I mean literally any change breaks the component. I'll open the component view on the Salesforce1 app, contacts are retrieved and listed properly, and then I make a change to contactList.cmp or contacts.cmp, be it a comment, a newline, anything, and the conacts won't load. For instance, editing a pre-existing comment in contactList.cmp like "<!-- Display the edit record page when the icon is clicked -->" and changing it to "<!-- Display the edit record page when an icon is clicked -->" breaks the entire component. No errors are thrown, but once contactList.cmp is saved the list is never displayed. I've tried relaunching the app and restarting the phone, both to no avail.
This problem has me banging my head against the wall. It's bizaree that a change in a comment could break the enitre componet. Is there some compile step I'm missing or something? Why would any change break functionality?

Thanks!
Hi All,

I have 3 picklist fields f1,f2,f3 which are dependent pciklist. f2 is dependent on f1 and f3 is dependent on f2. I want to display these 3 fields in a vf page.

Can anyone please share me some code.

Regards
Hi All,
I am trying to add the below new currency on manage currencies in Company profiles(Setup->Comapny profiles->Manage Currencies->New).
Currency Code- SKK
Currency Name - Slovak Koruna
But I can not find the SKK - Slovak Koruna in Currency Type.
Anybody help on this to add the new currency SKK.

Thanks in Advance.
Thanks,
Chandra
 
We are using third party web service in salesforce but our third party instance has self-signed certificate. I need to call soap web service of third party.
But when I am trying to call web service at that time I am receiving  below error
System.CalloutException: IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Please Provide me way to by pass this error.
Hello,

I am working on salesforce platform for 6 months.
I have cleared certif DEV 401 and mainly work on development part (visualforce + apex). I have also have backgroud of JAVA.

I a taking up a new opportunity in new company, so i want to increase my skills more.

I want to be know more about salesforce, majorityly admin and also imrove my development slkills a bit.
Devlopment skills cant be increased by reading. I auusme though.

can someone tell me about Study plan i should follow. I have 1.5 month, i ccan dedicate around 2 hours per day for the studying
We need to develop Message board like http://www.codeproject.com/ [^]
User can add article by selecting Category->sub-forums and then topics and other user can add post on it.
Hi All,

I have created Email Services to create case through email.

Issue I am facing is, from most of case's FRom address is coming right and for few Cases From Address coming as "noreply@salesforce.com"and From Name as "Salesforce Email Processor".

I also did setting for "noreply@salesforce.com" in Email Administration ---> Deliverability ---->Email Security Compliance ----> Enable Sender ID compliance ( checkbox = false ).

Please help to resolve this issue
I have created an custom component and I am integrate it with Lightning app builder but not able to add dynamic picklist values on app builder page for that component.
I have created a lightning app with a text box and list of contacts under it.As user types in the search string,List contents should be filtered.But I am receiving following error upon typing the search string-rerender threw an error in 'markup://aura:iteration' : Cannot read property 'childNodes' of null.I came across-"http://salesforce.stackexchange.com/questions/71604/lightning-bug-in-lightning-framework-when-using-aurarenderif" but not sure if it is the same reason for this behavior.Could anyone point out the error in my below code.

Component to display list of filtered contacts-ContactItemList.cmp
<aura:component controller="ContactItemListController" >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js" />    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />   
    <aura:handler event="c:PFAppEvent" action="{!c.doInit}"/>	
    <aura:attribute name="contacts" type="Contact[]"/>    
    
	<aura:iteration items="{!v.contacts}" var="p">
        <c:ContactItem fullName="{!p.Name}" accountName="{!p.Account.Name}" />        
    </aura:iteration> 
</aura:component>
Component to type in the search string-SearchComponent.cmp
<aura:component >
    <ltng:require styles="/resource/EquinixBootstrap/equinixbootstrap.css" scripts="/resource/Bootstrapjs/bootstrap.min.js,/resource/jQuery/jquery-1.11.3.min.js" afterScriptsLoaded="{!c.loadJQuery}"/>    
    <aura:registerEvent name="PFAppEvent" type="c:PFAppEvent"/>
    
    <input type="text" style="width:100%;" class="form-control" placeholder="Name or Username" id="searchBox" />
</aura:component>
Helper method to call Server Side controller and fetch matching contacts-ContactItemListHelper.js
({
 	getContacts: function(component,event) {
      
        var action = component.get("c.getContacts");
        var searchString;
        if(typeof event != 'undefined'){
   			searchString=event.getParam("searchString");
        }else{
            searchString='';
        }
        console.log('Contact List Item:'+searchString);
        action.setParams({
			"searchString": searchString
		});
        action.setCallback(this, function(a) {
            component.set("v.contacts", a.getReturnValue());
        });
        $A.enqueueAction(action);
    }    
})
Listener to Search Component-SearchComponentController.js
({
	loadJQuery: function(component, event, helper) {
        console.log('I am loaded');
        var lastValue = '';
		setInterval(function() {
    		if ($("#searchBox").val() != lastValue) {
	        	lastValue = $("#searchBox").val();
                console.log('New Value:'+lastValue);
		        var appEvent = $A.get("e.c:PFAppEvent");
		        appEvent.setParams({ "searchString" : lastValue });
		        appEvent.fire();                
	    	}
		}, 1500);        
	}

})

 
Here is my code below:

<ul id="insideScroller" class="scrollable-menu scrollbar list-group" style="-webkit-overflow-scrolling: touch;" >
<aura:iteration var="sobj" items="{!v.SobjectRecords}">
<!-- Navigation to record detail page works only SF1-->
<li class="list-group-item" id="{!sobj.SId}" onclick="{!c.navigateToRecord}" >
<aura:renderIf isTrue="{!0 lt v.fieldsToDisplayCount}"> {!v.lstFldDisp[0]} : {!sobj.f1}<br/>
</aura:renderIf>
<aura:renderIf isTrue="{!1 lt v.fieldsToDisplayCount}"> {!v.lstFldDisp[1]} : {!sobj.f2}<br/>
</aura:renderIf>
<aura:renderIf isTrue="{!2 lt v.fieldsToDisplayCount}"> {!v.lstFldDisp[2]} : {!sobj.f3}<br/>
</aura:renderIf> </li>
</aura:iteration>
</ul>
I am using bootstrapcss in which I am able to see scrollbar in SF1 and even on the desktop.But when I load the same page in mobile the scrollbar disappears.

Any workarounds over this?
I want to deploy application on app exchange to developer edition.
please tell me the process of application deployment on app exchange.
I have custom object expense__c and my Lightning namespace is LightningSF1. I want to create a page there I should display Expense object fields.
        There I have created one picklist field and one lookup field but that I don't know how to give those fields for that in component.

THIS IS MY COMPONENT CODE:-

<aura:component >
    <link href='/resource/Boot1' rel="stylesheet"/> 
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="newExpense" type="LightningSF1.Expense__c"
                    default="{ 'sobjectType': 'LightningSF1__Expense__c',
                             'Name': '',
                             'LightningSF1__Amount__c': 0,
                             'LightningSF1__Client__c': '',
                             'LightningSF1__Date__c': '',
                             'LightningSF1__Reimbursed__c': false
                             }"/>
    <div class="row " style="background-color:blue !important;">
        <div  style="text-align:center;font-weight:bold;color:white;">
            Outlet Information
        </div>
    </div>
    <br/>
    <div class="container">
        <div class="row" >
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4" >Expense Name</label>
                    <span class="col-sm-8">
                        <ui:inputText aura:id="expname"
                                      class="form-control"
                                      value="{!v.newExpense.Name}"
                                      placeholder="My Expense" required="true" />
                    </span>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4">Amount</label>
                    <span class="col-sm-8"> 
                        <ui:inputNumber aura:id="amount"
                                        class="form-control"
                                        value="{!v.newExpense.LightningSF1__Amount__c}"
                                        placeholder="20.80" required="true"/>
                    </span>
                </div>
            </div>
            
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4">Client</label>
                    <span class="col-sm-8">
                        <ui:inputText aura:id="client" 
                                      class="form-control"
                                      value="{!v.newExpense.LightningSF1__Client__c}"
                                      placeholder="ABC Co."/>
                    </span>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4">Expense Date</label >
                    <span class="col-sm-8">
                        <ui:inputDateTime aura:id="expdate" 
                                          class="form-control"
                                          value="{!v.newExpense.LightningSF1__Date__c}"/>
                    </span>
                </div>
            </div>
            <div class="col-sm-12">
                <div class="col-sm-6">
                    <label class="col-sm-4">Country</label>
                    <span class="col-sm-8">
                        <ui:outputText aura:id="country" 
                                      class="form-control"
                                      value="{!v.newExpense.LightningSF1__Country__c}"/>
                    </span>
                </div>
                <div class="col-sm-6">
                    <label class="col-sm-4">Types</label >
                    <span class="col-sm-8">
                      <!-- <aura:attribute name="Name" type="String" /> -->
                    </span>
                </div>
            </div>
        </div>
    </div>
   <div class="col-sm-12">
       <span class="col-sm-6">
    <ui:button label="Submit" press="{!c.createExpense}"/>
       </span>
 <span class="col-sm-6">
     <ui:button label="Cancel" press="{!c.createExpense}"/>
       </span>
    </div>
</aura:component>

Here country is loookup field I want to show on page but fieldset tag
<ui:____for lookup I don't know like we know that tag for inout field is <ui:inputText> same way can anyone tell me tag for Lookup and picklist field...
String queryString = 
                'SELECT Id  'FROM Account ' +
                'WHERE DISTANCE(GeoLocation__c, GEOLOCATION('+lat1+','+lon1+'), \'mi\') < ' + Integer.valueOf(SelectedWithin) ;

Here lat1, lon1, selectedWithin are the variables.

Can you help me in converting this dynamic query into direct query?
Hi All,

I have created a lightning component with the help of some online tutorials, but i dont know how to see the output of that component. Can any one please guide me how to check the output of lightning compoent and also how to debug ligntning components.

Thanks