• Ritesh__
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 37
    Questions
  • 5
    Replies

I have been working on salesforce cloud for the last couple of months. I met a client interested in making an app. I suggested to him that we can build it using cloud computing, but he argue that using cloud computing is costly so we should use dedicated server. I read many articles some are saying its not cutting the cost of app but its increasing. I want to know using cloud computing specially salesforce cloud. Will it increase the production for example its making development easy, so easy the development you can very fast develop the app only or it reduces the cost of hosting or increasing the cost of hosting ??please give some guideline on cost affected for hosting the app increases or decreases ??

 

i am writing a visualforce in which i am using dynamic components my visualforce code is

<apex:pagetitle="Salesforce SOQL Offset Example Using Visualforce"standardStylesheets="false"controller="dynamic_visualforce_with_soql_offset"sidebar="false"readOnly="true"cache="false"showHeader="false"><scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><scriptsrc="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script><scripttype="text/javascript">$(function(){$("[id$=prev]").click(function(){alert('Hello World');});});</script><apex:sectionHeadersubtitle="SOQL Offset Example w/Dynamic Page Buttons"title="Square Root Table"/><apex:form><apex:pageBlock><apex:actionFunctionaction="{!refreshGrid}"name="queryByPage"reRender="myPanel,myButtons"><apex:paramname="firstParam"assignTo="{!selectedPage}"value=""/></apex:actionFunction><apex:dynamicComponentcomponentValue="{!myCommandButtons}"/><apex:pageBlockSectiontitle="Numbers and their Square Roots (Total List Size: {!total_size})"collapsible="false"><apex:outputPanelid="myPanel"><apex:pageMessagesid="theMessages"/><apex:pageBlockTablevalue="{!numbers}"var="n"align="center"><apex:columnvalue="{!n.Id}"/><apex:columnvalue="{!n.Name}"/><apex:facetname="footer">Showing Page # {!pageNumber} of {!totalPages}</apex:facet></apex:pageBlockTable></apex:outputPanel></apex:pageBlockSection></apex:pageBlock></apex:form></apex:page>

and segment for generating dynamic component is

 

i created a custom object with name Meeting Master in this i have to create a custom formula text field value of this custom field hould be name of owner of this record i select formula then field type to text after that when formula window come 

then i write OwnerId its a correct field but when i write Owner.name it is saying owner is not a valid field??please tell the formula how to set value of formula field to owner name??

i am testing my rest api its working fine i tested on a tool and send request and getting expeected result but when i am testing it with this class its giving me error

 

global class Feedpost9 {

// your methods here...

static testMethod void testRest() {
// set up the request object
System.RestContext.request = new RestRequest();
RestContext.request.requestURI = '/v.9/notifications/preferences/ritesh';
// Invoke the method directly
Member__c member=new Member__c(name='ritesh');
insert member;

Notification_Settings__c no=new Notification_Settings__c(member__c=member.Id);
no.Event__c='Category|Cloud Foundry' ;
no.Event_Per_Member__c='12';
insert no;

NotificationRestService.retrievingNotificationSettings();

//RestContext.request.requestURI = '/v.9/notifications/preferences/rashmi.xml' ;

NotificationRestService.retrievingNotificationSettings();
RestContext.request.requestURI ='/v.9/notifications/preferences/ritesh.xml';
NotificationRestService.retrievingNotificationSettings();

RestContext.request.requestURI='/v.9/notifications/preferences/ritesh.xml';
RestContext.request.addparameter('fields','id,name,Do_Not_Notify__c,Event__c,Event_Per_Member__c,Notification_Method__c,Member__r');
NotificationRestService.retrievingNotificationSettings();
System.RestContext.request=new RestRequest();
RestContext.request.requestURI='/v.9/notifications/preferences/rashmi';
NotificationRestService.retrievingNotificationSettings();
}
}

 

 

i am getting error in testing at this line

 

 

RestContext.request.requestURI='/v.9/notifications/preferences/rashmi';
NotificationRestService.retrievingNotificationSettings();

 

and segment of my RestService class is

