• Scott.M
  • NEWBIE
  • 329 Points
  • Member since 2007

  • Chatter
    Feed
  • 11
    Best Answers
  • 4
    Likes Received
  • 0
    Likes Given
  • 157
    Questions
  • 284
    Replies

Hi, I'm pretty new to visualforce development.  I'm currently trying to create a page that will serve as an  update wizard for a parent and child custom object.  I'm getting the following error when trying to reference the child object (Petition__c) in the VF page.

 

Error: Could not resolve the entity from <apex:inputField> value binding '{!petition.Start_Date__c}'. <apex:inputField> can only be used with SObject fields.

 


So as it is I can get and update information from the "h2case" but not from the "petition".  I'll post my vf and controller code below.  

 

 

<apex:page controller="Testappnotcont">
    <apex:sectionHeader title="Approval Notice Received"/>
        <apex:form >
            <apex:pageBlock title="Update Member Information">
                <apex:pageblockButtons >
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>
                </apex:pageblockButtons>
                    <b>Scan approval notice into company's e-file using the following format </b>
                            <blockquote> <FONT COLOR="#FF0000">Company Name - Approval - Last 5 digits of            the approval notice</FONT> </blockquote>
                <apex:pageBlockSection title="H2Case Information">
                    <b> Update the H2Case status to "Approval Notice Recieved". </b>
                            <apex:inputField value="{! h2case.status__c}"/>
                </apex:pageBlockSection>
                <apex:pageBlockSection title="Petition Information">
                    <p> <b> Make sure that the start and end dates are correct. </b> <br/>
                            <apex:inputField value="{! petition.Start_Date__c}"/> <br/>
                            <apex:inputField value="{! petition.End_Date__c}"/> </p>
                        <b> Number of workers. </b>
                            <apex:inputField value="{! petition.Max_Workers__c}"/>
                        <b> Date USCIS notice received. </b>
                            <apex:inputField value="{! petition.USCIS_Received_Date__c}"/>
                        <b> Petition Number</b> <FONT COLOR="#FF0000">(if not already updated).</FONT>
                            <apex:inputField value="{! petition.name}"/>
                        <b> Update Petition status to "Approved". </b>
                            <apex:inputField value="{! petition.Petition_Status__c}"/>
                        <b> Date the approval notice was received. </b>
                            <apex:inputField value="{! petition.Approval_Notice_Received__c}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>            
        </apex:form>
</apex:page>

 

public class Testappnotcont
{


    public PageReference cancel() {
        return null;
    }


    public H2B_Case__c h2case {get; set;}
    public List<Petition__c> petition {get; set;} 
    
    public Testappnotcont() {
        String id = ApexPages.currentPage().getParameters().get('id');

        h2case = [select id, Status__c from H2B_Case__c where Id = :id][0];
        petition = [select id, Start_Date__c, End_Date__c, Max_Workers__c, USCIS_Received_Date__c, Name, Petition_Status__c, 
        Approval_Notice_Received__c from Petition__c where H2B_Case__r.Id = :h2case.Id];
    }

    public PageReference save() {
        update h2case;
        update petition;
        return null;
    }

}

 

Hi,

 

I would like to secure my site with a unique password which allow users to view my sites but I dont want to implement login security model on to it.

 

A Unique password will be communicated to selected user viva e-mail. 

 

I like the CAPTCHA feature but I want some short of password verification.

 

Any idea?

 

Regards,

Mktg

  • August 22, 2010
  • Like
  • 0

When we made the move from using Custom Labels to store app settings to using the new hierarchical Custom Settings to do so, our testMethods started failing due to null pointer references.  From what I've seen, when you go to install a package with Custom Settings definitions via AppExchange, even if you set defaults for it when creating the settings, they are not passed to the target org.  The target org seems to be required to hit the Manage button and accect/create/modify the default settings for the org wide defaults before they can be used.  This is a problem since these won't exist during an AppExchange install, and can't be managed until the install would be done, at which point it's already failed out our testMethods that call code referencing expected default values.

 

