• RockDeveloper
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 19
    Replies

Hello there,

 

I want to display a string variable of Page Controller on its corresponding Visualforce Page. I can do it using forllowing code:

 

<apex:outputText style="font-style:italic" value="{!strOperationStatus}"/>

 

However, {!strOperationStatus} is a string variable. That variable contains some HTML code. But, visualforce page displays that content with Tags like this:

 

<HTML><P>....some contents....</p></HTML>

 

I want to display contents only.

 

Please tell me a way t do this. I want to do this in this perticular way only as this string will be dynamic.

 

Thank you.

 

  • February 07, 2013
  • Like
  • 0

If you want to refresh Parent page in Internet Explorer irresctive of their version  like 7,8,9  

 

Just do the Following setting : 

 

Go to Tool --> Internet Option - > Security--> Custom level-- > Enable Naviagate across cross domain.

 

and Write following code in your apex page (Javascript code):

 

 window.opener.location.reload(true); window.close(); 

 

This is also working in chrome and Firefox..Just try it.

 

 

 

How to use custom label in command link at value=" add quote " attribute. I want add quote comes from custom label.

How is it possible?

I have an apex page that posts a quantity variable that a user inputs to a class file.  It works fine when the user uses it, but when running the test functions it fails.  If I take the limit variable out on the SOQL statement though the test will pass.

 

If I hard code the quantity variable the test will pass as well, but if I leave the qantity variable as is, the test fails.  This is the only piece I can't get to pass so I can  push to production.  The quantity needs to come from the apex page as it pulls the necessary amount of records based upon the value from that quantity field.

 

 

public Integer quantity { get; set; }
public Integer licenseType {get; set;}

Integer previewCount;
Integer qty = 1;

public List<License_Inventory__c> LicenseInventoryItem {get; set; }  
public List<License_Inventory__c> Licenses {get; set;}

public License_Inventory__c generatePreview()
{
    previewCount = quantity > 15 ? 15 : quantity;
Licenses =  [SELECT Id, License__c, License_Type__c, Status__c FROM License_Inventory__c WHERE Status__c = 'Inventory' AND License_Type__c = :licenseType ORDER BY License__c ASC LIMIT :previewCount];   
		
    return null;
}

public  License_inventory__c getLicenses()
{ 
     sequential = 0;
     string status = 'Inventory';
		
     qty = quantity > 1 ? 1 : quantity;
		
     List<License_Inventory__c> LicenseInventoryItem = [SELECT Id, License__c, License_Type__c, Status__c, Product__c, Product_Code__c, Version__c, Total_Installations_Allowed__c FROM License_Inventory__c WHERE Status__c = :status AND License_Type__c = :licenseType ORDER BY License__c ASC LIMIT :qty];   
		
     inventories = new License_Inventory__c[0];
     for (License_Inventory__c l : LicenseInventoryItem) 
     {
       //additional code
     }
}

 
    @isTest(SeeAllData = True)
    public static void getLicensesTest()
    {
        License_Inventory__c ll = new License_Inventory__c();
        NumberPeelerController controller = new NumberPeelerController();

        integer sequential = 0;
        integer quantity;
        quantity = 10;
        Integer qty;
        qty = quantity;
        string status = 'Inventory';
        
        ll.License__c = '000-000-000-000';
        insert ll;
        
        //Run Licenses Test        
        List<License_Inventory__c> sl = [SELECT Id, License__c    FROM License_Inventory__c WHERE Status__c = :status AND License_Type__c = 'Full' LIMIT :qty]; 
        
        System.assertEquals(10, sl.size());
    }	

