• MDV Surya
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies
Hello everyone,
    
    Can anyone help on the below issue.
    
I am using visualforce with angularjs.
I have a visualforce page (Search) and two apex components (SimpleSearch and AdvancedSearch).
I am loading the apex components into the page through angularjs using routeprovider.
 
SearchApp.config(['$routeProvider', function($routeProvider) {
    $routeProvider
        .when('/', {templateUrl: '/apexcomponent/SimpleSearch', 
            controller: 'SimpleSearchCtrl'})
        .when('/advsrch', {templateUrl: sitePrefix+'/apexcomponent/AdvancedSearch', 
            controller: 'AdvancedSearchCtrl'})
        .otherwise({redirectTo: '/'});
}]);

It works when using Administator user (salesforce licence) because admin has "Customize Application" permission.
When using simple user (Other than salesforce licence e.g. salesforce platform licence) I am getting a 500 Internal server error in browser console for component.
In the error log we found the below message.
You do not have sufficient privileges to access the page: /apexcomponent/SimpleSearch httpReferer=https-//c-naNN-visual-force-com/apex/Search

I am trying to update the inner class object field value before saving, but not able to do so.

I have 2 object
1. Purchase Details
2. Purchase Items List
Object 1 is master Object and Object 2 is Detailed Object
I had designed a VF page & apex page for capturing the complete data in a single page.
I am able to capture the both Objects data and able to save.
Suppose I want to delete a record from object 2 before saving, yes I am able to do so.
Suppose I want to do changes for a added record in Object 2 before saving. I am not able to do so .
So Please someone guide me on how to achive it.
Please find the below VF & Apex Code.

 

<apex:page standardController="Purchase_Item__c" extensions="PurchaseOrderClass" >
    <apex:form id="form">
        <apex:pageMessages />
        <apex:pageBlock mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!doSave}" value="Save" />
                <apex:commandButton action="{!cancel}" value="Cancel" />            
                </apex:pageBlockButtons>
            <apex:pageBlockSection title="Purchase Order Details" columns="2">
                <apex:inputField value="{!myPurchaseOrder.Name}"/>
                <apex:inputField value="{!myPurchaseOrder.Purchase_Date__c}"/>
                <apex:inputField value="{!myPurchaseOrder.Purchase_Order_Type__c}"/>
                <apex:inputField value="{!myPurchaseOrder.Vendor__c}"/>
                <apex:inputField value="{!myPurchaseOrder.Status__c}"/>
            </apex:pageBlockSection>
            <apex:pageblocksection title="Purchase Item Details" id="purchaseItemDetailsSection" columns="3" >
                <apex:inputField value="{!purchaseItemRec.Purchase_Item_Name__c}"  />
                <apex:inputfield value="{!purchaseItemRec.Quantity__c}" />
                <apex:inputfield value="{!purchaseItemRec.Unit_Price__c}" />
            </apex:pageblocksection>
            <div align="center">
                <apex:commandButton action="{!doAdd}" value="add" rerender="purchaseItemDetailsSection,purchaseItemsListSection"  />
            </div>            
            <apex:pageblocksection title="Purchase Items List" id="purchaseItemsListSection">
                <apex:pageBlockTable value="{!purchaseItemsClassList}" var="a">
                    <apex:column headerValue="Indent">
                        <apex:outputText value="{!a.indent}" />
                    </apex:column>
                    <apex:column headerValue="Purchase Items Name">
                        <apex:outputText value="{!a.purchaseItemClsObj.Purchase_Item_Name__c}" rendered="{!a.editDelShow}"/>
                        <apex:inputtext value="{!modPurItmName}" rendered="{!a.doneCancelShow}" />
                    </apex:column>
                    <apex:column headerValue="Purchase Quantity">
                        <apex:outputtext value="{!a.purchaseItemClsObj.Quantity__c}" rendered="{!a.editDelShow}"/>
                        <apex:inputtext value="{!modPurQnty}" rendered="{!a.doneCancelShow}" />
                    </apex:column>
                    <apex:column headerValue="Unit Price">                
                        <apex:outputtext value="{!a.purchaseItemClsObj.Unit_Price__c}" rendered="{!a.editDelShow}"/>
                        <apex:inputtext value="{!modPurUntPr}" rendered="{!a.doneCancelShow}" />  
                    </apex:column>
                    <apex:column headerValue="Action"> 
                        <apex:commandLink value="Edit" action="{!editPurchaseItem}" immediate="true" rendered="{!a.editDelShow}" rerender="purchaseItemsListSection"><apex:param name="editIndent" value="{!a.indent}" assignTo="{!editIndent}"/></apex:commandLink> 
                        <apex:commandLink value="Done" action="{!editDonePurchaseItem}" immediate="true" rendered="{!a.doneCancelShow}" rerender="purchaseItemsListSection"><apex:param name="doneIndent" value="{!a.indent}" assignTo="{!doneIndent}"/></apex:commandLink> / 
                        <apex:commandLink value="Delete" action="{!deletePurchaseItem}" immediate="true" rendered="{!a.editDelShow}" rerender="purchaseItemsListSection"><apex:param name="delIndent" value="{!a.indent}" assignTo="{!delIndent}"/></apex:commandLink> 
                        <apex:commandLink value="Cancel" action="{!editCancelPurchaseItem}" immediate="true" rendered="{!a.doneCancelShow}" rerender="purchaseItemsListSection"><apex:param name="cancelIndent" value="{!a.indent}" assignTo="{!cancelIndent}"/></apex:commandLink>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageblocksection>                
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