What is the proper way to use Custom Settings and still ensure that code coverage is achieved, and that they can be packaged for the AppExchange without defaulting to being null?

I have developed a VF page and some Apex code for a Lead Pull Management system.  In short, the function responds to the user's daily allowance (and pulls) of Leads and determines if he/she can pull more Leads.  In the sandbox, the combined functions are working properly.  Running the tests classes in the Sandbox (and IDE) generate no errors and give me a coverage of 90%. 

My issue is in attempting to deploy the code to production.  When attempting to do this, I receive an error of "Illegal Assignment from Double to String" for Line 14 Column 8.  This line is intended to tell the VF Controller what Queue to pull Leads from.  As you can see, I have tried to a few different approaches for working around this issue with no success.  I am confused as to why IDE is reading this as a double.  Is it the lack of quotes, or my approach of reading from the user to assign the variable?  Any insights would be very much appreciated.  

 

Here is the Controller.....

 

global without sharing class TomController{ public String getResult(){ return res; } private String res=null; User U = [select id, LeadPullQueues__c from User where id = :Userinfo.getUserId()]; //Here we set variables utilized later to define user-specific search parameters public Double MAX= [select TruePerDiem__c from User where ID = :userinfo.getuserid()][0].TruePerDiem__c; //Public Integer Diem = Integer.valueOf(Max); public Integer Diem = Max.intvalue(); public string Q = u.leadpullqueues__c;//Line generating error message //String Queue = [select LeadPullQueues__c from User where ID = :userinfo.getuserid()].LeadPullQueues__c; //public String Queues = [select LeadPullQueues__c from User where ID = :userinfo.getuserid()][0].LeadPullQueues__c; //Public String Queue = String.valueOf(Queues); public Double Now= [select PulledToday__c from User where ID = :userinfo.getuserid()][0].PulledToday__c; //public Integer Was = Integer.valueOf(Now); public Integer Was = Now.intvalue(); //public Integer Took = (Was + Diem); public PageReference doSearch() { // We update the Lead records only when the owner id = User's Lead Pull Queue Value List<Lead> leads = [select Id,ownerid,PulledYes__c from lead where ownerid = :Q limit :Diem]; List<User> Users = [select ID, PulledToday__c from User where ID = :userinfo.getuserid() Limit 1]; ID u = [select ID from User where ID = :userinfo.getuserid()][0].Id; //Integer BestCount = leads.size(); //Ideally, we could have created the above User list and used the "BestCount" Integer //to write back the true value of Leads pulled to the current users SFDC User record. //Unfortunately, SFDC wont allow Apex to update Users via DML within a method updating another object type for(Lead l:leads){ l.ownerid=u; l.PulledYes__c='yes'; } update leads; res = 'success'; return new PageReference('/00Q/o'); } }

 

 The code definitely needs some cleansing and I intend to use one SOQL call from which I will derive the separate variables.  Aside from that, any input (beyond the error message I am receiving when attempting to validate the deployment in IDE) would be greatly appreciated.  As with most other posters seeking advice, I am new to APEX.

 

Hi

Is there any way to know if today() is a weekend day or not?

 

I need to create a task 3 days after a lead is been created but I need to exclude the weekends.

I have got a formula that tells me how many days since the lead is been created but I can't use workflows on formulas so I am thinking to use Apex. I need to know which day of the week is today(), and based on that I will create my task. 

 

Any ideas?

  • March 06, 2009
  • Like
  • 0
I need to get list of object types for worflow rule on my custom page , any body know the query to pull those list.

Hi ,

 m nt getting proper xml parsing method info ..

I have this XML :-

 

<customers>
  <PID AD_Table_ID="291" Record_ID="117">
     <AD_Client_ID>11</AD_Client_ID>
     <AD_Language/>
     <AD_OrgBP_ID/>
     <AD_Org_ID>0</AD_Org_ID>
     <AcqusitionCost>0</AcqusitionCost>

  </PID>

  <PID AD_Table_ID="291" Record_ID="113">
     <AD_Client_ID>12</AD_Client_ID>
     <AD_Language/>
     <AD_OrgBP_ID/>
     <AD_Org_ID>0</AD_Org_ID>
     <AcqusitionCost>0</AcqusitionCost>

   </PID>

 

 </customers>

 

m tryin to parse it since a day ...i saw the methods and example in the apex reference and some samples also..But i am not getting the method by which i can travse through this tree structure.. XML parsing is much easier in java , but as m using SFDC IDE , no auto fill is thr ..its a bit hard for me to debug and find out the methods i need..it will be so kind if any one can give me some clue (i went through the XmlStreamReader some properties)..thnx

I've got a visualforce page exposed through SF1 that works wonderfully when I access it through the /one/one.app sf1 application, but on the native android app it always pops up a login page. I'm logged into a sandbox but the login page that pops up is targeted at http://login.salesforce.com so I can't log in and since it's not the standard sf1 login point I can't switch the server so there doesn't seem to be anyway to make the page show up in the app. It seems to me that if the page works at /one/one.app it should work in the native apps as well, any thoughts? 
I have a site visualforce page that is loading some unecessary javascript. Specificly the following javascript:

/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1405380279000

I would like to prevent force.com from including this file in the page. Is there anyway to do this? Are there some components that cause this script to be loaded? 

I would also like to prevent this file from loading:

/static/111213/js/perf/stub.js

Any help is appreciated :) 

