• MFSDev
  • NEWBIE
  • 55 Points
  • Member since 2012

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

 

Hi Team,

 

I want to restrict the below add product button based on the value of year. can any one help me on this. below is the apex code for same.

 

 

 

public string addingProduct {get; set;}
    
    public PageReference addProduct() {
        addingProduct='.';
        return null;
    }
    
    public PageReference cancelAddProduct() {
        addingProduct = null;
        return null;
    }       
    
    public transient string selectedProductIDs {get; set;} // no need to keep between postbacks
    
    public PageReference productsSelected() {
        addingProduct = null;
        
        string[] spIDs = (selectedProductIDs==null) ? new string[]{} : selectedProductIDs.split(',');
        Set<ID> pIDs = new Set<ID>();
        
        for (string s : spIDs)
            pIDs.add(s);
        
        Map<ID, Product_Shipper__c> pp = readProducts(pIDs);
        List<DSP_Product__c> records = new List<DSP_Product__c>();
        List<DataRecord> drdr = new List<DataRecord>();
        
        for (ID pid : pp.keySet())
        {
            Product_Shipper__c p = pp.get(pid);
            DataRecord dr = new DataRecord(p, this);
            dr.fix();
            
            dr.Forecast.Product_Price__c = p.Price__c;
            dr.LE.Product_Price__c = p.Price__c;
            dr.Actual.Product_Price__c = p.Price__c;
            
            records.add(dr.Forecast);
            records.add(dr.LE);
            records.add(dr.Actual);
            
            drdr.add(dr);
            
        }
        
        try {
            insert records;
           // for (DataRecord dr : drdr)
           //     dataRecords.add(dr);
           reloadRecords();    
        }
        catch (Exception e) {
         ApexPages.addMessages(e);
        }
        
        dsp.invalidate();
                
        return null;        
    }

    public ID[] existingProducts {
        get {
            if (dataRecords==null) return new ID[]{};
            
            ID[] rr = new ID[]{};
            
            for (DataRecord r : dataRecords.items) {
                if (r.Forecast!=null)
                    rr.add(r.Forecast.Product_Shipper__c);
            }
            return rr;
        }
    }
   

  • November 21, 2012
  • Like
  • 0

Hi,

I am facing a problem while trying to run a VF page which has some input fields and submit will insert data in an object.
While clicking submit, it is showing

Insufficient previlege Error.

But I have checked VF page, Class, Object all have field level security arrangment proper.
Also Profile level setting is ok.
So what can be other reason for it.

Please help. Thanks in advance.

  • November 21, 2012
  • Like
  • 0

 

Requirement: We need to send some data from HTML input fields to Apex.
We have used JS remoting method to acheive this.
In a VF page, we have html input field. Submit button call a JS function which executes Remote method of Apex.
It is working well .
Problem we are facing is that we have a container VF page, through which we display dynamic content for page.
And page shows at site level.
Now, while same html input fields we are adding in container VF and submit button on click is calling javascript, then Remote action is not executing.


Error: TypeError: b is undefined
Source File: http://p-united-developer-edition.ap1.force.com/jslibrary/1351189248000/sfdc/VFRemote.js
Line: 118

Our HTML:
<form class="cmxform" id="signUpForm" >
<fieldset class="ui-widget ui-widget-content ui-corner-all">
<legend class="ui-widget ui-widget-header ui-corner-all">Please provide your information in the form below to sign up</legend>
<p>
<label>Firstname</label>
<input name="Firstname" id="Fname" type="text" maxlegth="15" size="60" />
</p>
<p>
<label>Last Name</label>
<input name="Lastname" id="Lname" type="text" size="60" />
</p>
<p>
<input type="button" onClick="signUp();" value="Submit" class="button" />

</p>
</fieldset>
</form>


JS remote script:

function signUp()
{
alert("MFS");
var firstName = document.getElementById('Fname').value;
var lastName = document.getElementById('Lname').value;

alert("MFS : "+firstName+"::"+lastName);
Visualforce.remoting.Manager.invokeAction(
'{!$RemoteAction.MyController.myMethod}',
firstName,lastName,
function(result, event){
alert("MFS function called"+event.status);
if (event.status) {
alert("MFS event.status"+event.status);
} else if (event.type == 'exception') {
alert("MFS exception: "+event.message+event.where);

} else {
alert("MFS else ");
}
},
{escape: true}
);
}
</script>

  • November 06, 2012
  • Like
  • 0

