• kumar_arun
  • NEWBIE
  • 15 Points
  • Member since 2016
  • Salesforce Developer
  • Astrea IT Services


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 17
    Replies
User-added image

I have a requirement in which need to get the notifications (as mentioned in the screenshot above) records. Can we get the notification records using SOQL query? or Can we create the reports on this?

 Any help or ideas are much appreciated. Thanks!
 
Hi All,

I am getting 'System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set ' exception while parsing json, Please help

Thanks.
public class JSONWrapper{
   
    public cls_result[] result{get;set;}
    class cls_result {
        public String parent{get;set;}   //
        public String made_sla{get;set;} //true
        public String caused_by{get;set;}    //
        public String watch_list{get;set;}   //
        public String upon_reject{get;set;}  //cancel
        public String sys_updated_on{get;set;}   //2017-06-20 07:52:14
        public String child_incidents{get;set;}  //0
        public String hold_reason{get;set;}  //
        public String approval_history{get;set;} //
        public String number1{get;set;}   //5002800000m9AD4AAM
        public String resolved_by{get;set;}  //
        public String sys_updated_by{get;set;}   //admin
        public cls_opened_by opened_by{get;set;}
        public String user_input{get;set;}   //
        public String sys_created_on{get;set;}   //2017-06-20 07:52:14
        public cls_sys_domain sys_domain{get;set;}
        public String state{get;set;}    //1
        public String sys_created_by{get;set;}   //admin
        public String knowledge{get;set;}    //false
        public String order{get;set;}    //
        public String calendar_stc{get;set;} //
        public String closed_at{get;set;}    //
        public String cmdb_ci{get;set;}  //
        public String delivery_plan{get;set;}    //
        public String impact{get;set;}   //3
        public String active{get;set;}   //true
        public String work_notes_list{get;set;}  //
        public String business_service{get;set;} //
        public String priority{get;set;} //5
        public String sys_domain_path{get;set;}  ///
        public String rfc{get;set;}  //
        public String time_worked{get;set;}  //
        public String expected_start{get;set;}   //
        public String opened_at{get;set;}    //2017-06-20 07:52:14
        public String business_duration{get;set;}    //
        public String group_list{get;set;}   //
        public String work_end{get;set;} //
        public cls_caller_id caller_id{get;set;}
        public String resolved_at{get;set;}  //
        public String approval_set{get;set;} //
        public String subcategory{get;set;}  //
        public String work_notes{get;set;}   //
        public String short_description{get;set;}    //This is test incident created from salesforce CRM
        public String close_code{get;set;}   //
        public String correlation_display{get;set;}  //
        public String delivery_task{get;set;}    //
        public String work_start{get;set;}   //
        public String assignment_group{get;set;} //
        public String additional_assignee_list{get;set;} //
        public String business_stc{get;set;} //
        public String description{get;set;}  //
        public String calendar_duration{get;set;}    //
        public String close_notes{get;set;}  //
        public String notify{get;set;}   //1
        public String sys_class_name{get;set;}   //incident
        public String closed_by{get;set;}    //
        public String follow_up{get;set;}    //
        public String parent_incident{get;set;}  //
        public String sys_id{get;set;}   //b2472d10db23320085fe72ffbf961960
        public String contact_type{get;set;} //
        public String incident_state{get;set;}   //1
        public String urgency{get;set;}  //3
        public String problem_id{get;set;}   //
        public cls_company company{get;set;}
        public String reassignment_count{get;set;}   //0
        public String activity_due{get;set;} //
        public String assigned_to{get;set;}  //
        public String severity{get;set;} //3
        public String comments{get;set;} //
        public String approval{get;set;} //not requested
        public String sla_due{get;set;}  //
        public String comments_and_work_notes{get;set;}  //
        public String due_date{get;set;} //
        public String sys_mod_count{get;set;}    //0
        public String reopen_count{get;set;} //0
        public String sys_tags{get;set;} //
        public String escalation{get;set;}   //0
        public String upon_approval{get;set;}    //proceed
        public String correlation_id{get;set;}   //
        public String location{get;set;} //
        public String category{get;set;} //inquiry
    }
    class cls_opened_by {
        public String link{get;set;} 
        public String value{get;set;}  
    }
    class cls_sys_domain {
        public String link{get;set;} 
        public String value{get;set;}    
    }
    class cls_caller_id {
        public String link{get;set;} 
        public String value{get;set;}   
    }
    class cls_company {
        public String link{get;set;} 
        public String value{get;set;}    
    }
    public List<JSONWrapper> parse(String json){
        return (List<JSONWrapper>) System.JSON.deserialize(json, List<JSONWrapper>.class);
        
        
    }

    
}
 