public with sharing class PurchaseOrderClass {

    public Purchase_Order__c myPurchaseOrder;
    public Purchase_Item__c purchaseItemRec {get; set;}
    private Integer nextIdent=0;
    public static Integer editIndent {get; set;}
    public static Integer delIndent {get; set;}
    public static Integer doneIndent {get; set;}
    public static Integer cancelIndent {get; set;}
    
    public static String modPurItmName {get; set;}
    
    public static String getModPurItmName(){
    	return modPurItmName;
    }
    
    public static Decimal modPurQnty {get; set;}
    
    public static Decimal getModPurQnty(){
    	return modPurQnty;
    }
    
    public static Decimal modPurUntPr;
    
    public static Decimal getModPurUntPr(){
    	return modPurUntPr;
    }
    
    public void setModPurUntPr(Decimal arg){
    	modPurUntPr = arg;
    }
    
    public PurchaseOrderClass(ApexPages.StandardController controller) {
        purchaseItemRec = (Purchase_Item__c)Controller.getRecord();
        this.myPurchaseOrder = new Purchase_Order__c();
    }

    public Purchase_Order__c getMyPurchaseOrder(){
            return myPurchaseOrder;
    }
    
    public PageReference doSave()
    {
        insert myPurchaseOrder;
        List<Purchase_Item__c> purItmLst = new List<Purchase_Item__c>();
        for(purchaseItemsRecord purItmClsRec : purchaseItemsClassList){
        	purItmClsRec.purchaseItemClsObj.Purchase_Order__c = this.myPurchaseOrder.id;
        	purItmLst.add(purItmClsRec.purchaseItemClsObj);
        }
        insert purItmLst;
        PageReference pr = new PageReference('/'+this.myPurchaseOrder.id);
        return pr;
    }
    
    public void doAdd(){
            
        purchaseItemsClassList.add(new purchaseItemsRecord(purchaseItemRec,nextIdent++));
        purchaseItemRec = new Purchase_Item__c();
    }
    
    public void editPurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(editIndent == purchaseItemsClassList[Idx].indent){
		    	modPurItmName	= purchaseItemsClassList[Idx].purchaseItemClsObj.Purchase_Item_Name__c;
		    	modPurQnty		= purchaseItemsClassList[Idx].purchaseItemClsObj.Quantity__c;
		    	modPurUntPr		= purchaseItemsClassList[Idx].purchaseItemClsObj.Unit_Price__c;
		    	system.debug('in edit method########################');
		    	system.debug('modPurItmName: '+modPurItmName);
            	system.debug('modPurQnty: '+modPurQnty);
            	system.debug('modPurUntPr: '+modPurUntPr);
		    	
                purchaseItemsClassList[Idx].editDelShow=false;
                purchaseItemsClassList[Idx].doneCancelShow=true;
                break;
            }
        }
    }
	
    public void editCancelPurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(cancelIndent == purchaseItemsClassList[Idx].indent){
                purchaseItemsClassList[Idx].editDelShow=true;
                purchaseItemsClassList[Idx].doneCancelShow=false;
                break;
            }
        }
    }
	
	public string test{get;set;}
    public void editDonePurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(doneIndent == purchaseItemsClassList[Idx].indent){
            	system.debug('in done method########################');
            	system.debug('modPurItmName: '+getModPurItmName());
            	system.debug('modPurQnty: '+getModPurQnty());
            	system.debug('modPurUntPr: '+getModPurUntPr());
		    	purchaseItemsClassList[Idx].purchaseItemClsObj.Purchase_Item_Name__c = modPurItmName;
		    	purchaseItemsClassList[Idx].purchaseItemClsObj.Quantity__c = modPurQnty;
		    	purchaseItemsClassList[Idx].purchaseItemClsObj.Unit_Price__c = modPurUntPr;
                purchaseItemsClassList[Idx].editDelShow=true;
                purchaseItemsClassList[Idx].doneCancelShow=false;
                break;
            }
        }
    }

    public void deletePurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(delIndent == purchaseItemsClassList[Idx].indent){
                purchaseItemsClassList.remove(Idx);
                break;
            }
        }
    }
    
    public List<purchaseItemsRecord> purchaseItemsClassList = new List<purchaseItemsRecord>();
    public class purchaseItemsRecord {
        public Purchase_Item__c purchaseItemClsObj{get;set;}
        public Integer indent{get;set;}
        public Boolean editDelShow{get; set;}
        public Boolean doneCancelShow{get; set;}
        public purchaseItemsRecord(Purchase_Item__c purchaseItemClsObjArg,Integer indentArg){
            indent = indentArg;
            purchaseItemClsObj = purchaseItemClsObjArg;
	        editDelShow=true;
	        doneCancelShow=false;
        }
    }
    
    public List<purchaseItemsRecord> getpurchaseItemsClassList(){
        return purchaseItemsClassList;
    }

}

 