@isTest(SeeAllData = True)
	public static void getLicensesTest()
	{
		License_Inventory__c ll = new License_Inventory__c();
		NumberPeelerController controller = new NumberPeelerController();

		integer sequential = 0;
		integer quantity;
		quantity = 10;
		Integer qty;
		qty = quantity;
		string status = 'Inventory';
		
		ll.License__c = '000-000-000-000';
		insert ll;
		
		//Run Licenses Test		
		List<License_Inventory__c> sl = [SELECT Id, License__c	FROM License_Inventory__c WHERE Status__c = :status AND License_Type__c = 'Full' LIMIT :qty]; 
		
		System.assertEquals(10, sl.size());
	}

 

Any help would be appreciated as I'm stuck on this last portion.

 

Thanks

 

I every few weeks get the following in my customer portal and it's when I go to a contact in my salesforce database and login to portal as user.

 

caused by: System.QueryException: List has no rows for assignment to SObject

Class.portalHomePageController.<init>: line 12, column 1

 

It is referencing this controller which is my portal home page.

Line 12 is oContact=[select Id,Name,AccountId,Account.Name,Account.Protocol__c, Account.Banks__c,Account.Plateforme_ASP__c from Contact where id=:oUser.ContactId];

 

This would mean that there is no contact returned for which I just logged in as portal user. Is this just a bug that will happen if the SOQL query errors? Is there something I can do to prevent this? Should I put it into a list and check it and if it's size()=0 then requery it?  There is no reason that the SOQL query would ever return null because it would mean there is no portal user.

 

Thanks for any help,

 

Dahveed

 

public class portalHomePageController {
    
    public List <AlertManagement__c> listFlux {get;set;}
    public List <Portal_Marketing__c> listFluxMK {get;set;}
    public Contact oContact {get;set;}
    public Account oAccount {get;set;}
    public User oUser {get;set;}
    