Cheers,
Scott
I'm using String.replaceFirst to replace a token with an unkown string. I've run into an issue where the unknown string contained a back reference sequence $1. I don't wnat this to be interepreted as a back reference. An execption gets thrown since the group doesn't exist. My solution is to escape the $ character which works:

unknownString.replace('$', '\\$');

Is there a better way to escape control characters from the replacement string?  
What's the cost of using dynamic soql over standard soql queries. Is there any measurable difference between doing:

<pre>Database.query('select Id from Contact where Id=:contact_id'); </pre> 

vs

<pre>[select Id from Contact where Id=:contact_id' ]; </pre>

If there is a performance difference, does the penalty increase with complexity of queries? 

There is an extremely annoying issue in running tests in the last SF release. For some reason test classes show as failed with 0 test failures. Definitely a salesforce bug, am I the only one who has noticed this? 

 

 

The new communities has mostly the same functionality as a Force.com Site + Customer Portal. One of the things that's missing though is the ability to set a custom change password page. This is critical for customers who want full control of the branding of their site, and while salesforce's new login looks nice, it does not fit with the design vision of many customers and being able to select a logo and change the background color is not an acceptable level of control for enterprises. 

 

i've tried a few avenues to try and get a custom change password page when a new user is signed up, or their password is reset:

 

1. Use the url rewritter to intercept /_ui/system/security/ChangePassword. Sadly this doesn't work as the url rewritter doesn't run for this target

2. Use the footer to add some javascript redirect to the page. Unfortunately the change password page doesn't take the footer defined in the login configuration for communities.

 

Does anyone have any clever ideas on how we can use a custom change password page in these scenarios? It used to be really simple in customer portal, you just selected the desired change password visualforce page. It's no fun when "new" products take funtionality away. 

 

Thanks in advance for any help and ideas! :) 

The new mock classes  are great! Except for one thing I have a block of code that does something like this

 

try {

 //do a callout

} catch(Exception ex) {

 //handle an expection 

}

 

I want to test the handling of an exception part of the code. Initially I though I could just create a mock class that throws an exception in the response method something like this

 

@isTest
public class MockHttpCalloutGenerator implements HttpCalloutMock {
 
public HTTPResponse respond(HTTPRequest req){
 
throw new CustomException('Exception occured during callout');
 
}
 
}

 

The problem is that when I run the test I get a System.UnexpectedException: Exception occured during callout. And it doesn't exercise my exception handling. Is there a way to do this, or am I hosed for testing callout exception handling?

 

What's the best way to upload a file to a chatter post in a custom interface in a visualforce page. Yes I know there is a visualforce component that provides all the chatter functionality, but let's say you don't want to use the component. How would you upload a chatter file with javascript remoting? 

 

