• Bibhu
  • NEWBIE
  • 0 Points
  • Member since 2010

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

 

Hi I have an requirement where I am stuck. I want to display values of a picklist based on record type in Visual Force Page.

I have an Scontrol which directs the User to the VF page after he selects the record type and clicks on continue button. However I find all the values present in the picklist is displayed to the user ,  picklist value is not getting filtered based on the record type he select.

Scontrol which over-rides New Button is

 

<script type="text/javascript" src="/static/013008/js/functions.js"></script><script type='text/javascript' src='/soap/ajax/13.0/connection.js'></script><script src="/soap/ajax/13.0/apex.js" type="text/javascript"></script> <script  src="/dJS/en/1213010380000/library.js" type="text/javascript"></script><script type="text/javascript"

src="/static/013008/desktop/desktopAjax.js"></script><script type='text/javascript'>

 

 

if('{!$Profile.Name}'=='RE_Austria _FieldSales_User' || '{!$Profile.Name}'=='REAustria_BUM_Profile' || '{!$Profile.Name}'=='REAustria_Product_Manager' || '{!$Profile.Name}'=='REAustria_Sales_Manager' ||'{!$Profile.Name}'=='System Administrator')

{

window.parent.location.href='/apex/Sample_New_Related_List?ent={!BXEU_Samples__c.Id }&RecordType={!BXEU_Samples__c.RecordTypeId}';}

 

else

{

window.parent.location.href=window.parent.location.href+'&nooverride=0';

}

</script>

 

 

 

  • October 06, 2011
  • Like
  • 0

Hi 

I am getting an error in our production environment , whenever a BXUK_Key_Account_Management__c record is created.

"Too many DML rows"  , I have pasted the code below. Kindly show me the way to efficiently rewrite the code. Appreciate your help.

trigger TGR_Push_Classification_at_Account_Level on BXUK_Key_Account_Management__c (after Update, after Insert) 
{
    List<Account> accList = new List<Account>();
    Map<id,String> kamBSMap = new Map<id,String>();
    Map<id,String> kamHCMap = new Map<id,String>();
    Set<id> accIdSet = new Set<id>();
    Map<String,String> classificationMap = new Map<String,String>();
    classificationMap.put('Key Account', 'A');
    classificationMap.put('Key Development Account', 'B');
    classificationMap.put('Maintenance Account', 'C');
    classificationMap.put('Standard Account', 'D');
    
    
    for(BXUK_Key_Account_Management__c kam : Trigger.new)
    {
        accIdSet.add(kam.BXUK_Account__c);
        
        if(kam.BXUK_Business_Unit__c != null && !''.equals(kam.BXUK_Business_Unit__c))
        {
            if(kam.BXUK_Business_Unit__c == 'Biosurgery')
            {
                kamBSMap.put(kam.BXUK_Account__c,classificationMap.get(kam.BXEU_Account_Classification__c));
            }
            if(kam.BXUK_Business_Unit__c == 'Hospital Care')
            {
                kamHCMap.put(kam.BXUK_Account__c,classificationMap.get(kam.BXEU_Account_Classification__c));
            }

        }
    }
    Account[] departments = [select id from Account where ParentId in : accIdSet OR parent.ParentId in : accIdSet];
    
    for(Account dept: departments)
    {
    accIdSet.add(dept.Id);
    }

    Account[] accs = [select id,ParentId,Parent.ParentId, BXEU_Biosurgery_Classification__c, BXEU_Hospital_Care_Classification__c from Account where id in:accIdSet];
    
    
    for(Account acc : accs)
    {
       if(kamBSMap.containsKey(acc.Id))
       {
          acc.BXEU_Biosurgery_Classification__c = kamBSMap.get(acc.Id);
       }
       else if(kamBSMap.containsKey(acc.ParentId))
       {
          acc.BXEU_Biosurgery_Classification__c = kamBSMap.get(acc.ParentId);
       }
       else if(kamBSMap.containsKey(acc.Parent.ParentId))
       {
          acc.BXEU_Biosurgery_Classification__c = kamBSMap.get(acc.Parent.ParentId);
       }

       if(kamHCMap.containsKey(acc.Id))
       {
            acc.BXEU_Hospital_Care_Classification__c = kamHCMap.get(acc.Id);
       }
       else if(kamHCMap.containsKey(acc.ParentId))
       {
          acc.BXEU_Hospital_Care_Classification__c = kamHCMap.get(acc.ParentId);
       }
       else if(kamHCMap.containsKey(acc.Parent.ParentId))
       {
          acc.BXEU_Hospital_Care_Classification__c = kamHCMap.get(acc.Parent.ParentId);
       }
    
       accList.add(acc);
    }

    try        
    {
    if(accList.size()>0){
    update accList;
    }
    }
    catch(Exception e)       
    {        
    System.debug(e.getMessage());        
    }

 }

 