@RestResource(urlMapping='/v.9/notifications/preferences/*')
global class NotificationRestService
{
@HttpGet
global static String retrievingNotificationSettings(){

RestRequest req=RestContext.request;

RestResponse res=RestContext.response;

List<Notification_Settings__c> note1=new List<Notification_Settings__c>();
note1.addAll([SELECT id,name,Member__r.name,Do_not_Notify__c,Event__c,Event_Per_Member__c,Notification_Method__c from Notification_Settings__c WHERE

note1.clear();

Member__r.name= :userName Limit 1]);

if( note1.size() >0 )
{
note=note1.get(0);
}

 

in line note1.size() i am getting Null pointer exception when i check for wheather note1.is null or not then its passing and showing that note1 is not null if i change this if statement to 

if(note1!=null){

if(note1.size() >0)

note=note1.get(0);}

 

if i omit conditional if statement then and call directly note1.get(0) then i am getting index out of bound exception expecting NullPointer excetion. can any one please explain weired behaviour of List class in testing when i run this url its work fine no null pointer exception i know size of list is zero but i am checking for negative case in testing there should be no null pointer exception i think please explain this behaviour of List class??

i have a class in dev org with code is

 

name of class is ManageRules.cls

 

/**
* This class is used for creating and editing Rule
**/

public with sharing class ManageRules{
public Rule__c newrule {get;set;}
public String objType {get;set;}
public string SearchEvalRule {get;set;}
public string Descr {get;set;}
public List<SelectOption> objOptions {get;set;}
// public String descr {get;set;}
public boolean edit {get;set;}
String ruleId;

public ManageRules(Apexpages.StandardController stdcon){
ruleId = stdcon.getId();
newrule = new Rule__c();
objOptions = new List<SelectOption>();

edit=false;
/**
* Add standard Objects
*/
objOptions.add(new SelectOption('',''));
objOptions.add(new SelectOption('Account','Account'));
objOptions.add(new SelectOption('Contact','Contact'));
objOptions.add(new SelectOption('Opportunity','Opportunity'));
objOptions.add(new SelectOption('Case','Case'));
objOptions.add(new SelectOption('Lead','Lead'));
objOptions.add(new SelectOption('Campaign','Campaign'));
objOptions.add(new SelectOption('Quote','Quote'));
objOptions.add(new SelectOption('Product2','Product'));
//objOptions.add(new SelectOption('ForeCast','Forecast'));

Map<String, Schema.SObjectType> mapObj = Schema.getGlobalDescribe();
for(String objname:mapObj.keySet()){
Schema.SObjectType sobj = mapObj.get(objname);
Schema.DescribeSObjectResult descRes = sobj.getDescribe();
/**
* Add custom objects
*/
if(descRes.isCustom() && !descRes.isCustomSetting()){
String objLabel = descRes.getLabel();
objOptions.add(new SelectOption(objName,objLabel));
}
}

/* Edit Rule */
if(ruleId!=null){
edit=true;
newrule = [select name,object__c,Rule_Execution_Plan__c,Available__c,Evaluation_Rule__c,Description__c from rule__c where id=:ruleId];
if(newrule!=null){
objtype=newrule.object__c;
Descr =newrule.Description__c;
SearchEvalRule =newrule.Evaluation_Rule__c ;

}
}

}

Public List<SelectOption> getEvalRule() {

List<selectOption> options = new List<selectOption>();
options.add(new selectOption('', '- None -'));
Schema.DescribeFieldResult field = Rule__c.Evaluation_Rule__c.getDescribe();
for (Schema.Picklistentry picklistEntry : field.getPicklistValues())
{
options.add(new SelectOption(pickListEntry.getValue(),pickListEntry.getLabel()));
}
return options;

}
public PageReference saveRule(){
newrule.object__c = objtype;
newrule.Evaluation_Rule__c=SearchEvalRule;
newrule.Description__c= Descr;

try{
Database.upsert(newrule);
return(new PageReference('/'+newrule.id));
}
catch(Exception e){
ApexPages.Message msg = new ApexPages.Message(ApexPages.severity.Error,e.getDMLMessage(0));
ApexPages.addMessage(msg);
return null;
}

}

public PageReference saveAndNewRule(){
newrule.object__c = objtype;
newrule.Evaluation_Rule__c=SearchEvalRule;
newrule.Description__c= Descr;
edit=false;
try{
Database.upsert(newrule);
newrule = new Rule__c();
return(new PageReference('/apex/manageRules'));
}
catch(Exception e){
ApexPages.Message msg = new ApexPages.Message(ApexPages.severity.Error,e.getDMLMessage(0));
ApexPages.addMessage(msg);
return null;
}

}


}

 

 

i created an object its giving me error

 

Description Resource Path Location Type
Save error: Rule__c : managerules does not exist or is not a valid override for action Edit. Rule__c.object /RuleCriteria/src/objects line 0 Force.com save problem

 

my Rule__c object code segment is

 

<actionOverrides>
<actionName>Edit</actionName>
<content>ManageRules</content>
<skipRecordTypeSelect>false</skipRecordTypeSelect>
<type>Visualforce</type>
</actionOverrides>

 

i am unable to figure why its showing me this error its an existing project so i have to deploy it on my dev org .on others org its working perfectly fine.i first i remove actionOverride tag from object and save it to my org then i save class code it is also working fine and after that i add this code segment in my object code  and then try to save this object code and getting this error.can any one please how to resolve this issue??