Thanks!

Scott

I have a case where it seems that whether the value for the template attribute in the apex:composition tag is a literal or expression determines whether dynamic elements get rendered or not. 

 

My controller looks like this:

 

public class SimpleController {


    public Component.Apex.OutputText dynamictest {get; set;} 
    
    public PageReference pageRef {get; set;} 
    
    public SimpleController(){
        this.pageRef = Page.SimpleComposition;
        this.dynamictest = new Component.Apex.OutputText();
        this.dynamictest.value = 'This is the dynamic output text';        
    }
    

}

 

My page looks like this:

 

<apex:page controller="SimpleController">
    <apex:composition template="{!pageRef}" />
</apex:page>

 My template looks like this:

 

<apex:page controller="SimpleController">
            This is a simple composition<br />
            <apex:dynamicComponent componentValue="{!dynamictest}" rendered="true"/>
</apex:page>

 I expect that when I go to the page I will get:

 

This is a simple composition
This is the dynamic output text

 

what I acutally get is:

 

This is a simple composition

 

 

If I change the experession for template to a literal like this:

 

<apex:composition template="SimpleComposition" />

 Then I get the expected result, so it seems that dynamic components behave differently in compositions based on whether or not the template is referenced in the tag with an expression or a literal. On the surface it would seem that this should not be the case. Is there any explenation as to why this would be?

 

 

 I opened a case in the partner portal but they've made a change and only give developer support to paying partners now :o( . They directed me here. Hopefully someone can help me :)

 

I have a dynamic visualforce element that I'm attempting to render on a visualforce page that has two levels of <apex:composition> tags. The element renders fine if I just use one composition. it doesn't render if I use two levels. It seems to me like this is a bug in salesforce. Any insight would be helpful. Here's the simplest version of the issue I'm seeing: 

 

I have one controller named SimpleController used by all the pages and it's source is the following:

 

public class SimpleController {

    public Component.Apex.OutputText dynamictest {get; set;} 
    public PageReference pageRef {get; set;} 
    
    public SimpleController(){
        this.pageRef = Page.SimpleComposition;
        this.dynamictest = new Component.Apex.OutputText();
        this.dynamictest.value = 'This is the dynamic output text';        
    }
    

}

It sets up the a page reference to the page that will be the composition included in the first page name MainPage that has the following source:

 

<apex:page controller="SimpleController">
	<apex:composition template="{!pageRef}" />
</apex:page>

All this page does is output the template from pageRef. From the controller you can see that the template is the visualforce page SimpleComposition which has the following source:

 

<apex:page controller="SimpleController">

	<apex:composition template="SimpleTemplate">
		<apex:define name="dynTest">
			This is a simple composition<br />
			<apex:dynamicComponent componentValue="{!dynamictest}" rendered="true"/>
				
		</apex:define>
	</apex:composition>

</apex:page>

 

 And this is a compostion of the template named SimpleTemplate and it has the following source: 

 

 

<apex:page controller="SimpleController">
	
	
	This is the simple template <br />
	<apex:insert name="dynTest" />

</apex:page>

 

 

This is the expected result when viewing MainPage:

 

This is the simple template 
This is a simple composition

 

This is the dynamic output text

 

This is the actual result :

 

This is the simple template 
This is a simple composition

 

No errors, no indication that anything went wrong. Just no rendering of the dynamic element. If I go to the SimpleComposition page directly I get the expected result. 

 

 

 

 

I'm doing a query for chatter that looks like this: 

 

