• Nantha_Wip
  • NEWBIE
  • 30 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 14
    Replies

Hi Everyone,

 

I have a custom object I created called "Inquery__c" And I have a few users on record,

I'm trying to allow only the users that exist in the "Inquery__c" to upload a file to Documents,

 

Here is the code 

 

 <apex:page controller="newCheck_and_upload"   tabStyle="Opportunity">   

<apex:sectionHeader title="Please Enter user information and upload LogFile"/>  

<apex:messages /> 

<apex:form enctype="multipart/form-data">  

 <apex:pageBlock >   

<apex:facet name="footer">        

<apex:outputPanel >          

<apex:commandButton action="{!save}" value="Check and Uplod"    styleClass="btn"/>  

 </apex:outputPanel>     

  </apex:facet>     

  <apex:pageBlockSection title="User Information">   

<apex:panelGrid columns="2">      

 <apex:outputLabel value="First Name" for="inqueryFirstName"/>     

  <apex:inputField id="inqueryFirstName" value="{!inquery.First_Name__c}"/>    

  <apex:outputLabel value="Last Name" for="inqueryLastName"/>     

  <apex:inputField id="inqueryLastName" value="{!inquery.Last_Name__c}"/>     

  <apex:outputLabel value="Email" for="inqueryEmail"/>   

   <apex:inputField id="inqueryEmail" value="{!inquery.Email__c}"/>  

        <apex:outputLabel value="Institution" for="inqueryInstitution"/>
        <apex:inputField id="inqueryInstitution" value="{!inquery.Institution__c}"/>
        <apex:outputLabel value="Position" for="inqueryPosition"/>
        <apex:inputField id="inqueryPosition" value="{!inquery.Position__c}"/>
        <apex:outputLabel value="Country" for="inqueryCountry"/>
        <apex:inputField id="inqueryCountry" value="{!inquery.Country__c}"/>

  </apex:panelGrid>

   </apex:pageBlockSection>  

  <apex:pageBlockSection title="Upload File">  

  <apex:panelGrid columns="2">   

      <apex:outputLabel for="file"/>   

      <apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>

   </apex:panelGrid>   

</apex:pageBlockSection>   

</apex:pageBlock>

  </apex:form>

</apex:page>

 

And the Class

 

public  with sharing class newCheck_and_upload {

    Inquery__c inquery;    

  public Boolean sFlag=true;        

 

public Inquery__c getInquery() {   

 if(inquery == null) inquery = new Inquery__c();    

 return inquery;    

}        

 

public Document document {    

get {      

if (document == null)        

document = new Document();      

return document;    

}    

set;   

}           

public PageReference save() {        

if(inquery == null) {          

sFlag = false;         

}else {         

sFlag = true;         

}            

if(sFlag){           

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'User Exists'));                 

} else {         

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'User Does not exist'));         

//return null;        

}    

insert inquery;

 

 

document.AuthorId = UserInfo.getUserId();        

document.FolderId = UserInfo.getUserId(); // put it in running user's folder                

try {          

insert document;        

} catch (DMLException e) {          

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));          

return null;        

} finally {          

document.body = null; // clears the viewstate          

document = new Document();        

}        

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));                

return null;     

} }

 

When I enter a user that exists or a user that does not exist (both ways) the file is never uploaded. This means that sFlag is never True.

When i try saving an existing file i get the following error:

 System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Email__c duplicates value on record with id: a08K0000001XxV5: []

Error is in expression '{!save}' in component <apex:page> in page exist_upload
 
This means that the "inquery == null" stament is not working,
And it return null,
But when it tries to save the account,
it tells me that the account is a duplicate!!
 

Does anyone know why?

 

 

Thanks

Hi all,

 

I want to write code for below functionality. Can anyone please help.

 

I want to restrict the controller action for users which are logged in using “Grant Login Access”.  Means user who logged in through some other are not able to access some records in my object.

Hi,

 

Please let me know what is default time out time out value when external system tries to update/insert records using SOAP web services API

