• Praveen Venkata B
  • NEWBIE
  • 49 Points
  • Member since 2015


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 6
    Questions
  • 17
    Replies
I'm trying to enable to disable/Enable tabs based on multiple conditions on Visualforce page. Below is my JS and Tabs UI code:

Out of two if conditions, only the last if condition is disabling tabs even when both of the if conditions are true. When both the conditions are true, i'm getting alter messages for both but only the last if condition is actually disabling tabs but not the first if condition.

Please help me !!
function disableEnableTabs()
    {
        var variable1=value can be either true/false;
        var variable2=count of some records;
        var variable3=value can be either Active or Inactive;
        
        if(variable3!='Active' || variable1=='false')
        {
            $("#tabs").tabs("option", {
            "disabled": [2]
            });
            alert("Into Active or False");
        }
        
        if(variable2==0)
        {
            $("#tabs").tabs("option", {
            "disabled": [3,4]
            });
            alert("Into Count");
        }
        
        else
        {
            $("#tabs").tabs('enable');
        }
<div id="tabs" clas="ui-tabs ui-widget ui-widget-content ui-corner-all" style="border:none;">
        <div >
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#tab1" style="text-decoration:none; font-weight: 700; color:black">Tab A</a>
                </li>
                <li>
                    <a href="#tab2" style="text-decoration:none; font-weight: 700;color:black">Tab B</a>
                </li>
                <li>
                    <a href="#tab3" style="text-decoration:none; font-weight: 700;color:black">Tab C</a>
                </li>
                <li>
                    <a href="#tab4" style="text-decoration:none; font-weight: 700;color:black">Tab D</a>
                </li>
                <li>
                    <a href="#tab5" style="text-decoration:none; font-weight: 700;color:black">Tab F</a>
                </li>
            </ul>   
        </div>


 
I'm using jquery ui tabs on my Visualforce page. Below is the code:
 
<div id="tabs" clas="ui-tabs ui-widget ui-widget-content ui-corner-all">
        <div>
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#tab1" style="text-decoration:none; font-weight: 700; color:black">TAB_A</a>
                </li>
                <li>
                    <a href="#tab2" style="text-decoration:none; font-weight: 700;color:black">TAB_B</a>
                </li>
                <li>
                    <a href="#tab3" style="text-decoration:none; font-weight: 700;color:black">TAB_C</a>
                </li>
                <li>
                    <a href="#tab4" style="text-decoration:none; font-weight: 700;color:black">TAB_D</a>
                </li>
                <li>
                    <a href="#tab5" style="text-decoration:none; font-weight: 700;color:black">TAB_E</a>
                </li>
            </ul>   
        </div>
I have defined each tab as below:
 
        <section id="tab1" class="tab-content active">
            <div style="padding:12px;border-right: 1px solid #C0C0C0 !important;border-left: 1px solid #C0C0C0       !important;border-bottom: 1px solid #C0C0C0 !important;">
                Content in tab 1
            </div>
        </section>

In TAB_B tab, i have a radio buttons field "Are you sure" with vaues "Yes" or "No". Upon clicking on save, i'm saving this selected value to a checkbox field "proceed__c" on to the record. If it is Yes, then check box is checked on record. And if it is No, checkbox is unchecked on record.

Now depending on the value available on the checkbox for a record, i need to enable next tab i.e., TAB_C. If the checkbox is checked on the record, i need to enable TAB_C. If it is unchecked, then even if user clicks on TAB_C, nothing should happen.

Please help to code this.

I'm trying to buit below jquery tab styling on Visualforce page:

 

User-added image

 

My code gives me below styling:

 

User-added image

 

Below is my code:

 

<apex:page standardController="Account" standardStylesheets="false" doctype="html-5.0" cache="false">

<apex:includeScript value="https://code.jquery.com/jquery-1.10.2.js"/>
<apex:includeScript value="https://code.jquery.com/ui/1.11.4/jquery-ui.js"/>
<apex:includeScript value="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<apex:stylesheet value="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<apex:stylesheet value="https://resources/demos/style.css"/>

<body>
    <div id="tabs">
  <ul>
    <li><a href="#tabs-1">Tab A</a>
    </li>
    
    <li><a href="#tabs-2">Tab B</a>
    </li>
    
    <li><a href="#tabs-3">Tab C</a>
    </li>
  </ul>
  
  <div id="tabs-1">
    <p>Content for tabs-A</p>
  </div>
  
  <div id="tabs-2">
    <p>Content for tabs-B</p>
  </div>
  
  <div id="tabs-3">
    <p>Content for tabs-C</p>
  </div>
  
</div>
</body>

<script type="text/javascript">
    jQuery.noConflict();
    jQuery(document).ready(function() {
        jQuery( "#tabs" ).tabs();
    });
</script>

</apex:page>


 

Please help me in fixing the tab stylings. Thanks in advance !!

Regards,
Praveen Venkata.

Help me in creating test class for below class with 100% code coverage. I have done User creation part in test class. Let me know how to create exception in test class for below class:

Below is the hierarchecal share class:
public without sharing class  UserForm_ManagerHierarchyHandler{

    List<User_form__Share> listOfUserformShare = new List<User_form__Share>();
    
    //Method to retrieve the manager's up the hierarchy
    public void retrieveManagerHierarchy(User_form__c  userFormRecord){
        String accessLevel = 'edit';
        try{
            Id UFOwnerId = userFormRecord.Employee__c;
            
            if(UFOwnerId !=NULL){
                User newUser = new User();
                newUser = [SELECT Id,managerId from User where Id=:UFOwnerId ];
                if(newUser.managerId!=NULL){
                    do{
                        SharingProcess(newUser,userFormRecord,accessLevel );
                        Id managerId = newUser.managerId;                        
                        newUser = [Select Id,managerId from User where Id=:managerId ];
                        accessLevel = 'read';
                    }        
                    while(newUser.managerId!=NULL);
                }
                
                if(listOfUserFormShare .size()>0){
                    Database.Insert(listOfUserFormShare,false);
                }
            }
        }
        catch(Exception e){
        }
    }
    
    
    // Method to share the record to Manager's up in the Hierarchy
    public void sharingProcess(User newUser, User_Form__c newUserForm,String Access){
        User_form__Share newUserFormShare = new User_form__Share();
        newUserFormShare.parentId = newUserForm.Id;
        newUserFormShare.AccessLevel = Access;
        newUserFormShare.UserOrGroupId = newUser.managerId;
        listOfUserFormShare.add(newUserFormShare);  
    }
}
I have 3 Objects, 3 Users with Standard Platform User profile and 3 Permission set for each User. In the Standard Platform User profile, i haven't given any Create, Read, Edit, Delete, View all, Modify all permissions to any of the 3 objects.

Object1 is master to both Object2 and Object3 with MD relationship.

User1 have Permission set1 with Read access to Object1, Object2 and No access to Object3.

User2 have Permission set2 with Read, Create, Edit permission to Object1, Object2 and Read permission to Object3.

User3 have Permission set3 with Read, Create, Edit permission to Object1 and Read permission to Object2 and Read, Create, Edit permission to Object3.

Now User2 able to create Record in Object1 as he have Create permission in permission set2. Even though User3 have Create permission in Permission Set3 for Object1, he is not able to create record in Object1(New button is enabled as well).

What might be causing this issue?

I have added a VF page as a Component on Home page, now upon clicking on a record link, it need to direct the entire page to corresponding detail page. But this code displays the detail record on the component itself, not redirecting entire page to the record detail page. Below is my VF code:

Component on Home page:
Component on Home page
Detail view upon clicking recod link:

Detail page
But i need entire page need to be directed to record's detail page.

Below is my VF code:

<apex:page controller="RecAccConCtrl">
    <apex:pageBlock title="Recent Accounts & Contacts">
    
        <apex:pageBlockSection title="Accounts" columns="1" id="AccL">
            <apex:pageBlockTable value="{!Accounts}" var="Acc" >
                <apex:column headerValue="Account Name">
                    <apex:outputLink value="/{!Acc.id}" >{!Acc.name}</apex:outputLink>
                </apex:column>
                <apex:column value="{!Acc.Fax}"/>
                <apex:column value="{!Acc.Phone}"/>
                <apex:column value="{!Acc.Industry}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>

    </apex:pageBlock>
</apex:page>


Below is my Controller:

public with sharing class RecAccConCtrl
{
    List<Account> myAcc;
    public List<Account> getAccounts() 
    {
        myAcc = [select Id, Name, Fax, Phone, Industry from Account order by CreatedDate DESC limit 5];
        return myAcc;
    }
}

Thanks,
Praveen venkata.
I'm using jquery ui tabs on my Visualforce page. Below is the code:
 
<div id="tabs" clas="ui-tabs ui-widget ui-widget-content ui-corner-all">
        <div>
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#tab1" style="text-decoration:none; font-weight: 700; color:black">TAB_A</a>
                </li>
                <li>
                    <a href="#tab2" style="text-decoration:none; font-weight: 700;color:black">TAB_B</a>
                </li>
                <li>
                    <a href="#tab3" style="text-decoration:none; font-weight: 700;color:black">TAB_C</a>
                </li>
                <li>
                    <a href="#tab4" style="text-decoration:none; font-weight: 700;color:black">TAB_D</a>
                </li>
                <li>
                    <a href="#tab5" style="text-decoration:none; font-weight: 700;color:black">TAB_E</a>
                </li>
            </ul>   
        </div>
I have defined each tab as below:
 
        <section id="tab1" class="tab-content active">
            <div style="padding:12px;border-right: 1px solid #C0C0C0 !important;border-left: 1px solid #C0C0C0       !important;border-bottom: 1px solid #C0C0C0 !important;">
                Content in tab 1
            </div>
        </section>

In TAB_B tab, i have a radio buttons field "Are you sure" with vaues "Yes" or "No". Upon clicking on save, i'm saving this selected value to a checkbox field "proceed__c" on to the record. If it is Yes, then check box is checked on record. And if it is No, checkbox is unchecked on record.

Now depending on the value available on the checkbox for a record, i need to enable next tab i.e., TAB_C. If the checkbox is checked on the record, i need to enable TAB_C. If it is unchecked, then even if user clicks on TAB_C, nothing should happen.

Please help to code this.

I'm trying to buit below jquery tab styling on Visualforce page:

 

User-added image

 

My code gives me below styling:

 

User-added image

 

Below is my code:

 

<apex:page standardController="Account" standardStylesheets="false" doctype="html-5.0" cache="false">

<apex:includeScript value="https://code.jquery.com/jquery-1.10.2.js"/>
<apex:includeScript value="https://code.jquery.com/ui/1.11.4/jquery-ui.js"/>
<apex:includeScript value="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<apex:stylesheet value="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"/>
<apex:stylesheet value="https://resources/demos/style.css"/>

<body>
    <div id="tabs">
  <ul>
    <li><a href="#tabs-1">Tab A</a>
    </li>
    
    <li><a href="#tabs-2">Tab B</a>
    </li>
    
    <li><a href="#tabs-3">Tab C</a>
    </li>
  </ul>
  
  <div id="tabs-1">
    <p>Content for tabs-A</p>
  </div>
  
  <div id="tabs-2">
    <p>Content for tabs-B</p>
  </div>
  
  <div id="tabs-3">
    <p>Content for tabs-C</p>
  </div>
  
</div>
</body>

<script type="text/javascript">
    jQuery.noConflict();
    jQuery(document).ready(function() {
        jQuery( "#tabs" ).tabs();
    });
</script>

</apex:page>


 

Please help me in fixing the tab stylings. Thanks in advance !!

Regards,
Praveen Venkata.

Give me a count of  the contacts for an Account Like 123??

SELECT Name,Id (SELECT count() FROM Contact) FROM Account WHERE Name like '%123%'
but its gives error..
I have 3 Objects, 3 Users with Standard Platform User profile and 3 Permission set for each User. In the Standard Platform User profile, i haven't given any Create, Read, Edit, Delete, View all, Modify all permissions to any of the 3 objects.

Object1 is master to both Object2 and Object3 with MD relationship.

User1 have Permission set1 with Read access to Object1, Object2 and No access to Object3.

User2 have Permission set2 with Read, Create, Edit permission to Object1, Object2 and Read permission to Object3.

User3 have Permission set3 with Read, Create, Edit permission to Object1 and Read permission to Object2 and Read, Create, Edit permission to Object3.

Now User2 able to create Record in Object1 as he have Create permission in permission set2. Even though User3 have Create permission in Permission Set3 for Object1, he is not able to create record in Object1(New button is enabled as well).

What might be causing this issue?
Hi, 
I am trying to create a contact associated with a new business account. See below:

trigger CreateAccountContact on Account (after insert, after update){
if(Trigger.isInsert){
    List<Contact> ct = new List <Contact>();
    for(Account acc : trigger.new){
        Contact c = new Contact(LastName = acc.name,
                    AccountId=acc.id,
                    Fax=acc.Fax,
                    MailingStreet=acc.BillingStreet,
                    MailingCity=acc.BillingCity,
                    MailingState=acc.BillingState,
                    MailingPostalCode=acc.BillingPostalCode,
                    MailingCountry=acc.BillingCountry,
                    Address__c=acc.Address__c,
                    Phone=acc.Phone,
                    Email=acc.Email_address__c);
        ct.add(c);
    }
    insert ct;
 }
}


The only problem is that it also triggers when Personal account is created. I need to add a line in the code to only assosiate it to business accounts. Is there a way?

Thanks,
Inna 
Hi Friends 

How to achieve this type of error in the bellow trigger..

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger realtime2 caused an unexpected exception, contact your administrator: realtime2: execution of AfterInsert caused by: System.FinalException: Record is read-only: Trigger.realtime2: line 8, column 1

 
trigger realtime2 on BankBook__c (after insert)
{
   
  
        for(BankBook__c stuObj:Trigger.new)
        {
          
            stuObj.New_Closing_Bal__c= stuObj.New_Related_Bank_Acc__c;
            }
        }

 

I have added a VF page as a Component on Home page, now upon clicking on a record link, it need to direct the entire page to corresponding detail page. But this code displays the detail record on the component itself, not redirecting entire page to the record detail page. Below is my VF code:

Component on Home page:
Component on Home page
Detail view upon clicking recod link:

Detail page
But i need entire page need to be directed to record's detail page.

Below is my VF code:

<apex:page controller="RecAccConCtrl">
    <apex:pageBlock title="Recent Accounts & Contacts">
    
        <apex:pageBlockSection title="Accounts" columns="1" id="AccL">
            <apex:pageBlockTable value="{!Accounts}" var="Acc" >
                <apex:column headerValue="Account Name">
                    <apex:outputLink value="/{!Acc.id}" >{!Acc.name}</apex:outputLink>
                </apex:column>
                <apex:column value="{!Acc.Fax}"/>
                <apex:column value="{!Acc.Phone}"/>
                <apex:column value="{!Acc.Industry}"/>
            </apex:pageBlockTable>
        </apex:pageBlockSection>

    </apex:pageBlock>
</apex:page>


Below is my Controller:

public with sharing class RecAccConCtrl
{
    List<Account> myAcc;
    public List<Account> getAccounts() 
    {
        myAcc = [select Id, Name, Fax, Phone, Industry from Account order by CreatedDate DESC limit 5];
        return myAcc;
    }
}

Thanks,
Praveen venkata.
I am new to apex, I have created a button to call the apex class through the visual force page. 

Here is my visual force page code. 
<apex:page standardController="Opportunity"
 extensions="myclass"
 action="{!autoRun}">
</apex:page>
Here is my apex class.
public class myclass {
    private final Opportunity o;
    String tmp;
   public myclass(ApexPages.StandardController stdController) {
        this.o = (Opportunity)stdController.getRecord();
    }
    public PageReference autoRun() {
        String theId = ApexPages.currentPage().getParameters().get('id');
 
        for (Opportunity o:[select id, name, AccountId,  from Opportunity where id =:theId]) {
 
                 //Create the Order
                    Order odr = new Order( 
                    OpportunityId=o.id
                    ,AccountId = o.AccountId
                    ,Name = o.Name
                    ,EffectiveDate=Date.today()
                    ,Status='Draft'
                    );
                insert odr;
                tmp=odr.id;            
              }                 
        PageReference pageRef = new PageReference('/' + tmp); 
        pageRef.setRedirect(true);
        return pageRef;
      }
}
I want to create test class. I don't know how to refer PageReference autoRun() method from test class. Guys need help if some one can tell me about test class of this apex class. 
 
Hi

I assume this is simple enough, but don't want to waste time figuring it out.  I'm trying to render the Name of a Record as a link to the Record in a column of a pageBlockTable.

I'm using this syntax currently:

Code:
<apex:column headerValue="Name">
      <apex:outputLink value="{!lead.Id}">{!lead.Name}</apex:outputLink>
</apex:column>

 Supposing I'm on a na2.salesforce.com, this will output the link as https://na2.salesforce.com/apex/00Q4000000HA9xUEAT.  Obviously I don't want the /apex/ in the URL.  I know I want to use the current server as the value in outputLink and the Record ID as a param, but how do I merge in the URL of the current server?

Thanks!

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.