[SELECT Id, Type, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Body, Title, LinkUrl, ContentData, ContentFileName ,

    (SELECT Id, CommentBody, CreatedDate, CreatedBy.FirstName, CreatedBy.LastName  FROM FeedComments LIMIT 5)

FROM FeedItem WHERE ParentID =: objectId AND Type = \'TextPost\' ORDER BY CreatedDate DESC LIMIT 10]

 

The problem is that the query only returns one comment even though I specify a limit of 5 and I know there are more than 5 comments on the chatter post that I'm rendering. Any insights into why that might be?

 

Thanks!

Scott

It's great that we can get profile urls using the fields on the User object. The problem is they don't seem to be assible from a feed query. So if I have a custom object Custom__c and I turn chatter on for it then try and get the feed with a query to Custom__Feed in apex. I can't access the profile images for the posts with CreatedBy.smallPhotoUrl because I get the following error:

 

No such column 'smallPhotoUrl' on entity 'Name'

 

So my question is, is there anyway to get the photo urls for the feed items in a single query or are we destined to do multiple queries and create wrapper classes to include the small photo urls :( I would really like to avoid this. 

Does anyone know of an equivalent to URLFOR in Apex. We now have dynamic components that can be initialized in apex. For example if you wanted to initialize the stylesheet component you could do this:

 

Apex.Component.Stylesheet customstyle = new Apex.Component.Stylesheet();

customstyle.value = '/mystyle.css';

 

This is great but I want to initalize the component to use a static resource stored in a zip file. In visualforce that's easy using the URLFOR() function. Is there anyway to acheive the same functionality in Apex?

 

Thanks!

Scott

An update in winter 13 has broken critical features. We have a section of code that aborts a batch proccess. In Summer 12 it works in the latest Winter 13 patch it does not. 

 

This the error that we get in Winter 13

 

Update failed. First exception on row 0 with id a1eQ000000058HGIAY; first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): cms__Schedule__c, original object: CronJobDetail: []

Error is in expression '{!stopScheduler}' in component <apex:page> in page cms:setupschedule

 

FYI: This was working in winter 13 before September the 26th. A winter 13 patch broke this.

Hi,

 

I'm using the PageReference getContent method to retreive the contents of a visualforce page. In the visualforce pages controller I set some cookies. I would like to retrieve the cookies that were set in the visualforce page. Is there anyway to do this? 

 

Thanks!

Scott

  • September 18, 2012
  • Like
  • 0

I have a visualforce case form that I want to use to allow users on a website to submit cases from. The problem is that it appears to force a contact id even if I populate the supplied field. I'm using dynamic dml but that shouldn't make a difference:

 

The error is:

No selected contact

 

 

Hi,

 

We have some users that want their customer portal session to stay alive after the browser closes. Doesn't anyone know if there's a way to accomplish this? Basically they want a remember me option on the login form.

 

Thanks for any help 

 

Scott 

What's the difference between chatter answers and just regular answers?

 

Thanks,

 

Scott :) 

It appears that when a customer portal user attemptes to login to many times and gets locked out, the login failed message doesn't change to indicate they've been locked out. Does anyone know if there's a way to change this so the error message is more informative? 

 

I was also wondering if it is possible to have different password policies for customer portal than for standard salesforce?

 

Thanks!

Scott

Hi,

 

This maybe a strange use case but I need to test an approval process without actually setting up the approval process in the declarative interface. The reason being, that using approval processes is optional in our managed package so we don't want to include an already setup approval process but we still need to test the code that would use an approval process should the end user decide to create one.

 

Thanks in advance for any ideas or help!

Scott 

The new communities has mostly the same functionality as a Force.com Site + Customer Portal. One of the things that's missing though is the ability to set a custom change password page. This is critical for customers who want full control of the branding of their site, and while salesforce's new login looks nice, it does not fit with the design vision of many customers and being able to select a logo and change the background color is not an acceptable level of control for enterprises. 

 

i've tried a few avenues to try and get a custom change password page when a new user is signed up, or their password is reset:

 

1. Use the url rewritter to intercept /_ui/system/security/ChangePassword. Sadly this doesn't work as the url rewritter doesn't run for this target

2. Use the footer to add some javascript redirect to the page. Unfortunately the change password page doesn't take the footer defined in the login configuration for communities.

 

Does anyone have any clever ideas on how we can use a custom change password page in these scenarios? It used to be really simple in customer portal, you just selected the desired change password visualforce page. It's no fun when "new" products take funtionality away. 

 

Thanks in advance for any help and ideas! :) 