public class ServiceNowCntrl {
    
    public string bodyText{get;set;}
    public ServiceNowCntrl (){
    doInit();
    }
    public void doInit(){
           
        try{
        
        string user='xxx';
        
        string password='xxxxxxxx';
        
        HttpRequest request = new HttpRequest();

        request.setEndpoint('https://dev18687.service-now.com/api/now/table/incident?sysparm_limit=10');

        Blob auth = Blob.valueOf(user+':'+password);

        System.debug('Auth: '+ auth);

        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(auth);
        
        request.setMethod('GET');
 
        request.setHeader('Authorization', authorizationHeader);
       
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        
            Http http = new Http();
            HttpResponse res = new HttpResponse();

            res = http.send(request);
            system.debug(res.getBody());
            bodyText=res.getBody();
            
           JSONWrapper jw=new JSONWrapper();
           list<JSONWrapper> jwList=new List<JSONWrapper>();
           jwList=jw.parse(bodyText);

        }catch(System.CalloutException e){
            System.debug('Erro: '+ e.getMessage());
        }
        
    }
    
}

 
How can we count total no. of sharingRules in a salesforce org?.
Hi everyone,
I want to get all sobject records of salesforce org, we can view this on -Data Management-->Storage Usage, but how can i get all sobject record count using Apex. If you have any solution, please let me know.
Hi, everyone
I want to get All Layout of a salesforce org, In that, i also need to get all objects count on which these "Layout". I am using Tooling API to get all "Layout", I get all layout and its count but i am not getting Object Name on which these layout. When i query "fullName" then getting error: -

 [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2083828647-227657 (1162229940)","errorCode":"UNKNOWN_EXCEPTION"}] .

please help.
 
public with sharing class LayoutMetadataCntrl {

    public list<string> LayoutName{get;set;}
    public string TotalLayout{get;set;}
    public LayoutMetadataCntrl (){
        LayoutName=new list<string>();
        TotalLayout='';
        
    }
    public void PageLayout(){
        
         HttpRequest req=new HttpRequest();
        req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID());
        req.setHeader('content-Type','application/json');
        string domainUrl=URL.getSalesforceBaseUrl().toExternalForm();
        req.setEndpoint(domainUrl+'/services/data/v33.0/tooling/query/?q=Select+id,name,createdDate,fullName+from+Layout');
        req.setMethod('GET');
        Http h=new Http();
        HttpResponse res=h.send(req);
        system.debug(res.getBody());
        
         if(res.getStatusCode()==200){
        
            JsonParser parser=JSON.createParser(res.getBody());
            while(parser.nextToken() !=null){
                if((parser.getCurrentToken()==JSONToken.FIELD_NAME)&& (parser.getText()=='Name')){
                    parser.nextValue();
                    LayoutName.add(parser.getText());
                }
                if((parser.getCurrentToken()==JSONToken.FIELD_NAME)&&(parser.getText()=='Size')){
                parser.nextValue();
                TotalLayout=parser.getText();
                }
             }
           }
    
    }
}

 
JSON STRING:

{"size":21,"totalSize":21,"done":true,"queryLocator":null,"entityTypeName":"ValidationRule","records":[{"attributes":{"type":"ValidationRule","url":"/services/data/v33.0/tooling/sobjects/ValidationRule/03d2800000083bXAAQ"},"Id":"03d2800000083bXAAQ","FullName":"SmartvCard__Note__c.SmartvCard__Not_new","CreatedDate":"2016-11-30T19:36:50.000+0000","TableEnumOrId":"01I280000022PApEAM","ValidationName":"Not_new","Metadata":{"description":null,"errorConditionFormula":"SmartvCard__Validation_Record__c = True","errorDisplayField":null,"errorMessage":"vCard Note record already exists. There can be only one vCard Note Record.","urls":null,"active":true}}]}
APEX:

JSONParser parser = JSON.createParser(response.getBody());
       List<String> fullName= new List<string>();
       List<string> Tot_size=new list<string>();
       List<string> metaData=new list<string>();
       while (parser.nextToken() != null) {
           if( (parser.getCurrentToken() == JSONToken.FIELD_NAME) && ( parser.getText() == 'FullName') ){
           parser.nextValue();
           fullName.add(parser.getText());
           
           }
           if( (parser.getCurrentToken() == JSONToken.FIELD_NAME) && ( parser.getText() == 'Size') ){
           parser.nextValue();
           Tot_size.add(parser.getText());
            system.debug('====================='+ parser.nextValue());
           }
            if( (parser.getCurrentToken() == JSONToken.FIELD_NAME) && ( parser.getText() == 'Metadata') ){
           parser.nextValue();
           metaData.add(parser.getText());
           system.debug(metaData);
           }
          
           
          }
        }

 i want to get values from "Metadata" object in the json string. I easy get "FullName", "Size" but when I am parsing Metadata , it only return "{" in list<string> MetaData. How can i get "active":values in this list.

Thanks
 
Hi Everyone, I have a requirement like this- Need to count sObject in org, which is used (LastModified)  3 months before, Can we do that using Apex, I need for All sObject. Please suggest me some way so that I can achieve this.
Hi All, I want to use LEFT() inside lightning component, so that I can get first letter of string. e.g- " let's say string is Salesforce  then i need letter S, I used this function in visualforce page like this, LEFT(Salesforce,1) . It works fine, And now i want to use this in to Lightning component. When i used this in my component it showing error!.
Hi, I am new in Apex , please let me know where is the problem in this code. code does not have compile time error. when i trying to save record then it show the error "System.NullPointerException: Attempt to de-reference a null object: Class.OpportunityUtil.createDefaultProduct: line 28, column 1" . Please Help
User-added image
Thanks.
 
public class OpportunityUtil {
    
public static void assignPriceBook(Opportunity[] scope) {
    
        Pricebook2 pb = [SELECT Id FROM Pricebook2 WHERE Name = 'Standard'];
    for(Opportunity record:scope){
   		 record.Pricebook2Id = pb.Id;
    
    }
}
    public static void createDefaultProduct(Opportunity[] scope) {
        map<string, pricebookentry> pbs = new map<string, pricebookentry>();
pricebook2 pb = [select id from pricebook2 where name = 'Standard'];
 opportunitylineitem[] oli = new opportunitylineitem[0];

        for(Opportunity record:scope){
    pbs.put(record.name, null); // or however we are determining the product.
        }
// Find relevant entries
for(PricebookEntry record:[select id,unitprice,product2id,product2.name from pricebookentry where product2.name in :pbs.keyset() and pricebook2id = :pb.id])
{
    pbs.put(record.product2.name, record);
}
       
        for(Opportunity record:scope){
    oli.add(new opportunitylineitem(
        opportunityid = record.id,
        unitprice = pbs.get(record.name).unitprice,
        quantity = 1,     
        pricebookentryid = pbs.get(record.name).id));
        }
insert oli;
    }
}
 
trigger CreateOpportunityLineItem on Opportunity (before insert,after insert) {
    if(Trigger.isbefore)
        opportunityUtil.assignPriceBook(Trigger.new);
    if(Trigger.isafter)
        opportunityUtil.createDefaultProduct(Trigger.new);
}

 
I want to show formula field that is in Lead Object,And this formula field contains Image. when i call this field in component in OutputText it show url of Image. please help me. I don't know how to use OUTPUTRICHTEXT
Component:

<aura:component controller="LeadLightningContoller">
	 <ltng:require styles="/resource/SLDS103/assets/styles/salesforce-lightning-design-system.min.css"/>
    <aura:attribute name="Leads" type="Lead[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

 <aura:iteration items="{!v.Leads}" var="lead">

 <ui:outputText value="{!lead.Rating_Image__c}"/>

 </aura:iteration>
 
helper Class

({
	getLeadList : function(component) {
        
        var action=component.get("c.ShowLead");
        action.setCallback(this,function(res){
           
            var status=res.getState();
            if(status=="SUCCESS"){
                component.set("v.Leads",res.getReturnValue());
            }
        });
		$A.enqueueAction(action);
	}
})
Controller


public class LeadLightningContoller {
    
    @AuraEnabled
    public static List<Lead> ShowLead(){
        
        List<Lead> leadList=new List<Lead>();
        
        leadList=[select Name,Email,Status,Phone,No_of_days_Open__c,Rating,Fax,Rating_Image__c from Lead limit 10];
        return leadList;
       
    }

}
Application

<aura:application >
  <c:LeadData />
</aura:application>

 
Hi,All
How to Show account details based on it's rating (HOT,COLD,WARM) that is checkbox.
User-added image

I have a requirement in which need to get the notifications (as mentioned in the screenshot above) records. Can we get the notification records using SOQL query? or Can we create the reports on this?

 Any help or ideas are much appreciated. Thanks!
 
searchAccountHelper.js
({
    SearchHelper: function(component, event) {
        var action = component.get("c.fetchAccount");
        action.setParams({
            'searchKeyWord': component.get("v.searchKeyword")
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {
                var storeResponse = response.getReturnValue();
                // if storeResponse size is 0 ,display no record found message on screen.
                if (storeResponse.length == 0) {
                    component.set("v.Message", true);
                } else {
                    component.set("v.Message", false);
                }
                // set numberOfRecord attribute value with length of return value from server
                component.set("v.numberOfRecord", storeResponse.length);
                // set searchResult list with return value from server.
                component.set("v.searchResult", storeResponse);
            }
 
        });
        $A.enqueueAction(action);
 
    },
})
=====================================================================================
searchAccountcontroller.js
({
    Search: function(component, event, helper) {
        var searchKeyFld = component.find("searchId");
        var srcValue = searchKeyFld.get("v.value");
        if (srcValue == '' || srcValue == null) {
            // display error message if input value is blank or null
            searchKeyFld.set("v.errors", [{
                message: "Enter Search Keyword."
            }]);
        } else {
            searchKeyFld.set("v.errors", null);
            // call helper method
            helper.SearchHelper(component, event);
        }
    },
})
=================================================================================
searchAccount1.cmp
<aura:component controller="searchAccountController">   
   <!--### declared attributes ###-->
   <aura:attribute name="searchResult" type="List" description="use for store and display account list return from server"/>
   <aura:attribute name="searchKeyword" type="String" description="use for store user search input"/>
   <aura:attribute name="Message" type="boolean" default="false" description="use for display no record found message"/>
   <aura:attribute name="numberOfRecord" type="integer" default="0" description="use for display Number of records"/>
   <div class="slds-m-around--large">
      <form class="slds-form--inline">
         <div class="slds-form-element">
            <label class="slds-form-element__label" for="search"></label>
            <div class="slds-form-element__control">
               <ui:inputText aura:id="searchId" class="slds-input" value="{!v.searchKeyword}" required="true" placeholder="Type here..."/>
            </div>
         </div>
         <div class="slds-form-element">
            <button type="button" onclick="{!c.Search}" class="slds-button slds-button--brand">Search</button>
         </div>
      </form>
      <span class="slds-badge">{!v.numberOfRecord}</span>
      <table class="slds-table slds-table--bordered slds-table--cell-buffer">
         <thead>
            <tr class="slds-text-title--caps">
               <th scope="col">
                  <div class="slds-truncate" title="Id">Id</div>
               </th>
               <th scope="col">
                  <div class="slds-truncate" title="Account Name">Account Name</div>
               </th>
               <th scope="col">
                  <div class="slds-truncate" title="Type">Type</div>
               </th>
               <th scope="col">
                  <div class="slds-truncate" title="Industry">Industry</div>
               </th>
               <th scope="col">
                  <div class="slds-truncate" title="Phone">Phone</div>
               </th>
               <th scope="col">
                  <div class="slds-truncate" title="Fax">Fax</div>
               </th>
            </tr>
         </thead>
         <tbody>
            <aura:if isTrue="{!v.Message}">
               <div class="slds-text-color--error"> No Result Found...</div>
            </aura:if>
            <!--### display all records of searchResult attribute by aura:iteration ###-->
            <aura:iteration items="{!v.searchResult}" var="acc">
               <tr>
                  <td>
                     <div class="slds-truncate">{!acc.Id}</div>
                  </td>
                  <td>
                     <div class="slds-truncate">{!acc.Name}</div>
                  </td>
                  <td>
                     <div class="slds-truncate">{!acc.Type}</div>
                  </td>
                  <td>
                     <div class="slds-truncate">{!acc.Industry}</div>
                  </td>
                  <td>
                     <div class="slds-truncate">{!acc.Phone}</div>
                  </td>
                  <td>
                     <div class="slds-truncate">{!acc.Fax}</div>
                  </td>
               </tr>
            </aura:iteration>
         </tbody>
      </table>
   </div>
