15

1.In controller u need to get attribute reference value using cmp.getReference("v.testAttr") 2.And set the value to ui:output text ** ({ doInit: function(cmp){ var test = cmp.getReference("v.testAttr"); $A.createComponent( 'ui:outputText', { value: test }, function(...


11

IsTest is a reserved word in apex as it's used for test classes, and furthermore, <apex:inputField> only works with fields on SObjects, it can't be bound to regular public variables. I think you're probably after something along the lines of: <apex:inputCheckbox value="{!someBool}">a checkbox?</apex:inputCheckbox> in your page, and ...


10

In the describe for the Field there's a referenceTo property which indicates which type(s) the foreign key is for, e.g. system.debug(Schema.SObjectType.Contact.fields.AccountId.referenceTo[0].getDescribe().getName()); prints Account The docs have a section on the describe functionality


10

Indeed Visualforce reports the List attribute as only supporting Literal values. Fortunately it is indeed possible to achieve what you want via Dynamic Visualforce. I found an example of this in the Salesforce Visualforce Developers guide here. In the code sample you can see the RelatedList component being created and the List attribute being set dynamically....


9

There are sufficient methods on the SObject base type to write code that isn't tied at all to specific SObject types. You can get and set primitive field values and navigate across both parent and child relationships. (The only thing I have noticed missing from the API is the ability to add errors to specific SObject fields; there is only the ability to add ...


7

This was intentionally designed this way, and reason for that is an edge case. You can still change the value, you simply need to clear the reference before setting it first. ({ changeValue: function(cmp, evt, helper) { cmp.clearReference("v.value"); cmp.set("v.value", 10); }, }) Lets tell a little bit of a story here to explain ...


6

We understand that the ergonomics from a declarative point of view are great, but unfortunately there are big performance penalties and a bunch of quirks and functional issues supporting dynamic evaluation of expressions (ex. what would happen if you were to mutate the binding (bidirectional) in the children? - it will be very hard to mutate the object back ...


5

The expression value can be set in an Apex controller using a dynamiccomponent. Because the expression is built outside of Visualforce, it can be dynamically set based on a Custom Setting. Here's what I ended up with: Visualforce <apex:dynamicComponent componentValue="{!SectionsAndFields}"/> Apex public Component.Apex.OutputPanel ...


5

As for the title of your question, yes it is possible to reference fields from a dynamic object. Use square brackets ([]): <apex:inputField value="{!record['Some_Field__c']}" /> Not sure if that will solve your NullPointerException... Note also that you have introduced an injection vulnerability by trusting the id parameter. Never trust user input. ...


5

standard controller automatically adds fields, that are displayed on VF page, as those, that should be queried. So when you are adding <apex:outputText value="{!Campaign.Product__c}" rendered="false" /> standard controller includes Campaign.Product__c field in query if you don't want to add this markup to VF page, you can add desired fields in ...


4

I managed to make this work by using the Cookie class. Instead of outputLinks, I used a commandLink and constructed a Page Reference in the controller like so. PageReference pr = new PageReference('/'+recordToView+'/e?retURL=/apex/Codi?id='+contact.Id+'&rels='+preSelectedRelListsKeyPrefix); Cookie relCookie = new Cookie('Checked Related Lists', ...


4

'{!bvs.Status__c}' is guaranteed to never be null, because even if Status is an empty string, your code effectively evaluates as: if('' != null) { Clearly, "empty string" is not the same as null, so this condition is always true. Instead, consider using: if({!ISBLANK(bvs.Status__c)}) { Which will evaluate to this when the string is empty: if(true) { ...


4

This is expected; you've bound all the checkboxes to a single value. Instead, you need to create a wrapper, and check/uncheck individual values: <ui:inputCheckbox aura:id="checkbox" value="{!a.selected}" text="{!a.record.BillingCity}" name="{!indx}" label="{!a.record.BillingCity}"...


4

If you use $A.createComponent, you need to use component.getReference, otherwise you'll just be getting a copy of the value. For a specific item in the list, it should be something like component.getReference("v.itemlist["+index+"].checkbox"). You'll need to play with it a bit to get the references just right, but this information should get you started.


3

I figured out the solution for this. Step 1.Invoke the canvas using VF page and pass the variables using parameters... sample code. <apex:page standardController="contact"> <apex:form id="myform"> <apex:pageblock > <apex:canvasApp developerName="ConvasAppPOC" parameters="{'uNum':'{!contact.id}','viewPage':'Home'}" ...


3

You are correct that this will require dynamic VF components. Anything that you would attempt to bind directly to VF markup will attempt to validate against a real schema component. When installing in an org missing the related list, it will fail. You've probably already seen this blog entry on developerforce: http://blogs.developerforce.com/developer-...


3

Try using dependant lookups and or lookup filters. http://login.salesforce.com/help/doc/en/fields_lookup_filters_dependent_lookups.htm


3

isn't inputfield only available for sObject fields? If you want to use a custom variable like "Isbool then you need "Inputtext" or "inputcheckbox"


3

retURL is the URL Salesforce redirects to when you click the Cancel Button saveURL is the URL Salesforce redirects to when Save is clicked. I cannot think of a supported way to make sure URL Query Parameters are passed when the Browser Back Button is pressed (I'm assuming here by the Back Button, you mean the Back button on the Browser).


3

You can directly use bind variables in dynamic soql, as incredible as it sounds. Alternatively, the more traditional approach of quote delimiting the keyset and constructing your where clause manually. You can use the shiny Winter'13 String.Join method to iterate over a list and append with a delimiter.


3

The easiest way do to this would be to use aura:if: <aura:if isTrue="{!v.flag}"> <c:CstmComp value="{!v.Case.Field1__c}"/> <aura:set attribute="else"> <c:CstmComp value="{!v.Case.Field2__c}"/> </aura:set> </aura:if> You could probably also use SecureComponent#getReference and wire it up in your controller, ...


3

For the "ui:inputCheckbox" I would recommend you fetch the value using event.getSource(). Although the documentation seems to indicate you can use component.get('v.value'), however, the documented method seems to return 'undefined', therefore, you might want to check Event Handling in Base Lightning Components So, in your function you will want to do: var ...


3

I don't know that this will entirely answer your question, but it may at least point you in the "right" direction. A different approach that @andrewfawcett takes is to begin by using a Selector class along with a String Builder class, to incrementally build what's needed to finally make the call to his QueryFactory class as described in his book Force.com ...


3

Since @crmprogdev offered a more general direction to pursue, I wanted to cover some of the details here. SOQL Dynamic Binding While I'm not sure this is formally documented, and hence there may be unusual edge cases, the binding of values takes place in the scope where Database.query() is called with a Dynamic SOQL query string, as you've observed in the ...


2

Wow that is strange and can confirm I have just tried it myself! Also agree would like to see that become the default! It is not great to have to resort to Dynamic SOQL just for this and loose the compile time checking and dependency enforcement it brings, especially when packaging solutions on the platform. We have partly worked around this and the ...


2

We do lots of dynamic property bindings like this in VF and haven't experienced any drawbacks. I would expect the work being done under the covers to navigate the object graph being pretty much identical for explicitly named properties and dynamic properties. Your other option would be to create dynamic VF components in your controller, but that always ...


2

You can do this with a reflector[1], but unfortunately, i don't believe you can do this in pure native apex. Even the apex <--> metadata api bridge uses javascript, and requires a browser (to the best of my knowledge). However, an external application (i call it a Reflector) living externally, say on heroku, can access both the metadata and subject api's ...


2

Set types do not have a guaranteed order, per the documentation: Sets A set is an unordered collection. Do not rely on the order in which set results are returned. The order of objects returned by sets may change without warning. If you need predictable ordering of the elements, use a List type.


2

The documentation suggests that there isn't a construct like the one you're looking for. In the examples of dynamic Apex/VF, the object type has to be calculated in Apex and then passed down to VF in a string: // The sObject type as a string public String getObjectType() { return(this.objType); } public String setObjectType(sObject newObj) { this....


2

These dynamic components can't be made part of the view state (unlike their static tag-based counterparts) because they are not serializable (by design according to Salesforce support). This means that e.g. when there are errors on fields the behaviour you get is not perfect. And it drives the need for the reference being transient. Consequently the Apex ...


Only top voted, non community-wiki answers of a minimum length are eligible