Hi,

I've setup a custom object and a visualforce page that displays the contents of the object. I setup a visualforce page to create new objects. One of the fields uses rich text but when I display the field in the site page, it's displays the html tags. Any ideas why it might be doing this?

Thanks!

Hi,

Is it possible to set the value of a param object in visual force. For example if I defined a action function as follows:

Code:
 <apex:actionFunction name="testAction" action="{!testAction}" rerender="ListTable" immediate="true">
  <apex:param name="reference" id="update_reference" value="0" />
 </apex:actionFunction>

and I've loaded the prototype library should I be able to do something like this

Code:
$('update_reference).value = '1'; 

Is there a different way of setting the value of the parameter in javascript. Also it'd be nice if in the object reference examples the source code (javascript and html) generated for the tag was shown.
 


Hi,

I don't think this is possible but I might be missing something. What I would like to do is override the New button but only for a specific Record Type.

The normal functionality is that if you have more than one record type, clicking new will take you to a first step where you select the record type and then clicking next takes you to the layout for the record type selected.

I want to keep the first step, and for all but one record type keep the standard creation pages. For the one recordtype I want to display a visualforce page when it's selected in the first step. I'm hoping I don't have to rewrite the first wizard step, any ideas?

Thanks!
I've got a visualforce page exposed through SF1 that works wonderfully when I access it through the /one/one.app sf1 application, but on the native android app it always pops up a login page. I'm logged into a sandbox but the login page that pops up is targeted at http://login.salesforce.com so I can't log in and since it's not the standard sf1 login point I can't switch the server so there doesn't seem to be anyway to make the page show up in the app. It seems to me that if the page works at /one/one.app it should work in the native apps as well, any thoughts? 
I have a site visualforce page that is loading some unecessary javascript. Specificly the following javascript:

/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1405380279000

I would like to prevent force.com from including this file in the page. Is there anyway to do this? Are there some components that cause this script to be loaded? 

I would also like to prevent this file from loading:

/static/111213/js/perf/stub.js

Any help is appreciated :) 

Cheers,
Scott
If there are any options to add components on the visualforce page dynamically?

For example, I have 2 objects (tables). One of them contains components which I need to add to the page (checkbox, list) and the second contains values for this components. 

Actually, it should work like: user open the page, depend on the page, it would contain some general components and also extra components defined in the saleforce object (table). 

Can I make this functionality on visualforce page? If so, could you please provide a link where I can find information how to do this or provide an example?
Hi,

The following line trows error

QueryResult result = conn.query( 'SELECT Id FROM Account WHERE GroupId = \'00Ge0000000GrKK\' AND Account_Type__c = \'SAM Managed\'' );

Help me fix the same
  • January 16, 2014
  • Like
  • 0

Today we’re excited to announce the new Salesforce Developers Discussion Forums. We’ve listened to your feedback on how we can improve the forums.  With Chatter Answers, built on the Salesforce1 Platform, we were able to implement an entirely new experience, integrated with the rest of the Salesforce Developers site.  By the way, it’s also mobile-friendly.

We’ve migrated all the existing data, including user accounts. You can use the same Salesforce account you’ve always used to login right away.  You’ll also have a great new user profile page that will highlight your community activity.  Kudos have been replaced by “liking” a post instead and you’ll now be able to filter solved vs unsolved posts.

This is, of course, only the beginning  and because it’s built on the Salesforce1 Platform, we’re going to be able to bring you more features faster than ever before.  Be sure to share any feedback, ideas, or questions you have on this forum post.

Hats off to our development team who has been working tirelessly over the past few months to bring this new experience to our community. And thanks to each of you for helping to build one of the most vibrant and collaborative developer communities ever.
 

There is an extremely annoying issue in running tests in the last SF release. For some reason test classes show as failed with 0 test failures. Definitely a salesforce bug, am I the only one who has noticed this? 

 

 

Hi All,

I am getting below exception when downloading the force.com project.

 

below is the message:

 

Exception happened when resolving component type(s), so no component

will be added to the package manifest editor for these types.

