• Amit Singh.ax1042
  • NEWBIE
  • 0 Points
  • Member since 2011

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

Hi Friends,
I have created an object Purchase Order...
in Purchase Order Following are the Fields...
Name
Invoice Created (Picklist-: Yes,No,Partally)
Status (Picklist-: Sent,Open)
Amount (Currency)


Another Object Is-:
Invoice
Fields of Invoice are

Purchase Order (look up- PO is master)
Date (Date)
Amount (Currency)


i have override the Purchase order tab using visualforce page...
(i am using Page Block table in my Vf Page)

I Donot want to create Invoice From Invoice Tab...
i want to use command button in my Purchase Order Page Block Table...
so I will be able to create Invoice for Each PO...

Suppose i am creating any Invoice By click Create Button Next to any PO record...
i should get navigate to create Invoice Page (Where Purchase Order will be automatically filled)
( i am able to do this)

but I want that, Suppose Purchase Order Record (For which I want to Create Invoice),if its status field is Open then if I click on create Invoice button next to Purchase Oreder then I should Not allow to land to CreateNewInvoice Visualforce page... I should get message like "You can not create Invoice For this Purchase Order because its Status is Open"...

and if for any Purchase Oreder its status is Sent then after clicking create Invoice Button next to PO record I should land to Create New Invoice Visualforce...


How It can be Possible???

<apex:page controller="DisplayPOunderjobtabextension">

  <apex:form >
   <apex:pageBlock >
     
     
    
    
     <apex:commandButton action="{!CreatePO}" value="New Purchase Order" id="btn1"/> 
    
    <br/>
    <apex:pageBlockTable value="{!purchaseorder}" var="po">
    
    <apex:column headerValue="Action">

         
          <apex:commandButton value="Create Invoice" action="/apex/CreateInvoiceFromPO?id={!po.id}"/>
         </apex:column> 
    
    
      <apex:column headerValue="Name">
       <apex:outputLink tabindex="tab1" value="/apex/PODetailpage?id={!po.Id}">{!po.Name}</apex:outputLink>
      </apex:column>
      
      <apex:column headerValue="Invoice Created">
      <apex:outputField value="{!po.Invoice_Created__c}"/> 
      </apex:column>
            
       <apex:column headerValue="Status">
       <apex:outputField value="{!po.Status__c}"/>
      </apex:column>
      
      <apex:column headerValue="Total Amount">
       <apex:outputField value="{!po.Amount__c}"/>
      </apex:column>
      
    
    </apex:pageBlockTable>
    

   
  
    <apex:pageBlockSection rendered="{!purchaseorder.Size == 0}">
     <apex:pageBlockSectionItem >
      No records to display.
     
     </apex:pageBlockSectionItem>
    </apex:pageBlockSection>
    
   </apex:pageBlock>
   
  </apex:form>
</apex:page>




Apex Class


public class DisplayPOunderjobtabextension
{
public List<Purchase_Order__c> purchaseorder{get;set;} 
//public List<Purchase_Order__c> purchaseorder1{get;set;} 
public DisplayPOunderjobtabextension()
{
String theID = ApexPages.CurrentPage().getParameters().get('id');
purchaseorder = [Select id,Name,Due_Date__c,Issue_Date__c,job__c,Status__c,Total_Amount__c,Vendor__c,Approved_By_Staff__c,Invoice_Created__c from Purchase_Order__c where Job__c =: theID Order BY Name];
}

 public PageReference CreatePO()
    {
       String jobid;
       String theId=ApexPages.CurrentPage().getParameters().get('id');
       Job__c job = [Select Id from Job__c where id =: theID];
       jobid=job.Id;
       
      PageReference p = Page.CreateNewPurchaseOrder;
       p.setredirect(true);
     p.getParameters().put('jobid',theID); 
     return p;
       return null;
    }


}

 

Hi Friends,

i Have Created an object Estimate... and created a custom button Approve...and override it with a visualforce...

 

<apex:page standardController="Estimate_Line_Items__c" extensions="ApproveEstimateController" action="{!autoRun}">
  <apex:sectionHeader title="Auto-Running Apex Code"/>
  <apex:outputPanel >
      You tried calling Apex Code from a button.  If you see this page, something went wrong.  You should have
      been redirected back to the record you clicked the button from.
  </apex:outputPanel>
</apex:page>




Apec Class-->

public class ApproveEstimateController 
{
private final Estimate_Line_Items__c est;
    public ApproveEstimateController(ApexPages.StandardController controller)
    {
    this.est=(Estimate_Line_Items__c)controller.getRecord();
    }
 public PageReference autoRun() 
    {
    
         try
        {
        est.Approved__c=true;
        update est;
        }
        catch(System.DMLException e)
        {
        return null;
        }
    
     String theId = ApexPages.currentPage().getParameters().get('id');
     if (theId == null) 
        {
            // Display the Visualforce page's content if no Id is passed over
            return null;
        }
        PageReference pageRef = new PageReference('/' + theId);
        pageRef.setRedirect(true);
        return pageRef;
    
    }        

 
}

 

 

