• Brian E Miller
  • NEWBIE
  • 20 Points
  • Member since 2016
  • SF Consultant
  • Ananimforce


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 10
    Replies
Hi,

I'm trying to retrieve an Account's related Notes, and I came across AttachedContentNote (https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_attachedcontentnote.htm).  In the doc at the bottom, it gives some usage instructions:
 
Usage
Use this object to list all ContentNote objects attached to an object.
To retrieve ContentNote objects, issue a describe call on an object, which returns a query result for each note created or attached. You can’t directly query this object.

A few questions:
  1. How do you "issue a describe call on an object, which returns a query result for each note created or attached"?
  2. How do you use the "describeSObjects()" to help in getting related records?
  3. Does anyone have an example of how to get related Notes via SOQL?  Is CombinedAttachments the only way to go?
While MavensMate is riding off into the sunset, it's going to remain relevant for a bit.  That said, what's The Thing to use moving forward to connect VS Code, Atom, or Sublime to the Salesforce backend?

Thanks,

Steve 
We are trying to create a standard salesforce record  directly from within our app. After the record is created, we should obtain the recordId and use it further in our application.

We have encountered problems to accomplish this in LEX.

There are two way to work with new records.
1. Use force:createRecord.
2. Use Lightning Data Service

However, the problem with force:createRecord is that we are unable to obtain the recordId after the creation as the user is directly redirected to the record's home page and there is no documented way to intercept this and obtain the recordId.

The problem with the Lightning Data Service is that it is unable to automatically render the object's entry standard layout, we need to manually specify fields which is a show stopper as it's required that the user are able to change the layout that will reflect in our application. The only place where Lightning Data Service load a form automatically is when we want to edit a record, not create one...

How can we accomplish the following:

1. Display a standard layout for a given object during the creation of the record.
2. Prepopulate some fields.
3. Collect recordId after the record is created.
4. Redirect user to our custom page so we could utilize the recordId.

Any help would be much appreciated.
Hi,

I'm trying to retrieve an Account's related Notes, and I came across AttachedContentNote (https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_attachedcontentnote.htm).  In the doc at the bottom, it gives some usage instructions:
 
Usage
Use this object to list all ContentNote objects attached to an object.
To retrieve ContentNote objects, issue a describe call on an object, which returns a query result for each note created or attached. You can’t directly query this object.

A few questions:
  1. How do you "issue a describe call on an object, which returns a query result for each note created or attached"?
  2. How do you use the "describeSObjects()" to help in getting related records?
  3. Does anyone have an example of how to get related Notes via SOQL?  Is CombinedAttachments the only way to go?
hi ive written a visualforce page to showmap from address fields but i want to do this from latitude and longitude fields
 
<apex:page standardController="Account">

<head>

<script type="text/javascript" src="https://maps.google.com/maps/api/js?key=AIzaSyBmZQov1SBI9a3f9nWPwCS_cy37nPZIm9I&sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> 
<script type="text/javascript"> 

$(document).ready(function() {

  var myOptions = {
    zoom: 18,
    mapTypeId: google.maps.MapTypeId.SATELLITE,
    mapTypeControl: false
  }

  var map;
  var marker;

  var geocoder = new google.maps.Geocoder();   
  /* var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}"; */
 /*  var latlng = ("{!Account.Latitude__c}",  "{!Account.Longitude__c}"); */
   /* var address = "{!Account.Longitude__c}, " + "{!Account.Latitude__c}; */
    var address = "{!Account.Address__c}, " + "{!Account.city__c}, " + "{!Account.postal_code__c}, " + "{!Account.country__c}";  
/* var lat = '{!Account.Latitude__c}';
var lng = '{!Account.Longitude__c}';
var latlng = new google.maps.LatLng(lat, lng); */


  var infowindow = new google.maps.InfoWindow({
    content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
  });  

   geocoder.geocode( { address: address}, function(results, status) { 
 /*  geocoder.geocode( { latlng: latlng}, function(results, status) {  */
    if (status == google.maps.GeocoderStatus.OK && results.length) {
      if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

        //create map
        map = new google.maps.Map(document.getElementById("map"), myOptions);

        //center map
        map.setCenter(results[0].geometry.location);

        //create marker
        marker = new google.maps.Marker({
            position: results[0].geometry.location,
            map: map,
            title: "{!Account.Name}"
        });

        //add listeners
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
        google.maps.event.addListener(infowindow, 'closeclick', function() {
          map.setCenter(marker.getPosition()); 
        });

      }

    } else {
      $('#map').css({'height' : '25px'});
      $('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
      resizeIframe();
    }
  });

  function resizeIframe() {
    var me = window.name;
    if (me) {
      var iframes = parent.document.getElementsByName(me);
      if (iframes && iframes.length == 1) {
        height = document.body.offsetHeight;
        iframes[0].style.height = height + "px";
      }
    }
  }

});
</script>

