• santoshgore
  • NEWBIE
  • 85 Points
  • Member since 2013

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
I would like to have the following functionality rebuild on a VF page. Baiscally the standard functionality

Account Owner FirstName LastName [change]

Best way to get formatting right is putting it in a pageblocksectionitem, otherwise you would need CSS to bring the change button to the right position
 
<apex:pageblocksectionitem>
				<apex:outputlabel> Account Owner </apex:outputlabel>
				<apex:outputfield value="{!Account.Ownerid}"/>
					<a href="/{!id}/a?retURL=/{!id}">[Change]</a>
</apex:pageblocksectionitem>
Unfortunately only 2 items are accepted in the section and the outputfield only displays FirstName LastName. Any good idea how to achieve this?
 
Hi,

I'm working on a calculator to dynamically determine milestone times based on various attributes of cases.  I have it working in the sandbox, and 95% code coverage, but I am having trouble generating a test to hit that last line of code.  Instead, my testmethod fails and I get the error message referenced above.

Right now, I have three milestones: First Response, Update Customer, and Solution delivered.  Each calculates dynamically based on the milestone and severity level.   

Here is my calculator:
global class myMilestoneTimeCalculator implements Support.MilestoneTriggerTimeCalculator {   
     global Integer calculateMilestoneTriggerTime(String caseId, String milestoneTypeId){
        Case c = [SELECT RecordType.Name, Severity_level__c, Priority FROM Case WHERE Id=:caseId];
        String rt = c.RecordType.Name;
        String sev = c.Severity_Level__c;
        String pLev = c.Priority;
        
         //this is only necessary for now, to prevent any stepping on toes, also we don't want to calc w/o a sev level
         If(rt.equals('Product Support') && c.Severity_Level__c != null){
             //start by checking milestone
           MilestoneType mt = [SELECT Name FROM MilestoneType WHERE Id=:milestoneTypeId];
             if (mt.Name != null && mt.Name.equals('First response from agent')) {
            //now sev levels 
                 if(sev != null && sev.equals('Severity 2')){return 240;}
                 else if(sev !=null && sev.equals('Severity 3')){return 480;}
                 else {return 960;}
                 
             }
             else if(mt.Name !=null && mt.Name.equals('Update Customer')){ 
                 //we're in the holding phase, providing customer updates
                 if(sev != null && sev.equals('Severity 2')){return 180;}
                 else if(sev !=null && sev.equals('Severity 3')){return 480;}
                 else {return 960;}
             }
             //our SLA requires a solution or action plan within certain timeframes.  we can do that here.
             else if(mt.Name != null && mt.Name.equals('Solution or Action Plan Delivered')){
                 if(sev != null && sev.equals('Severity 2')){return 960;}
                 else if(sev !=null && sev.equals('Severity 3')){return 1440;}
                 else {return 2400;}
             }
             else {return 960;}         
         }
         else {return 960;}
     }
}

I wrote a few helper methods, which I've tested and can confirm work.  Here is the one for getting the milestone :
public static MilestoneType msType(String MilestoneName){
        List<MilestoneType> mtLst = [SELECT Id, Name FROM MilestoneType Where Name =:MilestoneName LIMIT 1];
        if(mtLst.isEmpty() || mtLst.size() > 1) {return null;}
        else{
        MilestoneType mt = mtLst[0];
        return mt;  
        }
     }

And here is a testmethod that fails :
@isTest static void nullMilestone(){
        Case c = msTestDataFactory.cGen('Product Support','Severity 4','Low');
        myMilestoneTimeCalculator calculator = new myMilestoneTimeCalculator();
        MilestoneType mt = msTestDataFactory.msType('');
        Integer actualTriggerTime = calculator.calculateMilestoneTriggerTime(c.Id, mt.Id);
        System.debug('no milestone : '+actualTriggerTime);
        System.assertEquals(960, actualTriggerTime);
        }

So basically, I'm trying to test for an unlikely case (probably an impossible case) of a Case with no milestones invoking the milestone calculator.   I'm not sure how to do this without getting the error above.  