now the thing is that,,,when i am pressing this button from any Estimate Line Items Record page...

i want a popup window to ask "Do you want to Approve this Item"...after pressing yes it should process otherwise nothing shoul happen...

How it can be???


I Have Created an object as Job,in this object following are the fields,
start date (data type is date)
completion date (data type is date)
no. of dayas (data type is number)
now i want to use a field as due date...
and
due date = start date + number of days excluding sat / sun...
how can i use this???


I have taken one custom button "Approve" on my detail page. When i click on Approve button then i want to copy some field from that record into another object.

The another requirement is that after clicking on Approve button that particular record should not be available for editing.

 

How to do this?

Hi friends,

i Am facing problem with AutoNumber,

i have created object JobApllication(Master) and Review(Child)...

for review i have taken record name as Job Application number (Data Type is Autonumber)...

 

i have create two application JA1,JA2

 

in JA1,i have created two review ( R-1 and R-2 (Auto number ))

in JA2,i have created two review (now here i am getting R-3,R-4)...i want that for different-different  job application review should start with R-1

 

is it possible?

 

any suggestion how to solve this kind of issue?



Hi friends,

I ma creatin role with the help of vf and apex class...

and displaying roles in Visualforce page with the help of Apex class....

i want to give edit and delete functionalty on vf page... i have given the same...Edit is working properly...

Delete is also working fine... but while i want to delete a role for which any user is assigned it is Showing standard error..(i want to make it custom eg- you can not delete this role)...

 

can i do this???

 

this is my code..

 

public class RoleList

{

        public List<UserRole> list_role{get;set;}   

        public String message {get;set;} 

      public RoleList(ApexPages.StandardController controller)    

        {

         list_role=[Select Name From UserRole Order By Name];       

        }

   public PageReference del()

        {    String delname = ApexPages.CurrentPage().getParameters().get('id'); 

       try       

          {

          Database.delete(delname);  

          }

        catch(System.DMLException e)

        { 

       //         message = 'Whoops! An error occurred -- ';

      //         System.assert(false,message);

          System.assert(false, e.getMessage());        

         } 

  PageReference p=new PageReference('/apex/AdminListView?intFocus=6'); 

  p.setRedirect(true);

    return p;

    }
}

 

Hi friends,

i Am facing problem with AutoNumber,

i have created object JobApllication(Master) and Review(Child)...

for review i have taken record name as Job Application number (Data Type is Autonumber)...

 

i have create two application JA1,JA2

 

in JA1,i have created two review ( R-1 and R-2 (Auto number ))

in JA2,i have created two review (now here i am getting R-3,R-4)...i want that for different-different  job application review should start with R-1

 

is it possible?

 

any suggestion how to solve this kind of issue?

hi friends,

i have created two objects 1)Job 2)Job Task

and there is a master detail relationship between Job and JobTask...

i have created visualforc page to create new Job and Jobtask as well...

i am getting problem while deleting Job Task from its Detail page... Because after deleting it goes to standard list of jobtask...

i want that after deleting any jobtask it should go back to respected Job... i have written apex for this but not able to fetch id of master record...

could any one provide me code to override delete of job task

 

here is my code but not able to retrieve id ob JOB

 

 

public class DeleteJobTask
{
    private final JobTask__c objJT;
    public DeleteJobTask(ApexPages.StandardController controller)
    {
    this.objJT=(Holiday__c)controller.getrecord();
    }
     public PageReference checkDelete()
     {
        try
        {
        Database.delete(objJT);       
        }
        catch(System.DMLException e)
        {
        return null;
        }
        PageReference p =  new Pagereference('/apex/JobDetailPage?id=);
        p.setRedirect(true);
        return p;
     }

}

 

 

Hi,

I have created one vf page where i can create a User for my org. When i save a record after entering the required fields(Send EMail Notification functionality to that user is not works).

Is it because i am customizing Create User functionality on vf page?

Because when we create a User from Setup->Manage Users option salesforce automatically sends the email to that particular user.


Cheers,
Devendra S 

Hi Friends,

i am getting problem when creating User with the help of visualforce page and Apex class(Apex class is used to view license and profiles))

problem here is about  Profile and  License type... since when we create user through manage users--> user if we select any particular license it shows profile only related to that license...(profile is dependent on license type we are selecting)...

but my page shows all licenses and profiles...

how to filter this??

 

here is my code--

 

</apex:page>

<apex:page standardController="User" extensions="CreateNewStaffAndUserExtension" tabStyle="Admin__c">
 
 
   
