• Akanksha Cullen
  • NEWBIE
  • 50 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 7
    Replies
Hello, 

I have a Master - Detail Relationship between two objects, say, Tasks__c and Projects__c. Each Project is supposed bto have a few tasks. So when I display the instances of the tasks in the Tasks tab, I also want to display the details of the project it is related to. Right now, I am able to display the Project__c id, i.e., the index field, but not the name of the project or any other detail. A screenshot of the current Tab is attached below. Please help!!

PS: This is a very basic thing which I can easily do in a custom visualforce page. Calling this feild name  : Project__r.Project_Name__c.
But, how do I display this field in Salesforce defined detailed page. 
User-added image

I want to show the Project Name here as well.
Hello,

I am trying to pass a variable from a custom lookup field on my visualforce pages which fetches the project's id as selected by the user and call the fetched id in my javascript function - run().

I have been able to fetch the project's id selected by the user, print the value in my div element within the html block but not able to succesfully pass the feteched id to the run function.

Step 1
User-added image
Project ID in the div :
User-added image

Although, I see the project's id in my javascript after i inspect the element on my browser. 

User-added image

Could anyone please help me with this issue.


Here's the code :
<apex:page controller="MyCustomLookupController" readOnly="true">
<apex:includeScript value="/soap/ajax/24.0/connection.js"/> 
<apex:includeScript value="/soap/ajax/24.0/apex.js"/>

    <apex:form id="myForm">  
        <apex:PageBlock id="PageBlock">  
            <apex:pageblocksection title="Project Estimation" >       
                 <apex:inputField id="Projects__c" value="{!contact.Project__c}"  />
             </apex:pageblocksection>
   
            
            <apex:pageblockbuttons location="top">
                <apex:commandButton value="Generate Estimation Chart!" onclick="run({!contact.Project__c})"></apex:commandButton>
            </apex:pageblockbuttons>
         </apex:PageBlock>
   
   
    </apex:form>
  <html>
  <body>
       <div class="chart" style="width: 90%">
           <div id="chart">{!contact.Project__c}</div>
       </div>
  </body>
  
  <script type="text/javascript"> 
  function openLookup(baseURL, width, modified, searchParam){
    var originalbaseURL = baseURL;
    var originalwidth = width;
    var originalmodified = modified;
    var originalsearchParam = searchParam;

    var lookupType = baseURL.substr(baseURL.length-3, 3);
    if (modified == '1') baseURL = baseURL + searchParam;

    var isCustomLookup = false;

    // Following "001" is the lookup type for Account object so change this as per your standard or custom object
    if(lookupType == "001"){

      var urlArr = baseURL.split("&");
      var txtId = '';
      if(urlArr.length > 2) {
        urlArr = urlArr[1].split('=');
        txtId = urlArr[1];
      }

      // Following is the url of Custom Lookup page. You need to change that accordingly
      baseURL = "/apex/CustomAccountLookup?txt=" + txtId;

      // Following is the id of apex:form control "myForm". You need to change that accordingly
      baseURL = baseURL + "&frm=" + escapeUTF("{!$Component.myForm}");
      if (modified == '1') {
        baseURL = baseURL + "&lksearch=" + searchParam;
      }

      // Following is the ID of inputField that is the lookup to be customized as custom lookup
      if(txtId.indexOf('Projects__c') > -1 ){
        isCustomLookup = true;
      }
    }


    if(isCustomLookup == true){
      openPopup(baseURL, "lookup", 350, 480, "width="+width+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
    }
    else {
      if (modified == '1') originalbaseURL = originalbaseURL + originalsearchParam;
      openPopup(originalbaseURL, "lookup", 350, 480, "width="+originalwidth+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
    } 
   }
   
   function run(){ 
    alert('{!contact.Project__c}'); 
    var query = "SELECT End_Date__c, Duration__c,Project__c, Actual_End_Date__c, Progress__c FROM Tasks__c WHERE Project__c:= {!contact.Project__c}";   //Records from dependency table
    sforce.connection.sessionId = "{!$Api.Session_ID}";  
    var records = sforce.connection.query(query); 
    var records1 = records.getArray('records');
    alert('Initial records:'+records1);
   }
  
</script>
</html>
</apex:page>

 

I am creating a chart in my visualforce page using morris chart API. The whole page is loadng perfectly including the Chart container but still now able to load the chart. It throws me the following error : 

Graph container not found

From the Github page of Morris, I had got the solution for this error. They've mentioned that one has to include the javascript after the divs. But I have alredy done that. I have included all of my javascripts at the bottom of the page and still getting this error. 

I'd really appreciate some help!

 

Here's my div for the chart:

 

<section id="main-content">
        <section class="wrapper">
        <!-- page start-->
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <header class="panel-heading">
                            Customize Graph
                        <span class="tools pull-right">
                            <a href="javascript:;" class="fa fa-chevron-down"></a>
                            <a href="javascript:;" class="fa fa-cog"></a>
                            <a href="javascript:;" class="fa fa-times"></a>
                         </span>
                        </header>
                        <div class="panel-body">
                            <div id="graph-area"></div>
                           
                        </div>
                    </section>
                </div>
            </div>
    </section>
</section>

And I have included the scripts like this : 
 
<!--Morris Chart -->

<apex:includeScript value="{!URLFOR($Resource.mythemejs, 'js/morris-chart/morris.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.mythemejs, 'js/morris-chart/raphael-min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.mythemejs, 'js/morris.init.js')}"/>
 I don't understand why this won't work! 
 
Hey,

I had a question and I was hoping that someone could help me with it. I am trying to develop a custom a visualforce page and design the elements I am using in it such as, Charts, Tabs, etc. In my code, I am using a javascript which is hosted here : http://d3js.org/d3.v3.min.js

and using it in my code like this :
<apex:includeScript value="//d3js.org/d3.v3.min.js"/>

As it is on http and not on https, it's throwing me an error in the background as the attached picture says. Apparently, salesforce doesn't allow us to access scripts on "unsecure connection." 
User-added image

Is there any solution for this ?
This is my controller class in which I am directly inserting my queryl 
 
public class WBSDataTableController {
    public List<Tasks__c> WBSList {
        get {
            if (WBSList == null) {
                WBSList = [SELECT Task_Name__c, Start_Date__c, Project__r.Name FROM Tasks__c WHERE Project__r.Name = 'P-005'];
            }
            return WBSList;
        }
        set;
    }
}


Now when I call my Start_Date__c field which is a Date type field, in HTML like this : 

<apex:repeat value="{!WBSList}" var="tasks">
                    <tr>
                        <td>{!tasks.Task_Name__c}</td>
                       <td>{!tasks.Start_Date__c}</td>
                
                    </tr>
                </apex:repeat>
 



It shows me this value : 
Tue Feb 17 00:00:00 GMT 2015

whereas I only want the value like this : 
17 Feb 2015 

 

I know that there is an option to break it down in using date time instance but I want to add the formatted date straight into my WBSList variable. 

Any quick fixes for this?

Hey,

I need to restrict the user from entrying any duplicate values in the database. I have a Members Object. It has an auto text field and and a member name lookup field which is related to User Object. I don't want any one to pick and add any user from the look field which is already there in my Members list. 

So I have not been able to add this rule to my object. I don't want to use any triggeers for this. Validation rules had not enabled to me do this so far. I also tried to add a filter criteria to the lookup filter. It is not letting me compare the values of Current Lookup Member Name field to Current Record Member Name field. 

Could anyone please suggest any workaround for this ?

 
Hello, 

I have a Master - Detail Relationship between two objects, say, Tasks__c and Projects__c. Each Project is supposed bto have a few tasks. So when I display the instances of the tasks in the Tasks tab, I also want to display the details of the project it is related to. Right now, I am able to display the Project__c id, i.e., the index field, but not the name of the project or any other detail. A screenshot of the current Tab is attached below. Please help!!

PS: This is a very basic thing which I can easily do in a custom visualforce page. Calling this feild name  : Project__r.Project_Name__c.
But, how do I display this field in Salesforce defined detailed page. 
User-added image

I want to show the Project Name here as well.
Hello,

I am trying to pass a variable from a custom lookup field on my visualforce pages which fetches the project's id as selected by the user and call the fetched id in my javascript function - run().

I have been able to fetch the project's id selected by the user, print the value in my div element within the html block but not able to succesfully pass the feteched id to the run function.

Step 1
User-added image
Project ID in the div :
User-added image

Although, I see the project's id in my javascript after i inspect the element on my browser. 

User-added image

Could anyone please help me with this issue.


Here's the code :
<apex:page controller="MyCustomLookupController" readOnly="true">
<apex:includeScript value="/soap/ajax/24.0/connection.js"/> 
<apex:includeScript value="/soap/ajax/24.0/apex.js"/>

    <apex:form id="myForm">  
        <apex:PageBlock id="PageBlock">  
            <apex:pageblocksection title="Project Estimation" >       
                 <apex:inputField id="Projects__c" value="{!contact.Project__c}"  />
             </apex:pageblocksection>
   
            
            <apex:pageblockbuttons location="top">
                <apex:commandButton value="Generate Estimation Chart!" onclick="run({!contact.Project__c})"></apex:commandButton>
            </apex:pageblockbuttons>
         </apex:PageBlock>
   
   
    </apex:form>
  <html>
  <body>
       <div class="chart" style="width: 90%">
           <div id="chart">{!contact.Project__c}</div>
       </div>
  </body>
  
  <script type="text/javascript"> 
  function openLookup(baseURL, width, modified, searchParam){
    var originalbaseURL = baseURL;
    var originalwidth = width;
    var originalmodified = modified;
    var originalsearchParam = searchParam;

    var lookupType = baseURL.substr(baseURL.length-3, 3);
    if (modified == '1') baseURL = baseURL + searchParam;

    var isCustomLookup = false;

    // Following "001" is the lookup type for Account object so change this as per your standard or custom object
    if(lookupType == "001"){

      var urlArr = baseURL.split("&");
      var txtId = '';
      if(urlArr.length > 2) {
        urlArr = urlArr[1].split('=');
        txtId = urlArr[1];
      }

      // Following is the url of Custom Lookup page. You need to change that accordingly
      baseURL = "/apex/CustomAccountLookup?txt=" + txtId;

      // Following is the id of apex:form control "myForm". You need to change that accordingly
      baseURL = baseURL + "&frm=" + escapeUTF("{!$Component.myForm}");
      if (modified == '1') {
        baseURL = baseURL + "&lksearch=" + searchParam;
      }

      // Following is the ID of inputField that is the lookup to be customized as custom lookup
      if(txtId.indexOf('Projects__c') > -1 ){
        isCustomLookup = true;
      }
    }


    if(isCustomLookup == true){
      openPopup(baseURL, "lookup", 350, 480, "width="+width+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
    }
    else {
      if (modified == '1') originalbaseURL = originalbaseURL + originalsearchParam;
      openPopup(originalbaseURL, "lookup", 350, 480, "width="+originalwidth+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
    } 
   }
   
   function run(){ 
    alert('{!contact.Project__c}'); 
    var query = "SELECT End_Date__c, Duration__c,Project__c, Actual_End_Date__c, Progress__c FROM Tasks__c WHERE Project__c:= {!contact.Project__c}";   //Records from dependency table
    sforce.connection.sessionId = "{!$Api.Session_ID}";  
    var records = sforce.connection.query(query); 
    var records1 = records.getArray('records');
    alert('Initial records:'+records1);
   }
  
</script>
</html>
</apex:page>

 

I am creating a chart in my visualforce page using morris chart API. The whole page is loadng perfectly including the Chart container but still now able to load the chart. It throws me the following error : 

Graph container not found

From the Github page of Morris, I had got the solution for this error. They've mentioned that one has to include the javascript after the divs. But I have alredy done that. I have included all of my javascripts at the bottom of the page and still getting this error. 

I'd really appreciate some help!

 

Here's my div for the chart:

 

<section id="main-content">
        <section class="wrapper">
        <!-- page start-->
            <div class="row">
                <div class="col-sm-12">
                    <section class="panel">
                        <header class="panel-heading">
                            Customize Graph
                        <span class="tools pull-right">
                            <a href="javascript:;" class="fa fa-chevron-down"></a>
                            <a href="javascript:;" class="fa fa-cog"></a>
                            <a href="javascript:;" class="fa fa-times"></a>
                         </span>
                        </header>
                        <div class="panel-body">
                            <div id="graph-area"></div>
                           
                        </div>
                    </section>
                </div>
            </div>
    </section>
</section>

And I have included the scripts like this : 
 
<!--Morris Chart -->

<apex:includeScript value="{!URLFOR($Resource.mythemejs, 'js/morris-chart/morris.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.mythemejs, 'js/morris-chart/raphael-min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.mythemejs, 'js/morris.init.js')}"/>
 I don't understand why this won't work! 
 
Hey,

I had a question and I was hoping that someone could help me with it. I am trying to develop a custom a visualforce page and design the elements I am using in it such as, Charts, Tabs, etc. In my code, I am using a javascript which is hosted here : http://d3js.org/d3.v3.min.js

and using it in my code like this :
<apex:includeScript value="//d3js.org/d3.v3.min.js"/>

As it is on http and not on https, it's throwing me an error in the background as the attached picture says. Apparently, salesforce doesn't allow us to access scripts on "unsecure connection." 
User-added image

Is there any solution for this ?
Hey,

I need to restrict the user from entrying any duplicate values in the database. I have a Members Object. It has an auto text field and and a member name lookup field which is related to User Object. I don't want any one to pick and add any user from the look field which is already there in my Members list. 

So I have not been able to add this rule to my object. I don't want to use any triggeers for this. Validation rules had not enabled to me do this so far. I also tried to add a filter criteria to the lookup filter. It is not letting me compare the values of Current Lookup Member Name field to Current Record Member Name field. 

Could anyone please suggest any workaround for this ?