    public portalHomePageController(){
                
        oUser=[SELECT id, ContactId, LanguageLocaleKey FROM User WHERE id=:userinfo.getuserid()];
        oContact=[select Id,Name,AccountId,Account.Name,Account.Protocol__c, Account.Banks__c,Account.Plateforme_ASP__c from Contact where id=:oUser.ContactId];
        oAccount=[select id, Name, Plateforme_ASP__c, ID_base_production__c, Banks__c, Protocol__c from Account where Id=:oContact.AccountId];  

 

........rest of logic

HI 

 

Am new to the Validation Rules. Am trying to Make the Lead Status Non Editable using a Validation Rule "ISCHANGED( Status )".. its working fine.. But the problem is, when i try to convert the lead to Opp the status will change to "Warm/Samples Sent" and there throws the Error. I could't able to convert the lead to Opp.

 

ThankU

I Have two Objects Product_Master__c and Order_Product__c,in Order_Product__c i have given look up to Product_Master__c ,,,,,,,i want to get look up fields of  Product_Master__c in Order_Product__c...........i am getting the value but its in id form how can i get it in text type

I need to be able to parse the body of an external email to create a record in one of our custom objects. 

 

I don't want the entire body in one field.  The current email has fields like DESCRIPTION, RISK, ETC

 

Is there a way to "find" these headers somehow in the email and pop the info into certain field in SF?

 

Thanks!

  • March 22, 2013
  • Like
  • 0

How to load XML pagelayout data into sales for sandbox. I have the xml with me. I need to load into Dev Sandbox Can any one let me know the process. Much appriciated

 

 

global class deleteAccounts implements Database.Batchable<Sobject>
{
global final String Query;
global deleteAccounts(String q)
{
Query=q;

 

}

global Database.QueryLocator start(Database.BatchableContext BC)
{
return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<SObject> scope)
{
List<Account> lstAccount = new list<Account>();
for (SObject s : scope) //for all objects from our query

{
Account a = (Account)s;
lstAccount.add(a);

}
Delete lstAccount;
}

global void finish(Database.BatchableContext BC)
{
//Send an email to the User after your batch completes
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'na@gmail.com'};
mail.setToAddresses(toAddresses);
mail.setSubject('Apex Batch Job is done');
mail.setPlainTextBody('The batch Apex job processed ');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

 

 

now iam learning stage in batch apex............so how to run the above batch program,i save this apex program in my developer instance with out errors but i dnt knw how to run and how to get output

Hi,

 

I want to create an app for online forms. There can be many forms with different fields in it. Later on, I will create VF page for them to be available online.

 

My question is, which approach should I follow for this ? Should I create different object for each form or some other approach? It should allow me to add new kind of form easily and quickly.

 

Thanks in advance.

Hello

 

I am new to salesforce and I am learning from Recruiting App l I am stuck and cant find the answer.As far as Positon, Candidate and job application is concern , I have imported all the data as advised on page 127 but On page 167 I have to assign Cynthia Capobianco as CEO but there is no data availiable to assign from the drop down list, only availiable name is my name and In recruiting app book no where mention about where and how those data163 (177 / 374) comes automatically. Unless and untill I assign all the roles I wont able to test the app.

I am using free developer addition. Please help.

I would like to be able to create custom or standard default price lists for accounts (not pricing on items in an opportunity or quotes on opportunities). I understand that I need to create a TRIGGER to do this. How do I set that up?

  • February 14, 2013
  • Like
  • 0

hi firends,

          Error: sregdform Compile Error: Invalid type: Registrations__c at line 5 column 33

        i am writing the code..but i dont know this error..

 

public class sregdform
{
public boolean displyvalue{get;set;}
public boolean displyform{get;set;}
public Registrations__c s=new Registrations__c();
public sregdform()
{
displyvalue=true;
}
public Registration__c gets()
{
return s;
}
public void send()
{
if((s.password__c == s.confirmpassword__c))
{
//insert s;
Database.SaveResult sr=Database.insert(s,false);
if(sr.issuccess())
{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Confirm,'Inserted Successfully');
ApexPages.addMessage(myMsg);
}
else
{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.error,'Please check the details');
ApexPages.addMessage(myMsg);
}
}
else
{
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.error,'Please confirm your password');
ApexPages.addMessage(myMsg);
}
}
public void cancel()
{
s=new Registration__c();
}
public void next()
{
string studentnumber = s.Mobile_Number__c ;
if(studentNumber.length()== 14 )
{
system.debug('IF block');
displyvalue=false;
displyform=true;
}
else
{
system.debug('ELSE block');
displyvalue=true;
displyform=false;
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.error,'Please enter 10 digits phone number');
ApexPages.addMessage(myMsg);
}
}
public void back()
{
displyvalue=true;
displyform=false;
}
}

Hi

    We have a doubt that ,after compleating of Approval process  an invoice must generated in the form of pdf and this pdf is to be inserted in Notes and attachments.

 

Is it possible by standard functionality or by custom logic.

  • February 07, 2013
  • Like
  • 0

Hi

 

I have 2 custom objects (assume total fields 200) where  im pulling the data (only filled ) into PDF.

Here my requirement is,  i filled 40 fields so in PDF only 40 fields info will be available.

I have updated more 10 fields total 50 fields.

I need 10 fields data in Bold or different color in PDF.

 

Please advise the possible workaround to achieve it.

 

Thanks in Advance

 

  • February 07, 2013
  • Like
  • 0

Hello there,

 

I want to display a string variable of Page Controller on its corresponding Visualforce Page. I can do it using forllowing code:

 

<apex:outputText style="font-style:italic" value="{!strOperationStatus}"/>

 

However, {!strOperationStatus} is a string variable. That variable contains some HTML code. But, visualforce page displays that content with Tags like this:

 

<HTML><P>....some contents....</p></HTML>

 

I want to display contents only.

 

Please tell me a way t do this. I want to do this in this perticular way only as this string will be dynamic.

 

Thank you.

 

  • February 07, 2013
  • Like
  • 0

I have a VF page that I am rendering in PDF where part of the content is an Ordered List, with some embedded Unordered Lists. When I use the renderas="pdf" argument in my apex:page line the embedded lists do not render correctly. If I take out the renderas="pdf" argument in the apex:page line, the resulting HTML page does render correctly.

 