I'd appreciate any suggestions or general feedback on my actual code - I started with a snippet from the Salesforce resources, but it has obviously grown into it's own thing.
Hi all,

I have given with a condition like Whenever Quantity ( in Inventory field ) goes below 10 Units i have to send mail for a person XXXXX.
Need help for this.
public with sharing class DemoController
{
String LoggedInUserId;
public DemoController(ApexPages.StandardController controller)
{
LoggedInUSerId = UserInfo.getUserId();
}
}

in this program i want to execute in developer console:
i wrote like this
DemoController obj =new DemoController();
but it's not getting
I would like to have the following functionality rebuild on a VF page. Baiscally the standard functionality

Account Owner FirstName LastName [change]

Best way to get formatting right is putting it in a pageblocksectionitem, otherwise you would need CSS to bring the change button to the right position
 
<apex:pageblocksectionitem>
				<apex:outputlabel> Account Owner </apex:outputlabel>
				<apex:outputfield value="{!Account.Ownerid}"/>
					<a href="/{!id}/a?retURL=/{!id}">[Change]</a>
</apex:pageblocksectionitem>
Unfortunately only 2 items are accepted in the section and the outputfield only displays FirstName LastName. Any good idea how to achieve this?
 
I want to display two values ​​in two different custom object in one table , but I can not even , can someone help me please
Hi,

I'm working on a calculator to dynamically determine milestone times based on various attributes of cases.  I have it working in the sandbox, and 95% code coverage, but I am having trouble generating a test to hit that last line of code.  Instead, my testmethod fails and I get the error message referenced above.

Right now, I have three milestones: First Response, Update Customer, and Solution delivered.  Each calculates dynamically based on the milestone and severity level.   

Here is my calculator:
global class myMilestoneTimeCalculator implements Support.MilestoneTriggerTimeCalculator {   
     global Integer calculateMilestoneTriggerTime(String caseId, String milestoneTypeId){
        Case c = [SELECT RecordType.Name, Severity_level__c, Priority FROM Case WHERE Id=:caseId];
        String rt = c.RecordType.Name;
        String sev = c.Severity_Level__c;
        String pLev = c.Priority;
        
         //this is only necessary for now, to prevent any stepping on toes, also we don't want to calc w/o a sev level
         If(rt.equals('Product Support') && c.Severity_Level__c != null){
             //start by checking milestone
           MilestoneType mt = [SELECT Name FROM MilestoneType WHERE Id=:milestoneTypeId];
             if (mt.Name != null && mt.Name.equals('First response from agent')) {
            //now sev levels 
                 if(sev != null && sev.equals('Severity 2')){return 240;}
                 else if(sev !=null && sev.equals('Severity 3')){return 480;}
                 else {return 960;}
                 
             }
             else if(mt.Name !=null && mt.Name.equals('Update Customer')){ 
                 //we're in the holding phase, providing customer updates
                 if(sev != null && sev.equals('Severity 2')){return 180;}
                 else if(sev !=null && sev.equals('Severity 3')){return 480;}
                 else {return 960;}
             }
             //our SLA requires a solution or action plan within certain timeframes.  we can do that here.
             else if(mt.Name != null && mt.Name.equals('Solution or Action Plan Delivered')){
                 if(sev != null && sev.equals('Severity 2')){return 960;}
                 else if(sev !=null && sev.equals('Severity 3')){return 1440;}
                 else {return 2400;}
             }
             else {return 960;}         
         }
         else {return 960;}
     }
}

I wrote a few helper methods, which I've tested and can confirm work.  Here is the one for getting the milestone :
public static MilestoneType msType(String MilestoneName){
        List<MilestoneType> mtLst = [SELECT Id, Name FROM MilestoneType Where Name =:MilestoneName LIMIT 1];
        if(mtLst.isEmpty() || mtLst.size() > 1) {return null;}
        else{
        MilestoneType mt = mtLst[0];
        return mt;  
        }
     }