<!--    
<apex:sectionHeader title="Welcome" subtitle="{!User.Name}" help="/help/doc/user_ed.jsp?loc=help"></apex:sectionHeader> -->
    <apex:form >
        <apex:pageBlock mode="edit">
        <apex:pageMessages />
            <apex:pageBlockButtons >
                    <apex:commandButton action="{!save}" value=" Save "></apex:commandButton>
                    <apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>
                 </apex:pageBlockButtons>
              
              <apex:pageBlockSection title="User Information" columns="2" collapsible="false">  
                
                  <apex:inputField value="{!User.User_Skills__c}" />
                  <apex:inputField value="{!User.IsActive}"/>
                  <apex:inputField value="{!User.FirstName}"/>
                  <apex:inputField value="{!User.Username}"/>
                  <apex:inputField value="{!User.LastName}"/>
                  <apex:inputField value="{!User.Email}"/>
                  <apex:inputField value="{!User.alias}"/>
                  <apex:inputField value="{!User.UserRoleId}"/>
                  
                 
                  </apex:pageBlockSection>
                 <!-- <apex:inputField value="{!User.UserType}"/> -->
            
           
            

              <!--  <apex:pageBlockSectionItem >
                    <apex:outputLabel value="User" for="usr"></apex:outputLabel>
                   
                    <apex:selectList value="{!selectedRoleId}" multiselect="false" size="1" id="selectedRoleId">
                       <apex:selectOptions value="{!userList}" />
                    </apex:selectList>
                    </apex:pageBlockSectionItem>
            
            -->
                    
                    
            <apex:pageBlockSection >
              <!--    <apex:inputField value="{!User.ProfileId}"/> -->
                   <apex:inputField value="{!User.Phone}"/>
                   <apex:inputField value="{!User.Extension}"/>
                   <apex:inputField value="{!User.Fax}"/>
                   <apex:inputField value="{!User.EmployeeNumber}"/>
                   <apex:inputField value="{!User.Title}"/>
                   <apex:inputField value="{!User.CompanyName}"/>
                   <apex:inputField value="{!User.Division}"/>
                   <apex:inputField value="{!User.Department}"/>
                   <apex:inputField value="{!User.CommunityNickName}"/>

                 <!--  <apex:inputField value="{!User.UserType}"/> -->
                   
                   <apex:inputField value="{!User.ReceivesInfoEmails}" />
                   </apex:pageBlocksection>
              
                    <apex:pageBlockSection columns="1" showHeader="false" title="License">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="License" for="lic"></apex:outputLabel>
                    <apex:selectList id="mgr" value="{!User.UserType}" size="1" title="Manager">
                        <apex:selectOptions value="{!license}"></apex:selectOptions>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Profile" for="pro"></apex:outputLabel>
                   
                    <apex:selectList value="{!User.ProfileId}" multiselect="false" size="1" id="selectedProfileId">
                       <apex:selectOptions value="{!profile}" />
                    </apex:selectList>
                    </apex:pageBlockSectionItem>
            </apex:pageBlockSection> 
            
              
              
               <apex:pageBlockSection title="Other Information" columns="1" collapsible="false">
                   <apex:inputField value="{!User.EmailEncodingKey}"/>
                   <apex:inputField value="{!User.TimeZoneSidKey}"/> 
                   <apex:inputField value="{!User.LocaleSidKey}"/>
                   <apex:inputField value="{!User.LanguageLocaleKey}"/>
               </apex:pageBlockSection>
               
            <!--   <apex:pageBlockSection columns="1" showHeader="false" title="License">
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="License" for="lic"></apex:outputLabel>
                    <apex:selectList id="mgr" value="{!User.UserType}" size="1" title="Manager">
                        <apex:selectOptions value="{!license}"></apex:selectOptions>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
            -->
            
              </apex:pageBlock>
              </apex:form>
   
 


    
Apex Class is-:
}

public class CreateNewStaffAndUserExtension {


   
    public Id accountId{get;set;}
    public String accountName{get;set;}

      public List<Account> accs{get;set;}

    private final User user;
    public CreateNewStaffAndUserExtension(ApexPages.StandardController controller)
    {
    
 
      this.user= (User)controller.getrecord();

    }
    
 
    public List<selectOption> getLicense()
    {
        List<selectOption> options = new List<selectOption>(); //new list for holding all of the picklist options
        options.add(new selectOption('', '- None -')); //add the first option of '- None -' in case the user doesn't want to select a value or in case no values are returned from query below
          for (UserLicense users :[SELECT Id,Name FROM UserLicense])  
          {    
                options.add(new selectOption(users.Id, users.Name)); //for all records found - add them to the picklist options
          }
        return options; //return the picklist options
    }
    
    public List<selectOption> getProfile() {
        List<selectOption> options1 = new List<selectOption>(); //new list for holding all of the picklist options
        options1.add(new selectOption('', '- None -')); //add the first option of '- None -' in case the user doesn't want to select a value or in case no values are returned from query below
     //   for (User users : [SELECT Id,UserType FROM User]) { //query for User records with System Admin profile
     for (Profile users1 :[SELECT Id,Name FROM Profile])  {    
                options1.add(new selectOption(users1.Id, users1.Name)); //for all records found - add them to the picklist options
        
        
        
        
        } 
        
        
        return options1; //return the picklist options 
   
   
    } 
  
    
 }

I currently have a date field that displays a date 3 days from the date the form is opened. Here is the formula I used: TODAY() + 3

 

I would like to modify the formula to show a value of 3 business days instead of 3 days.  Can someone help?


Thanks in advance.