Thanks in Advance.

 

Hello everyone,
    
    Can anyone help on the below issue.
    
I am using visualforce with angularjs.
I have a visualforce page (Search) and two apex components (SimpleSearch and AdvancedSearch).
I am loading the apex components into the page through angularjs using routeprovider.
 
SearchApp.config(['$routeProvider', function($routeProvider) {
    $routeProvider
        .when('/', {templateUrl: '/apexcomponent/SimpleSearch', 
            controller: 'SimpleSearchCtrl'})
        .when('/advsrch', {templateUrl: sitePrefix+'/apexcomponent/AdvancedSearch', 
            controller: 'AdvancedSearchCtrl'})
        .otherwise({redirectTo: '/'});
}]);

It works when using Administator user (salesforce licence) because admin has "Customize Application" permission.
When using simple user (Other than salesforce licence e.g. salesforce platform licence) I am getting a 500 Internal server error in browser console for component.
In the error log we found the below message.
You do not have sufficient privileges to access the page: /apexcomponent/SimpleSearch httpReferer=https-//c-naNN-visual-force-com/apex/Search
Hello everyone,
    
    Can anyone help on the below issue.
    
I am using visualforce with angularjs.
I have a visualforce page (Search) and two apex components (SimpleSearch and AdvancedSearch).
I am loading the apex components into the page through angularjs using routeprovider.
 
SearchApp.config(['$routeProvider', function($routeProvider) {
    $routeProvider
        .when('/', {templateUrl: '/apexcomponent/SimpleSearch', 
            controller: 'SimpleSearchCtrl'})
        .when('/advsrch', {templateUrl: sitePrefix+'/apexcomponent/AdvancedSearch', 
            controller: 'AdvancedSearchCtrl'})
        .otherwise({redirectTo: '/'});
}]);

It works when using Administator user (salesforce licence) because admin has "Customize Application" permission.
When using simple user (Other than salesforce licence e.g. salesforce platform licence) I am getting a 500 Internal server error in browser console for component.
In the error log we found the below message.
You do not have sufficient privileges to access the page: /apexcomponent/SimpleSearch httpReferer=https-//c-naNN-visual-force-com/apex/Search

I am trying to update the inner class object field value before saving, but not able to do so.

I have 2 object
1. Purchase Details
2. Purchase Items List
Object 1 is master Object and Object 2 is Detailed Object
I had designed a VF page & apex page for capturing the complete data in a single page.
I am able to capture the both Objects data and able to save.
Suppose I want to delete a record from object 2 before saving, yes I am able to do so.
Suppose I want to do changes for a added record in Object 2 before saving. I am not able to do so .
So Please someone guide me on how to achive it.
Please find the below VF & Apex Code.

 

