• Vinay Bhatia
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hello,

        I want to do authentication from my java client. I got Rest API which authenticate using web Application client and its working fine. But my requirement is little bit different as I need to use normal java client which will authenticate me directly to Salesforce site.

        

 

Regards,

Deepak

For example,there is a text field like total marks,secured marks and percentage.
if i enter total marks =1000, and secured marks=781 and it automatical generate the field like 78.1% in percentage field.
we are able to do this after clicking on save button,but i wanna do this on screen an user can see it,when he clicks a tab button...

do u got it what i am saying.......??

<apex:page controller="DependentObjects" id="UseCaseDisplay" label="FeatureCategoryReport" >

  <apex:form >
  <apex:pageBlock title="Send Request" mode="edit" id="thePageBlock" >

      <apex:pageBlockSection columns="1">

        <apex:pageBlockSectionItem >
        <apex:outputLabel value="Request Name" />
        <apex:inputText value="{!taskName}" />
        </apex:pageBlockSectionItem>
        
        <apex:pageblockSectionItem >
        <apex:outputLabel value="Select Project:" for="project"/>
        <apex:selectList value="{!project}" size="1" id="project">
        <apex:selectOptions value="{!projects}"/>
        <apex:actionSupport event="onchange" rerender="milestone"/>
        </apex:selectList>
        </apex:pageblockSectionItem>
        
        <apex:pageBlockSectionItem >
        <apex:outputLabel value="Select MileStone" for="milestones"/>
        <apex:selectList value="{!milestone}" size="1" id="milestone">
         <apex:selectOptions value="{!milestones}"/>
        </apex:selectList>
        </apex:pageBlockSectionItem>
                    
        <apex:pageBlockSectionItem >
        <apex:outputLabel value="Task Description" />
        <apex:inputTextarea value="{!description}"/>
        </apex:pageBlockSectionItem>
        
        <apex:pageBlockSectionItem >
        <apex:outputLabel value="Due Date" />
        <apex:inputText value="{!dueDate}"/>
        </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
      
      <apex:pageBlockButtons >
      <apex:commandButton value="send request" action="{!save}"/>
     </apex:pageBlockButtons>
    </apex:pageBlock>
     </apex:form></apex:page>



public class DependentObjects {
  String project;
    String milestone;
    String taskName;
    String description;
    String status='New';
    String dueDate;
    
    public String getProject() { return this.project; }

    public void setProject(String s) { this.Project = s; }

    public String getMilestone() { return this.Milestone; }

    public void setMileStone(String s) { this.MileStone = s; }
    
    public void setTaskName(String s) { this.taskName = s; }
    
    public String getTaskName() { return this.taskName; }

    public void setDescription(String s) { this.Description = s; }
    
    public String getDescription() { return this.Description; }
        
    public void setStatus(String s) { this.status = s; }
    
    public String getStatus() { return this.Status; }
            
    public void setDueDate(String s) { this.dueDate = s; }
    
    public String getDueDate() { return this.dueDate; }

    public List<SelectOption> getProjects() {

      List<SelectOption> optionList = new List<SelectOption>();
      optionList.add(new SelectOption('','-empty-'));
      for (my24X7PayTmA__Milestone1_Project__c pr : [select id,Name from my24X7PayTmA__Milestone1_Project__c     order by Name])
      {

        optionList.add(new SelectOption(pr.id,pr.Name));

      }
      return optionList;    
    }

    public List<SelectOption> getMilestones() {

      List<SelectOption> optionList = new List<SelectOption>();

      optionList.add(new SelectOption('', '- None -'));

          if(project!=null)
           {
            for (my24X7PayTmA__Milestone1_Milestone__c m : [select id,Name from my24X7PayTmA__Milestone1_Milestone__c where Project__c=:project])
            {

            optionList.add(new SelectOption(m.id,m.Name));

            }

           }

      return optionList;

    }
    public PageReference save()
    {
   my24X7PayTmA__MilestoneProjectRequest__c  pr=new my24X7PayTmA__MilestoneProjectRequest__c(Name=taskName,my24X7PayTmA__Detail__c=description,my24X7PayTmA__Project__c=project,my24X7PayTmA__Milestone__c=milestone,my24X7PayTmA__Status__c=status);
    insert pr;
    return page.InboundRequestpage;
    }
}