And here is a testmethod that fails :
@isTest static void nullMilestone(){
        Case c = msTestDataFactory.cGen('Product Support','Severity 4','Low');
        myMilestoneTimeCalculator calculator = new myMilestoneTimeCalculator();
        MilestoneType mt = msTestDataFactory.msType('');
        Integer actualTriggerTime = calculator.calculateMilestoneTriggerTime(c.Id, mt.Id);
        System.debug('no milestone : '+actualTriggerTime);
        System.assertEquals(960, actualTriggerTime);
        }

So basically, I'm trying to test for an unlikely case (probably an impossible case) of a Case with no milestones invoking the milestone calculator.   I'm not sure how to do this without getting the error above.  

I'd appreciate any suggestions or general feedback on my actual code - I started with a snippet from the Salesforce resources, but it has obviously grown into it's own thing.
Hi all,

I have given with a condition like Whenever Quantity ( in Inventory field ) goes below 10 Units i have to send mail for a person XXXXX.
Need help for this.

I am writing a test method for a Visualforce extension class. One of the scenios I wantt oconfirm that a certain error message appears. The message is below. I am not sure in my System. AssertEquals parameters, what I would put? Please adivce. Thanks.

 

     String sMsg = 'There are not vaild Bookings. Please contact the System Admin';
           ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.INFO, sMsg);
           ApexPages.addMessage(msg);
        

Hi All,
I have a custom VF page which performs the normal search functionality on Account and based on the selected account value wants to proceed further.
Problem:
I am not able to pass the selected account's id as action function is not working in the following code:

<apex:page controller="accountSearch">
<apex:form >
<script>
function toGetAccountId(id)
{
alert('test1');
variable1=document.getElementById(id).value;
xyz(variable1);
alert('test2');
}
</script>
<apex:pageBlock >

<apex:actionFunction name="xyz" action="{!samepage}">
<apex:param value="" assignTo="{!var1}"/>
</apex:actionFunction>


<apex:outputLabel value="Enter your search text:" >
<apex:inputText value="{!searchVar}">
</apex:inputText>
</apex:outputLabel>

<apex:commandLink value="Search" action="{!getAccounts}" />

<apex:pageBlockTable value="{!accList}" var="acc">
<apex:column headerValue="Account Name" > <apex:outputLink id="olId" onclick="toGetAccountId('{!$Component.olId}')">{!acc.name}
</apex:outputLink></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
-----------------------------------------------------
controller:
public with sharing class accountSearch {
public String olId { get; set; }
public String searchVar { get; set; }
public String var;
public String var1{get;set;}
public String var2;
public list<Account> accList = new list<Account>();

public PageReference getAccounts() {
var='%'+searchVar+'%';
system.debug('aaaaaaaaaaaa'+var);
accList = [Select name,NumberOfEmployees from account where name LIKE:var ];
system.debug('vvvvv'+accList);
return null;
}

public list<Account> getAccList(){
return accList;
}
public pagereference samepage()
{
//PageReference curPage = ApexPages.currentPage();
system.debug('lllllllllll');
var2=var1;
system.debug('dddddddddddddd'+var2);
PageReference curPage = new Pagereference('/apex/testpage2');
curPage.setRedirect(true);
return curPage ;
}
}

After the list of accounts returned, if I select a particular account (onclick of a output link),the javascript is getting invoked and I am getting the alerts. But the action method (samepage()) is not invoked. (for testing purpose, I am just redirecting a test page on the action method and its not working)
Also, if I try saving <apex:actionFunction name="xyz" action="{samepage}"> instead of <apex:actionFunction name="xyz" action="{!samepage}"> , its getting saved which is wrong.

I am at lost. Please help..

Thanks.

  • April 08, 2013
  • Like
  • 0

Dear Folks..

 

Is there application/tool to find out API usage in application level.

 

if anyone knows please share the application name/url.  

 

Thank you.

 

Regards,

Prakki

  • April 08, 2013
  • Like
  • 0