<apex:page standardController="Purchase_Item__c" extensions="PurchaseOrderClass" >
    <apex:form id="form">
        <apex:pageMessages />
        <apex:pageBlock mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!doSave}" value="Save" />
                <apex:commandButton action="{!cancel}" value="Cancel" />            
                </apex:pageBlockButtons>
            <apex:pageBlockSection title="Purchase Order Details" columns="2">
                <apex:inputField value="{!myPurchaseOrder.Name}"/>
                <apex:inputField value="{!myPurchaseOrder.Purchase_Date__c}"/>
                <apex:inputField value="{!myPurchaseOrder.Purchase_Order_Type__c}"/>
                <apex:inputField value="{!myPurchaseOrder.Vendor__c}"/>
                <apex:inputField value="{!myPurchaseOrder.Status__c}"/>
            </apex:pageBlockSection>
            <apex:pageblocksection title="Purchase Item Details" id="purchaseItemDetailsSection" columns="3" >
                <apex:inputField value="{!purchaseItemRec.Purchase_Item_Name__c}"  />
                <apex:inputfield value="{!purchaseItemRec.Quantity__c}" />
                <apex:inputfield value="{!purchaseItemRec.Unit_Price__c}" />
            </apex:pageblocksection>
            <div align="center">
                <apex:commandButton action="{!doAdd}" value="add" rerender="purchaseItemDetailsSection,purchaseItemsListSection"  />
            </div>            
            <apex:pageblocksection title="Purchase Items List" id="purchaseItemsListSection">
                <apex:pageBlockTable value="{!purchaseItemsClassList}" var="a">
                    <apex:column headerValue="Indent">
                        <apex:outputText value="{!a.indent}" />
                    </apex:column>
                    <apex:column headerValue="Purchase Items Name">
                        <apex:outputText value="{!a.purchaseItemClsObj.Purchase_Item_Name__c}" rendered="{!a.editDelShow}"/>
                        <apex:inputtext value="{!modPurItmName}" rendered="{!a.doneCancelShow}" />
                    </apex:column>
                    <apex:column headerValue="Purchase Quantity">
                        <apex:outputtext value="{!a.purchaseItemClsObj.Quantity__c}" rendered="{!a.editDelShow}"/>
                        <apex:inputtext value="{!modPurQnty}" rendered="{!a.doneCancelShow}" />
                    </apex:column>
                    <apex:column headerValue="Unit Price">                
                        <apex:outputtext value="{!a.purchaseItemClsObj.Unit_Price__c}" rendered="{!a.editDelShow}"/>
                        <apex:inputtext value="{!modPurUntPr}" rendered="{!a.doneCancelShow}" />  
                    </apex:column>
                    <apex:column headerValue="Action"> 
                        <apex:commandLink value="Edit" action="{!editPurchaseItem}" immediate="true" rendered="{!a.editDelShow}" rerender="purchaseItemsListSection"><apex:param name="editIndent" value="{!a.indent}" assignTo="{!editIndent}"/></apex:commandLink> 
                        <apex:commandLink value="Done" action="{!editDonePurchaseItem}" immediate="true" rendered="{!a.doneCancelShow}" rerender="purchaseItemsListSection"><apex:param name="doneIndent" value="{!a.indent}" assignTo="{!doneIndent}"/></apex:commandLink> / 
                        <apex:commandLink value="Delete" action="{!deletePurchaseItem}" immediate="true" rendered="{!a.editDelShow}" rerender="purchaseItemsListSection"><apex:param name="delIndent" value="{!a.indent}" assignTo="{!delIndent}"/></apex:commandLink> 
                        <apex:commandLink value="Cancel" action="{!editCancelPurchaseItem}" immediate="true" rendered="{!a.doneCancelShow}" rerender="purchaseItemsListSection"><apex:param name="cancelIndent" value="{!a.indent}" assignTo="{!cancelIndent}"/></apex:commandLink>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageblocksection>                
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