</aura:component>
=======================================================================================================
searchAccountcontroller.apxc
public with sharing class searchAccountController {
 
 @AuraEnabled
 public static List < account > fetchAccount(String searchKeyWord) {
  String searchKey = searchKeyWord + '%';
  List < Account > returnList = new List < Account > ();
  List < Account > lstOfAccount = [select id, Name, Type, Industry, Phone, Fax from account where Name LIKE: searchKey];
 
  for (Account acc: lstOfAccount) {
   returnList.add(acc);
  }
  return returnList;
 }
}
Please solve this error

Thanks
Manish
Hi Board. Has anyone had any success completing the Lightning Component Basics - Attributes & Expressions module?   I attempted the challenge using the Trailhead playground. And think what I did is correct. Yet I get the following error... 

"Challenge Not yet complete... here's what's wrong: The Quantity field is not using the correct output component."

Following is the component I have written:

Component Bundle Name : "campingListItem"
<aura:component >
    
    <aura:attribute name="item" type="Camping_Item__c" required="True"/>
    
    <ui:outputText value="{!item.Name}"/>
    <ui:outputCurrency value="{!item.Price__c}"/>
    <ui:outputNumber value="{!item.Quantity__c}"/>
    <ui:outputCheckbox value="{!item.Packed__c}"/>
	
</aura:component>

User-added image

Object schema is :   Name - Text (80),  Packed__c - Checkbox,  Price__c - Currency (16,2), Quantity__c - Number (18,0).

What could I be doing wrong. Any advice?

 
I have a custom app that I uploaded as a static resource. I have tested that it works if I navigate directly to it. 
The problem is when I use that URL in a lightning container in a component. When I checked network traffic, I found that
  1. instead of https://my-dev-ed.lightning.force.com/resource/myapp/default.html there is a request to https://my-dev-ed--c.container.lightning.com/lcc/myapp/default.html
  2. The response to this request is 403 Forbidden
I truly appreciate your help.
Hello All,

<!-- NewAccount -->
<aura:component implements="force:appHostable" controller="AccountController">
    <aura:attribute name="newAccount" type="Account" default="{ 'sobjectType': 'Account', 'Name': '', }" access="public"/>
    <div >
        <center>
            <form>
                Name <force:inputField aura:id="Name" value="{!v.newAccount.Name}"/>
                Note <force:inputField aura:id="Note" value="{!v.newAccount.Description}"/>
                Categories<force:inputField aura:id="Categories" value="{!v.newAccount.Categories_del__c}"/>
                SubCategories<force:inputField aura:id="SubCategories" value="{!v.newAccount.Sub_Categories__c    }"/>
                Assign to<force:inputField aura:id="Assign To " value="{!v.newAccount.Assigned_To__c}"/>
                Billing Street <force:inputField aura:id="Street " value="{!v.newAccount.BillingStreet}"/>
                Billing City <force:inputField aura:id="City " value="{!v.newAccount.BillingCity}"/>
                Billing State <force:inputField aura:id="State " value="{!v.newAccount.BillingState}"/>
                Billing Country <force:inputField aura:id="Country " value="{!v.newAccount.BillingCountry}"/>
                Billing Postal Code<force:inputField aura:id="Postal Code " value="{!v.newAccount.BillingPostalCode}"/>
                <lightning:button label="Save" onclick="{!c.createAccount}" />
                
            </form>
        </center>
    </div>
