• Robert Webber 6
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 12
    Replies
I need to reduce SOQL queries. I access the Organization record a lot and would like to do a query one time when my application starts and make the data available so I don't have to requery in other classes. I thought this would be a simple matter of declaring a variable as global in my home page controller, but it isn't visible from other classes. Am I misunderstanding the use of global variables, or is there a way to access Organization data without having to requery?
I have not been able to refresh a pageblocksection from a commandbutton. My VF is below. I thought I would just refresh the entire page from the commandbutton action "Investment Workflow" with the code following the VF. It doesn't do anything, either. What am I doing wrong? Appreciate any help.

Visualforce:
            <apex:pageBlockSection columns="3" id="idWorkflow" collapsible="False">
                <apex:outputText label="Current State" value="{!Development_Investment__c.WorkflowState__c}" style="font-size:15px"/>
                <apex:pageBlockSectionItem>
                    <apex:commandButton value="{!WorkflowLabel}" style="width:175px;" action="{!InvestmentWorkflow}" rerender="idWorkflow,idMessages"/>            
                    <apex:selectList value="{!SelectedWorkflowState}" size="1" style="width:150px" disabled="{!if(Development_Investment__c.WorkflowApprovalState__c='Submitted','True','False')}" >
                        <apex:selectOptions value="{!WorkflowStateOptions}"/>                        
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>

InvestmentWorkflow return code:

        String url = '/'+investmentID;
        PageReference page = new PageReference(url);
        page.setRedirect(True);
        return page;



 
This is something that should be simple but I'm stuck. I am trying to assign an approval to a related user. Object1 has a lookup to Object2. I want to use the Owner of Object2 as the approver when I kick of the approval from Apex. I have tried creating a hierarchical field on the User object called "PLOwner__c", and I assign it to the Owner.ID of Object2 when a submit button is clicked. I get the error:

first error: CIRCULAR_DEPENDENCY, attempt to violate hierarchy constraints: [plowner__c]

Is there an easy way to assign the owner of a related record as next approver from Apex? The Salesforce documentation is confusing.

Bob

 
I am confused about how to actually log into my dev hub. I have set it up OK from my partner business org by enabling everything. But, how do I actually log into the hub to create a sandbox. All the Salesforce help information starts with, "Log into the Environment Hub" as if it is obvious. What do I do after enabling the hub?
I have been updating my sandbox using the ant migration tool. My sandbox has all my test data. I created a managed package from my dev environment and uploaded it successfully. I used the link to log into my sandbox to install. After installation, the records are not visible, and I have multiple tabs with the same name. Apparently, it doesn't remove the components with the same name and adds them with an indication that they are managed.

Do I have to manually delete all the other components? And, why can't I see the data. I know it's in there with a query from the developer console.

Help please.
I need to reduce SOQL queries. I access the Organization record a lot and would like to do a query one time when my application starts and make the data available so I don't have to requery in other classes. I thought this would be a simple matter of declaring a variable as global in my home page controller, but it isn't visible from other classes. Am I misunderstanding the use of global variables, or is there a way to access Organization data without having to requery?
I have not been able to refresh a pageblocksection from a commandbutton. My VF is below. I thought I would just refresh the entire page from the commandbutton action "Investment Workflow" with the code following the VF. It doesn't do anything, either. What am I doing wrong? Appreciate any help.

Visualforce:
            <apex:pageBlockSection columns="3" id="idWorkflow" collapsible="False">
                <apex:outputText label="Current State" value="{!Development_Investment__c.WorkflowState__c}" style="font-size:15px"/>
                <apex:pageBlockSectionItem>
                    <apex:commandButton value="{!WorkflowLabel}" style="width:175px;" action="{!InvestmentWorkflow}" rerender="idWorkflow,idMessages"/>            
                    <apex:selectList value="{!SelectedWorkflowState}" size="1" style="width:150px" disabled="{!if(Development_Investment__c.WorkflowApprovalState__c='Submitted','True','False')}" >
                        <apex:selectOptions value="{!WorkflowStateOptions}"/>                        
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>

InvestmentWorkflow return code:

        String url = '/'+investmentID;
        PageReference page = new PageReference(url);
        page.setRedirect(True);
        return page;



 
I get invalid login,password or locked out when I try to run the ant migration tool. I have changed password and security token and still have the same problem. This used to work. Did something change?

Below is my buld.xml (with user name and password changed) followed by build.properties. Any idea how to fix or debug?
Thanks
Bob

Build.xml
<project name="Sample usage of Salesforce Ant tasks" default="test" basedir="." xmlns:sf="antlib:com.salesforce">

    <property file="build.properties"/>
    <property environment="env"/>

    <!-- Setting default value for username, password and session id properties to empty string
         so unset values are treated as empty. Without this, ant expressions such as ${sf.username}
         will be treated literally.
    -->
    <condition property="sf.username" value=""> <not> <isset property="sf.username"/> </not> </condition>
    <condition property="sf.password" value=""> <not> <isset property="sf.password"/> </not> </condition>
    <condition property="sf.sessionId" value=""> <not> <isset property="sf.sessionId"/> </not> </condition>

    <taskdef resource="com/salesforce/antlib.xml" uri="antlib:com.salesforce">
        <classpath>
            <pathelement location="../ant-salesforce.jar" />            
        </classpath>
    </taskdef>

    <target name="getFalcon">
      <mkdir dir="Falcon"/>
      <sf:retrieve
          username="${sf.username}"
          password="${sf.password}"
          serverurl = "login.salesforce.com"
          retrieveTarget="Falcon"
          packageNames="Falcon1"/>
    </target>

Build.properties
# build.properties
#

# Specify the login credentials for the desired Salesforce organization
sf.username = username
sf.password = password
#sf.sessionId = <Insert your Salesforce session id here.  Use this or username/password above.  Cannot use both>
#sf.pkgName = <Insert comma separated package names to be retrieved>
#sf.zipFile = <Insert path of the zipfile to be retrieved>
#sf.metadataType = <Insert metadata type name for which listMetadata or bulkRetrieve operations are to be performed>

# Use 'https://login.salesforce.com' for production or developer edition (the default if not specified).
# Use 'https://test.salesforce.com for sandbox.
sf.serverurl = https://login.salesforce.com

sf.maxPoll = 20
# If your network requires an HTTP proxy, see http://ant.apache.org/manual/proxy.html for configuration.
#



 
I am confused about how to actually log into my dev hub. I have set it up OK from my partner business org by enabling everything. But, how do I actually log into the hub to create a sandbox. All the Salesforce help information starts with, "Log into the Environment Hub" as if it is obvious. What do I do after enabling the hub?
I have been updating my sandbox using the ant migration tool. My sandbox has all my test data. I created a managed package from my dev environment and uploaded it successfully. I used the link to log into my sandbox to install. After installation, the records are not visible, and I have multiple tabs with the same name. Apparently, it doesn't remove the components with the same name and adds them with an indication that they are managed.

Do I have to manually delete all the other components? And, why can't I see the data. I know it's in there with a query from the developer console.

Help please.