*SamlSsoConfig

See log for detail exception message.

 


Thanks,

Hi, I'm pretty new to visualforce development.  I'm currently trying to create a page that will serve as an  update wizard for a parent and child custom object.  I'm getting the following error when trying to reference the child object (Petition__c) in the VF page.

 

Error: Could not resolve the entity from <apex:inputField> value binding '{!petition.Start_Date__c}'. <apex:inputField> can only be used with SObject fields.

 


So as it is I can get and update information from the "h2case" but not from the "petition".  I'll post my vf and controller code below.  

 

 

<apex:page controller="Testappnotcont">
    <apex:sectionHeader title="Approval Notice Received"/>
        <apex:form >
            <apex:pageBlock title="Update Member Information">
                <apex:pageblockButtons >
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>
                </apex:pageblockButtons>
                    <b>Scan approval notice into company's e-file using the following format </b>
                            <blockquote> <FONT COLOR="#FF0000">Company Name - Approval - Last 5 digits of            the approval notice</FONT> </blockquote>
                <apex:pageBlockSection title="H2Case Information">
                    <b> Update the H2Case status to "Approval Notice Recieved". </b>
                            <apex:inputField value="{! h2case.status__c}"/>
                </apex:pageBlockSection>
                <apex:pageBlockSection title="Petition Information">
                    <p> <b> Make sure that the start and end dates are correct. </b> <br/>
                            <apex:inputField value="{! petition.Start_Date__c}"/> <br/>
                            <apex:inputField value="{! petition.End_Date__c}"/> </p>
                        <b> Number of workers. </b>
                            <apex:inputField value="{! petition.Max_Workers__c}"/>
                        <b> Date USCIS notice received. </b>
                            <apex:inputField value="{! petition.USCIS_Received_Date__c}"/>
                        <b> Petition Number</b> <FONT COLOR="#FF0000">(if not already updated).</FONT>
                            <apex:inputField value="{! petition.name}"/>
                        <b> Update Petition status to "Approved". </b>
                            <apex:inputField value="{! petition.Petition_Status__c}"/>
                        <b> Date the approval notice was received. </b>
                            <apex:inputField value="{! petition.Approval_Notice_Received__c}"/>
                </apex:pageBlockSection>
            </apex:pageBlock>            
        </apex:form>
</apex:page>

 

public class Testappnotcont
{


    public PageReference cancel() {
        return null;
    }


    public H2B_Case__c h2case {get; set;}
    public List<Petition__c> petition {get; set;} 
    
    public Testappnotcont() {
        String id = ApexPages.currentPage().getParameters().get('id');

        h2case = [select id, Status__c from H2B_Case__c where Id = :id][0];
        petition = [select id, Start_Date__c, End_Date__c, Max_Workers__c, USCIS_Received_Date__c, Name, Petition_Status__c, 
        Approval_Notice_Received__c from Petition__c where H2B_Case__r.Id = :h2case.Id];
    }

    public PageReference save() {
        update h2case;
        update petition;
        return null;
    }

}

 

Hi everyone,

 

So I am getting the hand of apex methods being called remote from javascript.

Of course I am having some issues. I have put a temparary method in my apex class that I want to be called from some javascript in the visual force page.

However it seems that I have a bug somewhere because the javascript does not run. 

I have been looking at this code for i'm guessing a couple of hours and can't see what is wrong. 

Maybe someone on here can give me a hand.

 

Visualforce Javascript / code:

 

<apex:page controller="AMManagementController">
<script>
        function switchMenu(obj,obj1,obj2) 
        {
            var el = document.getElementById(obj);                                       
            if ( el.style.display != 'none' ) {
            el.style.display = 'none';
            }
            else {
            el.style.display = '';
            }
            var e2 = document.getElementById(obj1);                                       
            if ( e2.style.display != 'none' ) {
            e2.style.display = 'none';
            }
            else {
            e2.style.display = '';
            }
             var e3 = document.getElementById(obj2);                                       
            if ( e2.style.display != 'none' ) {
            e3.style.display = 'none';
            }
            else {
            e3.style.display = '';
            }

        }
        
        function CheckUpdate(){
            AMManagementController.UpdateCheck('Update',function(result, event){
                if(result == false)
                    alert('Are you sure you want to do this?');
            },{escape: true});
        }