Here is an example VF page:

 

<apex:page standardController="Opportunity" sidebar="false"
    showheader="false" cache="true" renderas="pdf">
<HTML>
<head></head>
<body>
    <P>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rutrum est in elit volutpat 
    lacinia. Integer scelerisque enim eu quam tempor in sagittis urna consequat. Morbi euismod, 
    quam nec malesuada lacinia, erat elit varius metus, in vehicula nisl nibh non leo.</P>
    <OL>
        <LI>Curabitur vel euismod est. Nunc id ligula dui, at mollis risus:
        <UL>
            <LI>Morbi ultrices feugiat leo, ut luctus augue lobortis eget;</LI>
            <LI>Vestibulum dignissim risus at turpis pretium ut facilisis dolor bibendum.</LI>
        </UL>
        </LI>
        <LI>IAliquam aliquam porta tellus, sit amet tempor ligula lobortis vitae:
        <UL>
            <LI>Nunc suscipit dui vitae dui sagittis non scelerisque sem ultrices;</LI>
            <LI>Fusce sit amet lorem sed metus tincidunt tristique;</LI>
            <LI>Cras rutrum enim ac ipsum ullamcorper scelerisque</LI>
        </UL>
        </LI>
        <LI>Aenean eu neque mattis nibh viverra facilisis viverra ac sapien. Integer 
            sed mauris at nibh volutpat varius ac volutpat dolor.</LI>
        <LI>Vestibulum euismod ipsum sed eros faucibus laoreet arius diam sit amet 
             metus venenatis nec imperdiet nibh dapibus.</LI>
    </OL>
    <P>Aliquam luctus turpis non lectus rhoncus non hendrerit eros facilisis. Nulla facilisi. 
    Nunc blandit tortor id nisl egestas semper tristique nunc cursus. Donec vulputate venenatis mi, 
    vitae pretium nisl dapibus eu. Sed purus nisi, malesuada in imperdiet ac, rhoncus sit amet velit. 
    Sed a quam nec lorem consectetur bibendum ut quis augue. Mauris et nulla eget purus sodales 
    tempor vitae at diam.</P> 
</body>
</html> 
</apex:page>

 The rendered PDF page shows as follows:

 

 

 

 

Whereas if I remove the renderas="pdf" in the apex:page line and let the page render as HTML, I get the following result:

 

 

 

Seems like the PDF render within VF is not producing reasonable output results for this example.

 

Has anyone else seen this type of issue?  Is there any way to weork around the problem?

Hi,

 

I am creating visualforce email template for the Knowledge Base articles.  

 

My intention is to display the description of the article in the body of the email and the files in that article as an attachments to an email. 

 

I am able to display the description in the email body but I am not able to attachment the file to an email. 

 

How can I do this? Please help me out. 

 

Thanks in advance

  • February 05, 2013
  • Like
  • 0

Hi All,

 

I am having problem with sites. 

 

Actually I have created a flow and I am running that flow using the visualforce page on sites. 

 

The procedure in my flow is: 1. It will check the existing contact. 2.  then we will redirect to another flow screen and 3. form( custom object) record will be created.

 

I have given form__c object permission for Guest user license on sites and also the fields but as soon as I click on the next button ie., on 2 step I am getting authorization required error. I have check with visualforce page it is going well but I am not able to do it with sites. Can anyone help me in the issue.

 

Thanks in advance.

 

Thanks,

Swathi Siliveri

  • November 27, 2012
  • Like
  • 0

I have an object with many fields that should be editable when a NEW record is being created. However, only 2 of these fields should be editable for an existing record. Other fields should not be editable for existing record. I thought I could use field-level security settings. But using that, the fields are not editable even at Create-time. How can I make a field to be editable at create-time (new record) but non-editable at edit-time (existing record).