• ColinMcG
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Hi, I know resizing of iFrames has been tackled before, but the methods don't seem to work when the iFrame is sitting on a VF tab. I am building a multi-tabbed form which will be used to view and input lots of information. For parts of this project, it makes perfect sense to have a second VF page contained within an iFrame, but the problem is that it won't resize properly dynamically. I have this code:

 

function resizeFrame(){
    var newheight=document.getElementById("kpframe").contentWindow.document.body.scrollHeight;
    document.getElementById("kpframe").height=(newheight)+"px";
}

... which I'm calling from the oncomplete event of the tab. This gives me a very small height regardless of the actual height of the iFrame. However, if I call the above script manually after the iFrame is loaded, it shows perfectly.

 

Any ideas about what event I should be tying the above code to so that the size is set correctly when the user chooses the tab it sits on? I think I've tried every combination and I'm getting nowhere. Unfortunately, Premier Support won't help me with this because they say it's a Javascript issue, not a VF one.

I am currently trying to load records into an object, followed by detail records into a child object (master-detail relationship). I will be using the data loader in batch mode to achieve this. The key difficulty with this is that in order to load the child record, you need the ID of the parent record, but of course you don't have this from the outset, so I wondered if anyone has done this before, and how you achieved it.

 

I will be experimenting this afternoon, but what I figure WON'T work is to create an insert trigger for the detail object so that it looks up and adds the parent ID on the BEFORE UPDATE trigger. 

 

My second idea, which I believe would work, is to load all child records against a dummy parent, but use a trigger to look up and assign the real parent.

 

My third idea is to load the parents, then extract all the IDs, then do a join with the child records outside of Salesforce before loading. This is the most foolproof, but involves the greatest complexity, so I'm trying to avoid.

 

Any comments, ideas or feedback on the above would be gratefully received. Thanks!

Hi 

Iam trying to find number of assets on account with some coditions

i had used aggregate funtion,its not giving the correct results.Please i need help on this,waiting for the reply

  AggregateResult[] groupedResults1 =([SELECT AccountId,COUNT(ID)ct FROM Asset where accountid in:contId AND Status != 'Returned' AND Type__c !='Converted'  group by AccountID,Status,Type__c]);

I have written a test method for an Apex Birthday Scheduler Class. The class works great in Sandbox, sending an email to the CEO 2 days before an employees birthday.

 

However, I can't transfer this class to production because my class has 0 test coverage despite writting a test method that creates an account and contact that satisfies my class's query. Am I missing something here? Is there a way to "cheat" and get coverage?

 

I've spent hours on this to no avail. 

 

Here is my code and test method (red indicates lines not covered in Salesforce:

 

global class Birthday implements Schedulable{
global void execute (SchedulableContext ctx)
{

sendBirthdayEmail();

}
public void sendBirthdayEmail()
{

for(Contact con : [SELECT name, Id, Birthdate FROM Contact WHERE Next_Birthday__c = : system.Today().addDays(2) AND Account.Name = 'Company Inc.'])

{
String conId = con.Id;
String conName = con.name;
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
//mail.setTemplateId('00XJ0000000M31w');

mail.setTargetObjectId('005J0000000JWYx');
// mail.setToAddresses('email@company.com');
mail.setsubject('Company Birthday Reminder');
mail.setHtmlBody('This is a scheduler-generated email to notify you that the birthday of Name: <b> ' + con.name + ' </b> is in two days. Birthdate of: ' + con.Birthdate + '. Please wish them a happy Birthday.');
mail.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail });
}

}

 

// test method