Hi,
I have 5 customs objects tab. I want to consolidate those tabs under one tab.

How can that  be done.

Please help.thanks in advance

 

Hi,

I need to check datatype for some fields of my custom object.

      

       String type= 'MyCustomObject__c';  // Say,this is my object
       Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        Schema.SObjectType leadSchema = schemaMap.get(type);
        Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
        for (String fieldName: fieldMap.keySet()) {  
            String mylabel;
              //It provides to get the object fields label.
             mylabel = fieldMap.get(fieldName).getDescribe().getLabel();
       }

Now this type i.e. Object Name is varying time to time and I need to check fields data type.

If there is way,please help.

Thanks in advance.

What is the way to upload an object RECORD with all its lookup data from Sandbox to Production?

 

 

Thanks in advance .Please help if there is any way to do that.

Hi,

I am facing a problem while trying to run a VF page which has some input fields and submit will insert data in an object.
While clicking submit, it is showing

Insufficient previlege Error.

But I have checked VF page, Class, Object all have field level security arrangment proper.
Also Profile level setting is ok.
So what can be other reason for it.

Please help. Thanks in advance.

  • November 21, 2012
  • Like
  • 0

 

Hi Team,

 

I want to restrict the below add product button based on the value of year. can any one help me on this. below is the apex code for same.

 

 

 

public string addingProduct {get; set;}
    
    public PageReference addProduct() {
        addingProduct='.';
        return null;
    }
    
    public PageReference cancelAddProduct() {
        addingProduct = null;
        return null;
    }       
    
    public transient string selectedProductIDs {get; set;} // no need to keep between postbacks
    
    public PageReference productsSelected() {
        addingProduct = null;
        
        string[] spIDs = (selectedProductIDs==null) ? new string[]{} : selectedProductIDs.split(',');
        Set<ID> pIDs = new Set<ID>();
        
        for (string s : spIDs)
            pIDs.add(s);
        
        Map<ID, Product_Shipper__c> pp = readProducts(pIDs);
        List<DSP_Product__c> records = new List<DSP_Product__c>();
        List<DataRecord> drdr = new List<DataRecord>();
        
        for (ID pid : pp.keySet())
        {
            Product_Shipper__c p = pp.get(pid);
            DataRecord dr = new DataRecord(p, this);
            dr.fix();
            
            dr.Forecast.Product_Price__c = p.Price__c;
            dr.LE.Product_Price__c = p.Price__c;
            dr.Actual.Product_Price__c = p.Price__c;
            
            records.add(dr.Forecast);
            records.add(dr.LE);
            records.add(dr.Actual);
            
            drdr.add(dr);
            
        }
        
        try {
            insert records;
           // for (DataRecord dr : drdr)
           //     dataRecords.add(dr);
           reloadRecords();    
        }
        catch (Exception e) {
         ApexPages.addMessages(e);
        }
        
        dsp.invalidate();
                
        return null;        
    }

    public ID[] existingProducts {
        get {
            if (dataRecords==null) return new ID[]{};
            
            ID[] rr = new ID[]{};
            
            for (DataRecord r : dataRecords.items) {
                if (r.Forecast!=null)
                    rr.add(r.Forecast.Product_Shipper__c);
            }
            return rr;
        }
    }
   

  • November 21, 2012
  • Like
  • 0

Hi,
I have 5 customs objects tab. I want to consolidate those tabs under one tab.

How can that  be done.

Please help.thanks in advance

 

Hi,

I need to check datatype for some fields of my custom object.

      

       String type= 'MyCustomObject__c';  // Say,this is my object
       Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        Schema.SObjectType leadSchema = schemaMap.get(type);
        Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();
        for (String fieldName: fieldMap.keySet()) {  
            String mylabel;
              //It provides to get the object fields label.
             mylabel = fieldMap.get(fieldName).getDescribe().getLabel();
       }

Now this type i.e. Object Name is varying time to time and I need to check fields data type.

If there is way,please help.

Thanks in advance.

What is the way to upload an object RECORD with all its lookup data from Sandbox to Production?

 

 

Thanks in advance .Please help if there is any way to do that.

Hi,

 

I have a remoteAction annotated method in one of my apex classes and I'm trying to call that action from a visualforce.

My call looks like 

 

Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.DetailsController.addCompany}',id, name, function(response, event)

 where 'id' and 'name' are additional params to the action. The above snippet always throws "No remoted actions found to resolve" error. Any idea where I'm going wrong? Thanks.