<apex:page controller="RequestList" sidebar="false" showHeader="false">
<font size="8">List of open requests</font>
<center>
<apex:form >
<apex:dataTable value="{!lst}" var="list" cellpadding="5" border="2" Bgcolor="orange">
<apex:column >
<apex:facet name="header">Related Project</apex:facet>
<apex:outputField value="{!list.name}" />
</apex:column>
<apex:column >
<apex:facet name="header">Related Project</apex:facet>
<apex:outputField value="{!list.Project__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Related Milestone</apex:facet>
<apex:outputField value="{!list.Milestone__c}"/>
</apex:column>
<apex:column >
<apex:facet name="header">Description</apex:facet>
<apex:outputField value="{!list.Detail__c}"/>
</apex:column>
<apex:column >
<apex:selectList value="{!action}" size="1">
<apex:selectOption itemLabel="Accept" itemValue="{!list.id}" ></apex:selectOption>
<apex:selectOption itemLabel="Reject" itemValue="{!list.id}" ></apex:selectOption>

</apex:selectList>
<apex:commandButton value="Do Action" action="{!doit}" reRender="out"> 
<apex:param name="Name" value="{!list.name}" 
assignTo="{!Name}"/> 
</apex:commandButton> 
</apex:column>
</apex:dataTable>
</apex:form>
</center>
<apex:outputPanel id="outing">
the id value is:<apex:outputText value="{!action}" id="out"></apex:outputText>
</apex:outputPanel>
</apex:page>



public class RequestList{
List<my24X7PayTmA__MilestoneProjectRequest__c   > lst;
String id;
public String action;
public void setAction(String data){this.action=data;}
public String getAction(){return this.action;}
public String getId(){return id;}
public List<my24X7PayTmA__MilestoneProjectRequest__c    > getLst(){
lst=[select id,my24X7PayTmA__Project__c,my24X7PayTmA__Milestone__c,Name,my24X7PayTmA__Detail__c from my24X7PayTmA__MilestoneProjectRequest__c   where my24X7PayTmA__Status__c='New'];
return lst;
}

public  void doit(){
List<my24X7PayTmA__MilestoneProjectRequest__c> lst=[select my24X7PayTmA__Project__c,my24X7PayTmA__Milestone__c,Name,my24X7PayTmA__Detail__c,my24X7PayTmA__Status__c from my24X7PayTmA__MilestoneProjectRequest__c where ID=:id];
lst[0].my24X7PayTmA__Status__c='Accepted';
Milestone1_Task__c task=new Milestone1_Task__c(Name=lst[0].Name,my24X7PayTmA__Description__c=lst[0].my24X7PayTmA__Detail__c,my24X7PayTmA__Project_Milestone__c=lst[0].my24X7PayTmA__Milestone__c);
update lst;
insert task;
}
}

 

Hi i wrote code for issue#17 for milestone but i am geeting an errori atteched code and screenshots i think you will understand if you need any help me please ask himmy mail id mahender.marma@gmail.com Visualforce Error


System.ListException: List index out of bounds: 0 

 

Class.my24X7PayTmA.RequestList.doit: line 15, column 5 External entry point

 

Visualforce Error
 

but when i mentioned particuler name then the doit acton is executing and converting request as a task for particuler milestone but i am not getting id or name

when i click DoAction any task should be convert as a task.


System.ListException: List index out of bounds: 0 

 

Class.my24X7PayTmA.RequestList.doit: line 15, column 5 External entry point

 

 

would yo please help me..........