static testMethod void myTestBirthday() {

//create the required test data needed for the test scenario
//In this case, I need to create a new contact, with the account name of Company and has a birthday 2 days away
Account testAccount = new Account(name='Company Inc.');
insert testAccount;
Contact testContact = new Contact();
testContact.firstName='Jack';
testContact.lastName='Dell';
insert testContact;

testContact.birthdate=system.Today().addDays(2);

update testContact;

testAccount.name = testContact.id;

//verify that the birthdate field was updated in the database

//Contact updatedContact = [SELECT birthdate FROM Contact WHERE Id =:testContact.Id];
//System.assertEquals(system.Today().addDays(2) , updatedContact.birthdate);

 

//Contact nextUpdatedContact = [SELECT Account.name FROM Contact WHERE Id =:testContact.Id];
//System.assertEquals(system.Today().addDays(2) , nextupdatedContact.birthdate);

for(Contact con : [SELECT name, Id, Birthdate FROM Contact WHERE Next_Birthday__c = : system.Today().addDays(2) AND Account.Name = 'Company Inc.'])
{
String conId = con.Id;
String conName = con.name;
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
//mail.setTemplateId('00XJ0000000M31w');

mail.setTargetObjectId('005J0000000JWYx');
// mail.setToAddresses('company@company.com');
mail.setsubject('Company Birthday Reminder');
mail.setHtmlBody('This is a scheduler-generated email to notify you that the birthday of Name: <b> ' + con.name + ' </b> is in two days. Birthdate of: ' + con.Birthdate + '. Please wish them a happy Birthday.');
mail.setSaveAsActivity(false);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail });
}
}

 

}

I am currently trying to load records into an object, followed by detail records into a child object (master-detail relationship). I will be using the data loader in batch mode to achieve this. The key difficulty with this is that in order to load the child record, you need the ID of the parent record, but of course you don't have this from the outset, so I wondered if anyone has done this before, and how you achieved it.

 

I will be experimenting this afternoon, but what I figure WON'T work is to create an insert trigger for the detail object so that it looks up and adds the parent ID on the BEFORE UPDATE trigger. 

 

My second idea, which I believe would work, is to load all child records against a dummy parent, but use a trigger to look up and assign the real parent.

 

My third idea is to load the parents, then extract all the IDs, then do a join with the child records outside of Salesforce before loading. This is the most foolproof, but involves the greatest complexity, so I'm trying to avoid.

 

Any comments, ideas or feedback on the above would be gratefully received. Thanks!

We have created a web to lead form from our developer sandbox. But sadly, none of the data we are entering has been working. We have enabled the debug setting but haven't gotten anything back in a debug email.

 

The html we are using is:

 

<html>
	<head>
		<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
	</head>
	<body>
		<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

		<input type=hidden name="oid" value="00DT0000000HRXp">
		<input type=hidden name="retURL" value="http://pictometry.com">
<input type="hidden" name="debug" value=1>
<input type="hidden" name="debugEmail" value="xxxx@pictometry.com">
<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>

<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br>

<label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br>

<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>

<input type="submit" name="submit">

</form>
	</body>
</html>

 

 

But I am using a valid email address in the real HTML.

 

What we get from the salesforce servlet is:

 

Your request has been queued.

Record Information:

oid: 00DT0000000HRXp
retURL: http://pictometry.com
debug: 1
debugEmail: xxxx@pictometry.com
first_name: Matthew
last_name: Allen
email: xxxx@pictometry.com
company: Pictosomething
city: Rocherster
state: NY
submit: Submit Query
How to create the clone of Custom Object.
I have a requirement which needs the exact replica of the Custom Object for some other business. How can I clone the object itself.
Using VF, I have modified some of my related lists to display additional columns of information (from objects not available in the "stock" lists). Beyond that I want these re-created lists to look and feel the same as the "stock" ones. And they do, with just one exception: there is no confirmation that pops up when the Del link is clicked.
 
Code:
<apex:outputLink value="/setup/own/deleteredirect.jsp">Del
     <apex:param name="Id" value="{!priority.ID_3__c}"/>
     <apex:param name="delID" value="{!priority.ID_1__c}"/>
     <apex:param name="retURL" value="/{!priority.ID_3__c}"/>
</apex:outputLink>

As you can see the link has the same URL as the stock link and the params provide the needed information from the controller extension. What do I need to do to get the confirmation pop-up? The users are paranoid about accidentally deleting something.
 
Thanks,
 
Mauricio
  • April 24, 2008
  • Like
  • 0