</aura:component>



This is my sample code to save Account Record using Lightning Component. "Assign To"  is custom field of "User Lookup" ,  but it gives the following error. Check screen shot as well. I also enabled Lightning component checkbox.


"This page has an error. You might just need to refresh it.
Access Check Failed! AttributeSet.get(): attribute 'inContextOfRecordId' of component 'markup://c:NewAccount {3:0}' is not visible to 'markup://c:NewAccount {3:0}'.
Failing descriptor: {markup://c:NewAccount}"



User-added image
Hi All,

I am getting 'System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set ' exception while parsing json, Please help

Thanks.
public class JSONWrapper{
   
    public cls_result[] result{get;set;}
    class cls_result {
        public String parent{get;set;}   //
        public String made_sla{get;set;} //true
        public String caused_by{get;set;}    //
        public String watch_list{get;set;}   //
        public String upon_reject{get;set;}  //cancel
        public String sys_updated_on{get;set;}   //2017-06-20 07:52:14
        public String child_incidents{get;set;}  //0
        public String hold_reason{get;set;}  //
        public String approval_history{get;set;} //
        public String number1{get;set;}   //5002800000m9AD4AAM
        public String resolved_by{get;set;}  //
        public String sys_updated_by{get;set;}   //admin
        public cls_opened_by opened_by{get;set;}
        public String user_input{get;set;}   //
        public String sys_created_on{get;set;}   //2017-06-20 07:52:14
        public cls_sys_domain sys_domain{get;set;}
        public String state{get;set;}    //1
        public String sys_created_by{get;set;}   //admin
        public String knowledge{get;set;}    //false
        public String order{get;set;}    //
        public String calendar_stc{get;set;} //
        public String closed_at{get;set;}    //
        public String cmdb_ci{get;set;}  //
        public String delivery_plan{get;set;}    //
        public String impact{get;set;}   //3
        public String active{get;set;}   //true
        public String work_notes_list{get;set;}  //
        public String business_service{get;set;} //
        public String priority{get;set;} //5
        public String sys_domain_path{get;set;}  ///
        public String rfc{get;set;}  //
        public String time_worked{get;set;}  //
        public String expected_start{get;set;}   //
        public String opened_at{get;set;}    //2017-06-20 07:52:14
        public String business_duration{get;set;}    //
        public String group_list{get;set;}   //
        public String work_end{get;set;} //
        public cls_caller_id caller_id{get;set;}
        public String resolved_at{get;set;}  //
        public String approval_set{get;set;} //
        public String subcategory{get;set;}  //
        public String work_notes{get;set;}   //
        public String short_description{get;set;}    //This is test incident created from salesforce CRM
        public String close_code{get;set;}   //
        public String correlation_display{get;set;}  //
        public String delivery_task{get;set;}    //
        public String work_start{get;set;}   //
        public String assignment_group{get;set;} //
        public String additional_assignee_list{get;set;} //
        public String business_stc{get;set;} //
        public String description{get;set;}  //
        public String calendar_duration{get;set;}    //
        public String close_notes{get;set;}  //
        public String notify{get;set;}   //1
        public String sys_class_name{get;set;}   //incident
        public String closed_by{get;set;}    //
        public String follow_up{get;set;}    //
        public String parent_incident{get;set;}  //
        public String sys_id{get;set;}   //b2472d10db23320085fe72ffbf961960
        public String contact_type{get;set;} //
        public String incident_state{get;set;}   //1
        public String urgency{get;set;}  //3
        public String problem_id{get;set;}   //
        public cls_company company{get;set;}
        public String reassignment_count{get;set;}   //0
        public String activity_due{get;set;} //
        public String assigned_to{get;set;}  //
        public String severity{get;set;} //3
        public String comments{get;set;} //
        public String approval{get;set;} //not requested
        public String sla_due{get;set;}  //
        public String comments_and_work_notes{get;set;}  //
        public String due_date{get;set;} //
        public String sys_mod_count{get;set;}    //0
        public String reopen_count{get;set;} //0
        public String sys_tags{get;set;} //
        public String escalation{get;set;}   //0
        public String upon_approval{get;set;}    //proceed
        public String correlation_id{get;set;}   //
        public String location{get;set;} //
        public String category{get;set;} //inquiry
    }
    class cls_opened_by {
        public String link{get;set;} 
        public String value{get;set;}  
    }
    class cls_sys_domain {
        public String link{get;set;} 
        public String value{get;set;}    
    }
    class cls_caller_id {
        public String link{get;set;} 
        public String value{get;set;}   
    }
    class cls_company {
        public String link{get;set;} 
        public String value{get;set;}    
    }
    public List<JSONWrapper> parse(String json){
        return (List<JSONWrapper>) System.JSON.deserialize(json, List<JSONWrapper>.class);
        
        
    }

    
}
 
public class ServiceNowCntrl {
    
    public string bodyText{get;set;}
    public ServiceNowCntrl (){
    doInit();
    }
    public void doInit(){
           
        try{
        
        string user='xxx';
        
        string password='xxxxxxxx';
        
        HttpRequest request = new HttpRequest();

        request.setEndpoint('https://dev18687.service-now.com/api/now/table/incident?sysparm_limit=10');

        Blob auth = Blob.valueOf(user+':'+password);

        System.debug('Auth: '+ auth);

        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(auth);
        
        request.setMethod('GET');
 
        request.setHeader('Authorization', authorizationHeader);
       
        request.setHeader('Content-Type', 'application/json;charset=UTF-8');
        
            Http http = new Http();
            HttpResponse res = new HttpResponse();

            res = http.send(request);
            system.debug(res.getBody());
            bodyText=res.getBody();
            
           JSONWrapper jw=new JSONWrapper();
           list<JSONWrapper> jwList=new List<JSONWrapper>();
           jwList=jw.parse(bodyText);

        }catch(System.CalloutException e){
            System.debug('Erro: '+ e.getMessage());
        }
        
    }
    
}

 
How can we count total no. of sharingRules in a salesforce org?.
Hi everyone,
I want to get all sobject records of salesforce org, we can view this on -Data Management-->Storage Usage, but how can i get all sobject record count using Apex. If you have any solution, please let me know.
Hi All, I want to use LEFT() inside lightning component, so that I can get first letter of string. e.g- " let's say string is Salesforce  then i need letter S, I used this function in visualforce page like this, LEFT(Salesforce,1) . It works fine, And now i want to use this in to Lightning component. When i used this in my component it showing error!.
Hi All,

I have an requirement to override standard salesforce page with visualforce page in "New" button for opportunity ,it is working in salesforce classic as expected but the same is not working in lightning experience.can any one help me on this how to re-direct in lightning salesforce.
My code:
Page:
<apex:page standardController="Opportunity" extensions="MyController" action="{!redirect}"> </apex:page>

Controller:
public with sharing class MyController{

    public MyController(ApexPages.StandardController controller) {

    }

    public PageReference redirect() {
           PageReference pr = new PageReference('/006/e');
           
            pr.getParameters().put('retURL',ApexPages.currentPage().getparameters().get('retURL'));    
            pr.getParameters().put('ent',ApexPages.currentPage().getparameters().get('ent'));  
            pr.getParameters().put('nooverride','1');  
            pr.getParameters().put('opp3', 'Name_Opco_Product');
          
           return pr;
     
    }
}

Thanks in advance,
Krishna.
I want to integrate servicenow and salesforce. I am able to create the incident from salesforce from apex class. But I want to create the incident in servicenow when case is created in salesforce.
How this can be achieved?
I want to show formula field that is in Lead Object,And this formula field contains Image. when i call this field in component in OutputText it show url of Image. please help me. I don't know how to use OUTPUTRICHTEXT
Component:

<aura:component controller="LeadLightningContoller">
	 <ltng:require styles="/resource/SLDS103/assets/styles/salesforce-lightning-design-system.min.css"/>
    <aura:attribute name="Leads" type="Lead[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

 <aura:iteration items="{!v.Leads}" var="lead">

 <ui:outputText value="{!lead.Rating_Image__c}"/>

 </aura:iteration>
 
helper Class

({
	getLeadList : function(component) {
        
        var action=component.get("c.ShowLead");
        action.setCallback(this,function(res){
           
            var status=res.getState();
            if(status=="SUCCESS"){
                component.set("v.Leads",res.getReturnValue());
            }
        });
		$A.enqueueAction(action);
	}
})
Controller


public class LeadLightningContoller {
    
    @AuraEnabled
    public static List<Lead> ShowLead(){
        
        List<Lead> leadList=new List<Lead>();
        
        leadList=[select Name,Email,Status,Phone,No_of_days_Open__c,Rating,Fax,Rating_Image__c from Lead limit 10];
        return leadList;
       
    }

}
Application

<aura:application >
  <c:LeadData />
</aura:application>

 
Hi,All
How to Show account details based on it's rating (HOT,COLD,WARM) that is checkbox.

We would like to create a bar code of the case number. This would then go onto a PDF document that is generated via visualforce.  How do i generate the code to produce the barcode with visualforce and an Apex controller?   Any help or suggestions would be appreciated. 

In several projects, in several orgs, I've scheduled some Batch Apex jobs to run nightly to process large numbers of records. I've run into a couple of problems that are leaving me very uncertain about whether Batch Apex really can handle large jobs.

Every now and then, a job will fail with this error: Unable to write to any of the ACS stores in the alloted time. I first encountered this in September 2010. I filed a Case and created a discussion group posting (http://boards.developerforce.com/t5/Apex-Code-Development/Unable-to-write-to-any-of-the-ACS-stores-in-the-alloted-time/m-p/205908#M36022). After a few weeks, I was finally told that it was an internal issue that had been resolved. After months of running nightly Batch Apex jobs without this problem, it just recurred.

A second issue is that, every now and then, a Batch Apex job gets stuck in the queue in the "Queued" state. When you launch a Batch Apex job, it gets added to the queue in the "Queued" state, and when the system gets around to executing it, the job gets moved to a "Processing" state. Well, I have batch jobs that have been stuck in the "Queued" state since early January. I've had cases open on this problem for over a month, and while the Case finally found its way to Tier 3 Support, there's still no sign of a resolution.

In both cases, the issue is NOT an Apex coding problem. It's an issue with how the platform is queueing and processing Batch Apex jobs.

I'm wondeirng whether anybody else has run into these problems, or other problems executing Batch Apex jobs. What problems have you run into? How have you resolved or worked around them?

Thanks for your insights.

 
  • February 04, 2011
  • Like
  • 0

Hi ,

 

I am trying to create a sample visual page with recruitment application but when i try to show fields data from related list, I am getting the following error.

 

Error: Invalid field Job_application__r for SObject Position__c 

 

here is my code.

 

<apex:page standardController="Position__c" id="thePage">
<apex:form >
<apex:pageBlock >
<apex:pageMessages ></apex:pageMessages>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!save}" value="Save"></apex:commandButton>
<apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="1">
<apex:inputField value="{!Position__c.Department__c}">
</apex:inputField>
<apex:inputField value="{!Position__c.Job_Description__c}">
</apex:inputField>
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock>
<apex:pageblockTable value="{!Position__c.Job_application__r}" var="JA">
<apex:column value="{!JA.Candidate__c}">
</apex:column>
<apex:column value="{!JA.Candidate_Qualified__c}">
</apex:column>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>