<style>
#map {
  font-family: Arial;
  font-size:12px;
  line-height:normal !important;
  height:250px;
  background:transparent;
}
</style>

</head>

<body>
<div id="map"></div> 
</body> 
</apex:page>

 
Greetings,

We have some custom visualforce pages for custom objects.  These pages have the old "Notes and Attachments" object.  After Winter 2016 was rolled out, our users cannot add notes through this list anymore.  How do I expose the new notes along side the old notes and attachments?  All the documentation I could find said the new notes needs to be added to page layouts, which is straight forward enough, but no instruction on how to do this for visualforce pages.

Code for the old notes and attachments:

<apex:relatedList list="CombinedAttachments"  />

I've tried list="Notes", list="ChatterNotes", and a few others with no luck.  Any help would be appreciated.

Thanks,
Keith
Hi all,

i am trying to align my command button in center but its not working i have used all the css properties like align and float in my output panel but still its not working

<apex:page controller="VistAudit_VFC" action="{!createData}">
 <apex:form >
  <apex:outputLabel value="Audit Visit" style="font-family:Times New Roman;font-size:15px">
 </apex:outputLabel><br></br>
 
<apex:outputPanel style="float:centre">
 <apex:commandButton value="Save" action="{!save}"/>
 </apex:outputPanel>

</apex:page>

any help would be appreciated

thanks

Is there a way to display how many characters the user has left like it does on a detail page. The issue I am running into is that when I try to save the data I put into the field the page tells me that I am over the character count. However I don't know by how much. So I am forced to guess. Thanks. 

Is it possible to add picklist values (the metadata) using apex and a VF page?

 

I have a VF page that displays the lead source picklist values from the contact object on a VF page:

 

public List<SelectOption> getLeadSourceNames()
	{
  		List<SelectOption> options = new List<SelectOption>();
        
   		Schema.DescribeFieldResult fieldResult = Contact.LeadSource.getDescribe();
   		
   		List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
   		for( Schema.PicklistEntry f : ple)
   		{
      		options.add(new SelectOption(f.getLabel(), f.getValue()));
   		}       
   		return options;
	}

 

On my VF page, I display the selectList and if the user select 'Other' it will open a text field where they can enter a new value and save.  It saves the value to the record, but doesn't add the new value to the actual picklist value metadata.  Is there a ay to do this?

 

Here is my VF page:

 

<apex:page standardController="Contact" extensions="DynamicPicklist" sidebar="false" >
	<apex:form >
		<apex:sectionHeader title="Dynamic Picklist" subtitle="Reusable code"/>
		<apex:pageblock >
			<apex:pageBlockSection title="Dynamic picklist" columns="1">      
				<apex:pageblocksectionItem >          
					<apex:outputlabel value="Lead Source" for="values" />          
					<apex:selectList value="{!leadSource}" size="1" id="values">              
						<apex:actionSupport event="onchange" reRender="newvalue" />              
						<apex:selectOptions value="{!leadSourceNames}"/>          
					</apex:selectList>      
				</apex:pageblocksectionItem>                                                  
				<apex:outputpanel id="newvalue">             
					<apex:outputpanel rendered="{!leadSource == 'Other'}">             
						<div style="position:relative;left:75px;">                               
							<apex:outputlabel value="New value" for="newval" />                  
							<apex:inputText value="{!newpicklistvalue}" id="newval"/>                  
							<apex:commandbutton action="{!saverec}" value="Add!"/>             
						</div>             
					</apex:outputpanel>          
				</apex:outputpanel>               
			</apex:pageblocksection>
		</apex:pageblock>
	</apex:form>
</apex:page>

 

Here is the saverec method:

 

public void saverec(){   
	con.LeadSource = newpicklistvalue;
	update con; 	
}

 

I would like to have the ability to add new picklist values from the VF page.  Is it possible using the metadata API?  If so, how?  I can't find any sample code that explains how to accomplish this.

 

Thanks for any help.

While MavensMate is riding off into the sunset, it's going to remain relevant for a bit.  That said, what's The Thing to use moving forward to connect VS Code, Atom, or Sublime to the Salesforce backend?

Thanks,

Steve