Can we customize this, if so to what max value we can do ?

 

SImilary please let me know the default  time out value when external system tries to pull/extract records  from Salesforce using SOAP web services API.

Can we customize this, if so to what max value we can do ?

 

Thanks,

Babu.

  • May 07, 2013
  • Like
  • 0

Hello,

 

I have been looking at an unusual situation.

 

I'm editing a record, specifically a lookup field on the record (which has up to this point been null). I have an action support (onchange) on the field that triggers a rerender on a picklist field that gets its options from a function in the controller that uses the lookup field value in a SOQL query.

 

The problem is that the value of the lookup field is still NULL when the query runs in the function.

 

However, if I fill in the lookup field, save and edit again, this time if I change the lookup field, the value IS up to date in the controller when I go and do the query.

 

What can be causing this? what can I do?

 

How can I get the value in the input field in a reliable way?

 

Here is the APEX Page and the Controller. (nPrescripcion.Medicamento__c is the lookup field that is not up to date in the controller when I run the query, I know this based on a system.debug statement)

 

<apex:page standardController="Prescripcion_Paciente__c" showHeader="false" sidebar="false" extensions="PrescripcionExtension">
    <apex:form style="padding-left:25px;padding-right:25px;padding-top:25px;">
        <apex:pageBlock title="Prescripción" tabstyle="Tratamiento__c"  mode="edit" >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save" /> 
                <apex:commandButton action="{!cancel}" value="Cancelar" id="btn_Cancel"/>
                </apex:commandButton> 
            </apex:pageBlockButtons>  
            <apex:pageBlockSection id="MedicamentoVE" title="Medicamento" showHeader="true" collapsible="false" columns="2" >
                <apex:inputField label="Principio Activo" id="iPrincipioActivo"  required="true" value="{!Prescripcion_Paciente__c.Medicamento__c}">
                    <apex:actionSupport event="onchange" reRender="iMarca1,iMarca2" />
                </apex:inputField>
                <apex:selectList value="{!Prescripcion_Paciente__c.Marca_Comercial_1__c}" size="1" id="iMarca1" required="false">
                    <apex:selectOptions value="{!MarcasComerciales}"/>
                </apex:selectList>
            </apex:pageBlockSection>     
        </apex:pageBlock>
    </apex:form>  
</apex:page>

 

public class PrescripcionExtension {
    private Prescripcion_Paciente__c nPrescripcion;
    public ApexPages.StandardController stdCtrl { set; get; }
   
    public PrescripcionExtension (ApexPages.StandardController controller) {
        this.nPrescripcion= (Prescripcion_Paciente__c)controller.getRecord();
        stdCtrl=controller;
    }
    
    public List<SelectOption> getMarcasComerciales()
    {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('','--Ninguna--'));
        options.add(new SelectOption('Otra','Otra'));
        system.debug(nPrescripcion.medicamento__c);
        Tratamiento__c[] nMeds = [Select marcas__c from Tratamiento__c where id=:nPrescripcion.medicamento__c];
        if (nMeds.size()>0){
            if (nMeds[0].marcas__c!=null && nMeds[0].marcas__c!='')
            {
                String[] marcas = nMeds[0].marcas__c.split(';');
                for (Integer j=0;j<marcas.size();j++)
                {
                  options.add(new SelectOption(marcas[j],marcas[j]));
                }
            }
        }
        return options;
    }
}

 

 

 

From our fullsandbox we are doing a SOAP call out to an outside server to retrieve data.  We have created a certificate and placed it on the outside development server and the outside production server.  When we execute the call out to development, it works fine.  When we edit our code and call out to production we get:

Failed HTTP ERROR 400

Problem accessing /services/proxy. Reason:

    Unable to forward request due to: sun.security.validator.ValidatorException: PKIX path building failed:  sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Powered by Jetty://

 

Does anyone have any suggestions why it works on the development box and not the production box when the certificate is identical?  We have both urls defined in the Remote Site Settings.

 