public with sharing class PurchaseOrderClass {

    public Purchase_Order__c myPurchaseOrder;
    public Purchase_Item__c purchaseItemRec {get; set;}
    private Integer nextIdent=0;
    public static Integer editIndent {get; set;}
    public static Integer delIndent {get; set;}
    public static Integer doneIndent {get; set;}
    public static Integer cancelIndent {get; set;}
    
    public static String modPurItmName {get; set;}
    
    public static String getModPurItmName(){
    	return modPurItmName;
    }
    
    public static Decimal modPurQnty {get; set;}
    
    public static Decimal getModPurQnty(){
    	return modPurQnty;
    }
    
    public static Decimal modPurUntPr;
    
    public static Decimal getModPurUntPr(){
    	return modPurUntPr;
    }
    
    public void setModPurUntPr(Decimal arg){
    	modPurUntPr = arg;
    }
    
    public PurchaseOrderClass(ApexPages.StandardController controller) {
        purchaseItemRec = (Purchase_Item__c)Controller.getRecord();
        this.myPurchaseOrder = new Purchase_Order__c();
    }

    public Purchase_Order__c getMyPurchaseOrder(){
            return myPurchaseOrder;
    }
    
    public PageReference doSave()
    {
        insert myPurchaseOrder;
        List<Purchase_Item__c> purItmLst = new List<Purchase_Item__c>();
        for(purchaseItemsRecord purItmClsRec : purchaseItemsClassList){
        	purItmClsRec.purchaseItemClsObj.Purchase_Order__c = this.myPurchaseOrder.id;
        	purItmLst.add(purItmClsRec.purchaseItemClsObj);
        }
        insert purItmLst;
        PageReference pr = new PageReference('/'+this.myPurchaseOrder.id);
        return pr;
    }
    
    public void doAdd(){
            
        purchaseItemsClassList.add(new purchaseItemsRecord(purchaseItemRec,nextIdent++));
        purchaseItemRec = new Purchase_Item__c();
    }
    
    public void editPurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(editIndent == purchaseItemsClassList[Idx].indent){
		    	modPurItmName	= purchaseItemsClassList[Idx].purchaseItemClsObj.Purchase_Item_Name__c;
		    	modPurQnty		= purchaseItemsClassList[Idx].purchaseItemClsObj.Quantity__c;
		    	modPurUntPr		= purchaseItemsClassList[Idx].purchaseItemClsObj.Unit_Price__c;
		    	system.debug('in edit method########################');
		    	system.debug('modPurItmName: '+modPurItmName);
            	system.debug('modPurQnty: '+modPurQnty);
            	system.debug('modPurUntPr: '+modPurUntPr);
		    	
                purchaseItemsClassList[Idx].editDelShow=false;
                purchaseItemsClassList[Idx].doneCancelShow=true;
                break;
            }
        }
    }
	
    public void editCancelPurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(cancelIndent == purchaseItemsClassList[Idx].indent){
                purchaseItemsClassList[Idx].editDelShow=true;
                purchaseItemsClassList[Idx].doneCancelShow=false;
                break;
            }
        }
    }
	
	public string test{get;set;}
    public void editDonePurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(doneIndent == purchaseItemsClassList[Idx].indent){
            	system.debug('in done method########################');
            	system.debug('modPurItmName: '+getModPurItmName());
            	system.debug('modPurQnty: '+getModPurQnty());
            	system.debug('modPurUntPr: '+getModPurUntPr());
		    	purchaseItemsClassList[Idx].purchaseItemClsObj.Purchase_Item_Name__c = modPurItmName;
		    	purchaseItemsClassList[Idx].purchaseItemClsObj.Quantity__c = modPurQnty;
		    	purchaseItemsClassList[Idx].purchaseItemClsObj.Unit_Price__c = modPurUntPr;
                purchaseItemsClassList[Idx].editDelShow=true;
                purchaseItemsClassList[Idx].doneCancelShow=false;
                break;
            }
        }
    }

    public void deletePurchaseItem(){
        for(Integer Idx=0;Idx<purchaseItemsClassList.size();Idx++){
            if(delIndent == purchaseItemsClassList[Idx].indent){
                purchaseItemsClassList.remove(Idx);
                break;
            }
        }
    }
    
    public List<purchaseItemsRecord> purchaseItemsClassList = new List<purchaseItemsRecord>();
    public class purchaseItemsRecord {
        public Purchase_Item__c purchaseItemClsObj{get;set;}
        public Integer indent{get;set;}
        public Boolean editDelShow{get; set;}
        public Boolean doneCancelShow{get; set;}
        public purchaseItemsRecord(Purchase_Item__c purchaseItemClsObjArg,Integer indentArg){
            indent = indentArg;
            purchaseItemClsObj = purchaseItemClsObjArg;
	        editDelShow=true;
	        doneCancelShow=false;
        }
    }
    
    public List<purchaseItemsRecord> getpurchaseItemsClassList(){
        return purchaseItemsClassList;
    }

}

 

Thanks in Advance.

 

I have created a tab called 'My Tab' that's linked to visualforce page /apex/MyVFPage. I can probably get url to this page using PageReference and partial page logic for /apex/MyVFPage. However, is there any better way to the url, may be using tab name?