</script>
<apex:form >
<apex:pageBlock tabStyle="Account" title="Requirement Management">
    <apex:pageBlockButtons >
        <apex:commandButton value="Back" onclick="CheckUpdate();"/>

 

Apex method trying to call:

 

global class AMManagementController {

public AMManagementController(){}

@RemoteAction
    global static boolean UpdateCheck(String test){
        return true;
    }

}

 

Can some one help me understand why using the name of the param in the outputText value field does not work:

 

<apex:pageBlockSection columns="1" id="pbsList">
   <apex:pageBlockTable value="{!casesInQ}" id="pbt" var="c" columns="11" columnsWidth="50" width="1200" rowClasses="grey_background, white_background"> 
	<apex:column value="{!c.CaseNumber}"/>
	<apex:column value="{!c.Priority}"/>
	<apex:column value="{!c.Subject}" width="400"/>
	<apex:column value="{!c.Type}" width="200"/>
	<apex:column value="{!c.Status}"/>
	<apex:column value="{!c.ContactId}"/>
	<apex:column value="{!c.OwnerId}"/>
	<apex:column value="{!c.CreatedDate}"/>
	<apex:column headerValue="Case Age (hrs)">
	   <apex:outputText value="{cDt}" >
		<apex:param name="cDt" value="{!ROUND((NOW() - c.CreatedDate) * 24, 2)}"/>
	   </apex:outputText>		
        </apex:column>	
    </apex:pageBlockTable>      
</apex:pageBlockSection>

 I get a error when saving the page saying the value of the Output is not in a valid format.

 

If I {0} in the value field of outputText it works fine but, ultimately I want to change the background color of the column based on the age of the case, but using 0 to reference the param in a conditional that says if the age of the case is > 2, make the background red, is never going to eval correctly.

 

Thanks for your help

I'm doing a query for chatter that looks like this: 

 

[SELECT Id, Type, CreatedDate, CreatedById, CreatedBy.FirstName, CreatedBy.LastName, ParentId, Body, Title, LinkUrl, ContentData, ContentFileName ,

    (SELECT Id, CommentBody, CreatedDate, CreatedBy.FirstName, CreatedBy.LastName  FROM FeedComments LIMIT 5)

FROM FeedItem WHERE ParentID =: objectId AND Type = \'TextPost\' ORDER BY CreatedDate DESC LIMIT 10]

 

The problem is that the query only returns one comment even though I specify a limit of 5 and I know there are more than 5 comments on the chatter post that I'm rendering. Any insights into why that might be?

 

Thanks!

Scott

Does anyone know of an equivalent to URLFOR in Apex. We now have dynamic components that can be initialized in apex. For example if you wanted to initialize the stylesheet component you could do this:

 

Apex.Component.Stylesheet customstyle = new Apex.Component.Stylesheet();

customstyle.value = '/mystyle.css';

 

This is great but I want to initalize the component to use a static resource stored in a zip file. In visualforce that's easy using the URLFOR() function. Is there anyway to acheive the same functionality in Apex?

 

Thanks!

Scott

Our requirement is that.

 

How to add apex:inputfile dynamically on VF page using wrapper class

 and uploaded files should save to content .

 

 

Very urgent .....

  • October 12, 2012
  • Like
  • 0

if I call

 

var.setPageNumber(integer.valueOf(ApexPages.CurrentPage().getParameters().get('pgNum')));

 

IT ALWAYS sets the pagenumber to 1 regardless of what the apexPages parameter

 

If I However do:

 

Public Integer tstPg = integer.valueOf(ApexPages.CurrentPage().getParameters().get('pgNum')));

var.setPageNumber(txtPg);

 

it sets the page just fine no matter what the ApexPage Parameter is. If it is 2, the page is set to 2

 

Any one have any ideas?