Hi Everyone,

 

I have a custom object I created called "Inquery__c" And I have a few users on record,

I'm trying to allow only the users that exist in the "Inquery__c" to upload a file to Documents,

 

Here is the code 

 

 <apex:page controller="newCheck_and_upload"   tabStyle="Opportunity">   

<apex:sectionHeader title="Please Enter user information and upload LogFile"/>  

<apex:messages /> 

<apex:form enctype="multipart/form-data">  

 <apex:pageBlock >   

<apex:facet name="footer">        

<apex:outputPanel >          

<apex:commandButton action="{!save}" value="Check and Uplod"    styleClass="btn"/>  

 </apex:outputPanel>     

  </apex:facet>     

  <apex:pageBlockSection title="User Information">   

<apex:panelGrid columns="2">      

 <apex:outputLabel value="First Name" for="inqueryFirstName"/>     

  <apex:inputField id="inqueryFirstName" value="{!inquery.First_Name__c}"/>    

  <apex:outputLabel value="Last Name" for="inqueryLastName"/>     

  <apex:inputField id="inqueryLastName" value="{!inquery.Last_Name__c}"/>     

  <apex:outputLabel value="Email" for="inqueryEmail"/>   

   <apex:inputField id="inqueryEmail" value="{!inquery.Email__c}"/>  

        <apex:outputLabel value="Institution" for="inqueryInstitution"/>
        <apex:inputField id="inqueryInstitution" value="{!inquery.Institution__c}"/>
        <apex:outputLabel value="Position" for="inqueryPosition"/>
        <apex:inputField id="inqueryPosition" value="{!inquery.Position__c}"/>
        <apex:outputLabel value="Country" for="inqueryCountry"/>
        <apex:inputField id="inqueryCountry" value="{!inquery.Country__c}"/>

  </apex:panelGrid>

   </apex:pageBlockSection>  

  <apex:pageBlockSection title="Upload File">  

  <apex:panelGrid columns="2">   

      <apex:outputLabel for="file"/>   

      <apex:inputFile value="{!document.body}" filename="{!document.name}" id="file"/>

   </apex:panelGrid>   

</apex:pageBlockSection>   

</apex:pageBlock>

  </apex:form>

</apex:page>

 

And the Class

 

public  with sharing class newCheck_and_upload {

    Inquery__c inquery;    

  public Boolean sFlag=true;        

 

public Inquery__c getInquery() {   

 if(inquery == null) inquery = new Inquery__c();    

 return inquery;    

}        

 

public Document document {    

get {      

if (document == null)        

document = new Document();      

return document;    

}    

set;   

}           

public PageReference save() {        

if(inquery == null) {          

sFlag = false;         

}else {         

sFlag = true;         

}            

if(sFlag){           

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'User Exists'));                 

} else {         

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'User Does not exist'));         

//return null;        

}    

insert inquery;

 

 

document.AuthorId = UserInfo.getUserId();        

document.FolderId = UserInfo.getUserId(); // put it in running user's folder                

try {          

insert document;        

} catch (DMLException e) {          

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading file'));          

return null;        

} finally {          

document.body = null; // clears the viewstate          

document = new Document();        

}        

ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'File uploaded successfully'));                

return null;     

} }

 

When I enter a user that exists or a user that does not exist (both ways) the file is never uploaded. This means that sFlag is never True.

When i try saving an existing file i get the following error:

 System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: Email__c duplicates value on record with id: a08K0000001XxV5: []

Error is in expression '{!save}' in component <apex:page> in page exist_upload
 
This means that the "inquery == null" stament is not working,
And it return null,
But when it tries to save the account,
it tells me that the account is a duplicate!!
 

Does anyone know why?

 

 

Thanks

I've got a big spreadsheet-style input. in a pageBlock. I''ve tried making an asynchronous call to my controller and rerendering the page based on the field value, but this is painfully slow. I'd like to use JavaScript to disable/enable an inputField on a row once a selectList is chosen. Here's what I've got, and I can see that it's not throwing any errors in Chrome and referencing the correct value. Still, it does nothing! Any help?

 