Thanks

 

Bibhu

 

  • December 27, 2011
  • Like
  • 0

I have a custom object with 4 record types.Each RT has a custom VF page and I want to replace the standard "View" so that each record type displays it's respective VF page.

 

I was using a formula based, page include methid (pasted below) which was working but I changed something and can't seem to fix it. It now renders the same VF page for both RT's.

 

<apex:page standardController="Sales_Tool__c">
<apex:outputPanel rendered="{!IF(Sales_Tool__c.RecordTypeId!='012S00000004SX5',true,false)}">
<apex:include pageName="Assessment_Form" />
</apex:outputPanel>
<apex:outputPanel rendered="{!IF(Job_Aid__c.RecordTypeId!='012S00000004SX0',true,false)}">
<apex:include pageName="CompellingEvent_Form" /> 
</apex:outputPanel>
</apex:page>

Can someone please help me figure what's wrong this?I have a deadline to deploy this so any help would be appreciated. 

 

If you're wondering why I'm not using all apex class/page sample from the cookbook, the reason is I've inherited an sfdc environment where there poor test coverage for existing code and until that's fixed,I cant do anything new.

 

Apex page action may be the answer, I did toy around with that but I'm not too familiar with VF and couldn't quite get that to work. 

 

Thanks

  • October 03, 2011
  • Like
  • 0

HI All

 

I'm trying to display picklist values specific to a recordtype.

I have a visual force page which uses standard controller and an extension.


We are assigning the recordtype based on specific criteria with in the constructor.

http://developer.force.com/releases/release/Winter11/Visualforce+Support+for+Record+Types

As per the documentation, by using inputfield and version 20. I should be able to achieve what im trying to do.

But it is not working..

 

Im sure there is something wrong with my method.

 

Any pointers will be great help.

 

Thanks

Swapna

 

  • January 19, 2011
  • Like
  • 0

Hi,

 

I modified the Inline Account Hierarchy app by Force.com labs for a custom object and it works fine. But for users who have 'Read-only' acces permissions on the custom object, they are unable to view the page.

Can anyone help me with this. It is an urgent request.

 

Thanks in advance.

Hi,

 

I have a Visualforce page and a controller class.

Using "With Sharing" keyword, i am able to retrieve the records from the Custom object just as a Standard Salesforce functionality does.

Now my requirement is to retrieve all the Subordinate Roles for logged in User that should be displayed in drop-down.

There are more than 400 Roles in my org.

My Role stands 5th or 6th from the top.

 

Even if i use SOQL For loop to get all the Subordinate Roles, i am running in to Too many SOQL queries : 101.

Below is my code.

 

public method1()

         //get Subordinate Roles for the CurrentRole

        for(UserRole[] roleList : [Select id, name, parentroleid from UserRole ur Where ur.ParentRoleId :UserInfo.getUserRoleId() order by name])

        {
            for(UserRole role: roleList)
            {
                currentUserSubDetails.add(role);//Add to list
            }

         }

        

        //Retrieve Subordinate roles for each Role

        for(Integer i=0; i<currentUserSubDetails.size(); i++)
        {
            getRolesAtDeeperLevel(currentUserSubDetails[i]);
        }


 }

 

   private void getRolesAtDeeperLevel(UserRole ur)
    {
        for(UserRole[] roleList : [select id, name, ParentRoleId from UserRole where ParentRoleId = :ur.id order by name])
            for(UserRole role: roleList)
            {
                currentUserSubDetails.add(role);
            }
    }

Can anyone suggest me a solution?

 

Regards OnDem

Message Edited by OnDem Dev on 07-09-2009 10:28 AM