Specifically, I need help passing the selected value from the selectlist "myList" to the JavaScript in the inpuField "value" and getting it to actually disable based on that argument.

 

<apex:pageBlockSection id="Calls" columns="1" collapsible="true" title="Calls" rendered="{!totalCalls > 0}">           
            
    <apex:outputPanel styleClass="tableContainer" layout="block">
    <apex:pageBlockTable id="resultsIMC" value="{!calls}" var="n" cellPadding="4" border="1" styleclass="floatingHeaderTable">
              <apex:column value="{!n.Client_Call_Time__c}" headerValue="Call Time">
              </apex:column>
              <apex:column value="{!n.Nice_CallerID__c}" headerValue="Caller ID">
              </apex:column>
              <apex:column value="{!n.Duration__c}" headerValue="Duration">
              </apex:column>
              <apex:column headerValue="Disposition">
              <apex:selectList id="myList" value="{!n.Disposition__c}" multiselect="false" size="1" onChange="disableValue(this.value);">
                    <apex:selectOptions id="disposition" value="{!availablePick}" >
                    </apex:selectOptions>
              </apex:selectList>
              </apex:column>
              <apex:column headerValue="Category">
              <apex:selectList id="myCatCall" value="{!n.Category__c}" disabled="{!IF(n.Disposition__c != 'Accept',  true, false)}" multiselect="false" size="1" >
                    <apex:actionSupport event="onchange" action="{!updateCall}" rerender="parameters">
                        <apex:param name="saveThisCall" value="{!n.Id}" assignTo="{!tc}"/>
                    </apex:actionSupport>
                    <apex:selectOptions value="{!availableCat}"/>
              </apex:selectList>
              </apex:column>
              <apex:column headerValue="Value" style="width:20px">
              <apex:inputField id="value" value="{!n.Value__c}">
               <apex:actionSupport event="onchange"  action="{!updateCall}" rerender="parameters">
                        <apex:param name="saveThisCall" value="{!n.Id}" assignTo="{!tc}"/>
                    </apex:actionSupport>
                       <script>
                       function disableValue(e) { 
                            if ( e == "Reject" ) {
                               document.getElementById('{!$Component.value}').setAttribute("disabled","disabled");
                            } else {
                               document.getElementById('{!$Component.value}').removeAttribute("disabled");
                            }
                        }
                       </script>
              </apex:inputField>
              </apex:column>        
            </apex:pageBlockTable>
            </apex:outputPanel>
        </apex:pageBlockSection>

 

  • May 02, 2013
  • Like
  • 0

Different picklist values dependingon user input.

 

Hi,

 

I have a requirement in which i will have to display different picklist values  depending on the value selected by user in a lookup field.

Picklist values from  lookup selceted values.

 eg:bank's name is A  input,picklist values is aa and aaa.

         bank's name is B  input,picklist values is bb and bbb.

 

Any idea , how this can be achieved .

 

Thanks in advance

 

 

Hi,

 

following are the code requirements:

1. If value entered in product name is not present in Products, then it should enable Save button.

2. If value entered in product name is present in Products, then it should display all the contents in a table.

 

VF Code:

<apex:page StandardController="Product__c" extensions="ExistingController"  >
   <apex:form id="fm" >
   <apex:actionFunction name="invoke" action="{!search}" reRender="pb"/>

       <apex:pageBlock id="pb" title="Products" mode="edit" >
           <apex:pageBlockSection id="pbs" title="Search/Create a Product record" columns="2">
               <apex:inputField id="ifname" value="{!Product__c.name}"  />
               <apex:inputField value="{!Product__c.Description__c}" />
               <apex:inputField value="{!Product__c.Total_Inventory__c}"  />
               <apex:inputField value="{!Product__c.Price__c}" />
               <apex:inputField value="{!Product__c.Stock_Quantity__c}" />
           </apex:pageBlockSection>
               <apex:pageBlockButtons >
               <apex:commandButton value="reset"  action="{!Reset}"/>
               <apex:commandButton value="Save" action="{!Save}" rendered="{!flag}"/>
               <apex:commandButton value="Search" OnClick="nameNull()"/>
           </apex:pageBlockButtons>
          
           <apex:pageBlockTable id="pbt" var="pb" value="{!prodRecordList}">
               <apex:column value="{!pb.Name}" />
               <apex:column value="{!pb.Description__c}"/>
               <apex:column value="{!pb.Total_Inventory__c}"/>
               <apex:column value="{!pb.Price__c}"/>
               <apex:column value="{!pb.Stock_Quantity__c}"/>
           </apex:pageBlockTable>
           </apex:pageBlock>
      
      
   </apex:form>
   <script>
       function nameNull(){
           var text= document.getElementById("{!$Component.fm.pb.pbs.ifname}").value;
           if(text == '')
           {alert('Please enter value in Product Name field');
           }
           else
                {           invoke();
                                                   }        
                                           }
   </script>
</apex:page>

 

 

Controller Code:

 

public class ExistingController {

   public string nameStr{ get; private set; }
   Public List<product__c> prodRecordList {get; set;}
   Public product__c prod {get; set;}
   public boolean flag {get; set;}
  
   public ExistingController(ApexPages.StandardController stdController) {
       this.prod= (product__c)stdController.getRecord();
   }
  
   public pageReference search () {

       prodRecordList =  [SELECT id, Name, Description__c, Total_Inventory__c, Price__c, Stock_Quantity__c from product__c where name=:prod.name];
       System.debug('@@prodRecordList'+prodRecordList);
       if(prodRecordList.size()==0 )
      
           flag = true;
           return null;
   }
   public pageReference Reset() {

       PageReference newpage = new PageReference(System.currentPageReference().getURL());
       newpage.setRedirect(true);
       return newpage;  
          }
      
  public pageReference Save()  {
  INSERT prod;
  pageReference newpage = new PageReference('/apex/recordsaved');
  return newpage;
  }
}

 

When calling directly it works, but when called from Javascript action function it does not. Please help.

Hello,

 

Can anyone please explain me the use of Site.com, when exactly there is a use of Site.com in Salesforce

 

Thanks,

<apex:pageBlockSection title="{!c.Name} {!c.Type_Name__c} {!c.Hours__c} {!c.Custom__c} {!c.Fl__c} {!c.Out__c} {!theopportunity.Original_Product_Type__c} {!theopportunity.Original_Aircraft_Type__c} {!theopportunity.Original_Hours__c} "
columns="1" rendered="{!CONTAINS(theRequest.Type__c,'Car')}">

 

 

I want the above merge fields to be displayed in two lines 

 

{!c.Name} {!c.Type_Name__c} {!c.Hours__c} {!c.Custom__c} {!c.Fl__c} {!c.Out__c} in one line and 

 

{!theopportunity.Original_Product_Type__c} {!theopportunity.Original_Aircraft_Type__c} {!theopportunity.Original_Hours__c} in another line 

 

 

can any one help me in this ?? is it possible 

  • May 02, 2013
  • Like
  • 0

HI, I made a managed package and uploaded it to appexchange.I upgraded it many times.Yesterday evening(at 1 st March 2011, 6 pm Indian time) also I upgraded the managed package with a bug fix. I am able to install the package in a developer edition successfully. But while I was installing the same package in enterprise edition, I got this error 

"Package Not Found 
The requested package does not exist or has been deleted. Please contact the package publisher for assistance. If this is a recently uploaded package, please try again soon. " 

After that I tried many times, I got the same error. After 20 hrs also I am getting the same error. 

Another thing is, now I am unable to install the same package in developer edition also. Because I am getting the same error.But I was installed the same package successfully once yesterday. 

 

 

Please help me. I am unable to find any info related to this.

 

Thanks,

Naresh