• design
  • NEWBIE
  • 55 Points
  • Member since 2009

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

Hello,

 

Is there a way I can have a modal dialog box pop up over a standard object detail page?

 

My use case is:  If our sales team moves an opportunity into a certain stage we want a pop-up over the entire page to deliver some information to them regarding the opportunity based on certain criterea.

 

I've tried using jQuery and YUI via VF Pages but the modal popups only interact within the inline page.  Is there a way I could get it to pop up over the entire detail page without rebuilding the detail page in a custom VF Page?  Would an S-Control work?

 

Thanks

When creating entries in the table - no problems, but when viewing the already existing entries - SelectOption reset to default value (-- None --).

How to display the stored value (Campaign Name) in SelectOption for each row?


Controller:

 

public class VisitReportController{

	private Visit__c visit;
	public List<PosMaterial__c> posMaterials;
	ID campaignID;
	
	public VisitReportController(ApexPages.StandardController controller){
		this.visit = (Visit__c)controller.getRecord();
	}
	
	public ID getCampaigns(){
		return campaignID;
	}
	
	public void setCampaigns(ID campaignID){
		this.campaignID = campaignID;
	}
	
	public List<PosMaterial__c> getPosMaterials(){
		if (posMaterials == null){
			getExistPosm();
		}
		return posMaterials;
	}
	
	public VisitProduct__c [] getExistPosm(){
		posMaterials = [select id, VisitID__c, CampaignID__c, POSType__c, POSQuantity__c
						from PosMaterial__c where VisitId__c = :visit.Id];
		return posMaterials;
	}
	
	public void setPosMaterials(List<PosMaterial__c> posms){
		posMaterials = posms;
	}
	
	public List<SelectOption> getActiveCamps(){
		List<Campaign> cams = [select id, Name from Campaign where isActive =: true];
		
		List<SelectOption> options = new List<SelectOption>();
			options.add(new SelectOption('','-- None --'));
			for (Campaign cam : cams){
				options.add(new SelectOption(cam.id,cam.Name));
			}
		return options;
	}
	
	public PageReference save(){
		try {
			for (PosMaterial__c posm : posMaterials){
				if (posm.VisitID__c == null){
					posm.VisitId__c = visit.id;
				}
				posm.CampaignID__c = campaignID;
			}
			upsert posMaterials;
			
			PageReference visitPage = new PageReference('/' + ApexPages.currentPage().getParameters().get('id'));
			visitPage.setRedirect(true);
			return visitPage;
		} catch (Exception e){
			ApexPages.addMessages(e);
		}
		return null;
	}
	
	public void addPosm(){
		posMaterials.add(new PosMaterial__c());
	}
}

 

 

Visualforce:

 

<apex:page standardController="Visit__c" extensions="VisitReportController">
<apex:form>
<apex:pageBlock>
	<apex:pageBlockTable value="{!posMaterials}" var="prod" rendered="{!NOT(ISNULL(posMaterials))}" id="posm">
		<apex:column headerValue="{!$ObjectType.POSMaterial__c.fields.POSType__c.label}" >
			<apex:inputField value="{!prod.POSType__c}" required="true"/>
		</apex:column>
		<apex:column headerValue="{!$ObjectType.POSMaterial__c.fields.CampaignId__c.label}">
			<apex:selectList value="{!campaigns}" multiselect="false" size="1">
				<apex:selectOptions value="{!ActiveCamps}"/>
			</apex:selectList>
		</apex:column>
		<apex:column headerValue="{!$ObjectType.POSMaterial__c.fields.POSQuantity__c.label}">
			<apex:inputField value="{!prod.POSQuantity__c}" required="true"/>
		</apex:column>
	</apex:pageBlockTable>
	<apex:outputPanel ><apex:commandLink value="Add row" action="{!addPosm}" reRender="posm"/></apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

  • January 14, 2011
  • Like
  • 0

Hello,

in addition to this post, I made a controller for visualforce page, but I can't test cover lines in the if conditionals? Any idea how to do it? Now i have only 26% test coverage.

 

Controller:

 

public class ManageAssets {

Asset tempAssets;

List<Contact> contactLines = new List<Contact>();

List<Asset> assetLines = new List<Asset>();

 

public ManageAssets() {

// left blank

}

 

public PageReference launch() {

startProcess();

PageReference thisPage = ApexPages.currentPage();

thisPage.setRedirect(true);

return thisPage;

}

 

public void startProcess() {

List<Asset> tempAssets = [select Id, Import_AccountName__c, Import_AccountCity__c,

Import_AccountAddress__c, Import_AccountPhone__c, Import_AccountPhone2__c,

Import_AccountUrl__c, Import_FirstName1__c, Import_FirstName2__c,

Import_FirstName3__c, Import_LastName1__c, Import_LastName2__c,

Import_FirstName3__c, Import_LastName1__c, Import_LastName2__c,

Import_LastName3__c, Import_Title1__c, Import_Title2__c, Import_Title3__c,

Import_MobilePhone1__c, Import_MobilePhone2__c, Import_MobilePhone3__c,

Import_ProductCode__c, InstallDate, SerialNumber

from Asset

where Account.Name = 'Account For Imports'

and CreatedDate = today];

 

for (Integer i=0; i < tempAssets.size(); i++) {

String AccId;

if (tempAssets[i].Import_AccountName__c != null) {

List<Account> acc = [Select Id from Account where Name = :tempAssets[i].Import_AccountName__c];

if (acc.size() == 0){

Account accnew;

accnew = new Account();

accnew.Name = tempAssets[i].Import_AccountName__c;

accnew.BillingCity = tempAssets[i].Import_AccountCity__c;

accnew.BillingStreet = tempAssets[i].Import_AccountAddress__c;

accnew.Phone = tempAssets[i].Import_AccountPhone__c;

accnew.Tel2__c = tempAssets[i].Import_AccountPhone2__c;

accnew.Website = tempAssets[i].Import_AccountUrl__c;

insert accnew;

accId = accnew.Id;

} else {

accId = acc[0].Id;

}

}

 

if (tempAssets[i].Import_FirstName1__c != null){

Contact cnt1 = new Contact();

cnt1.FirstName = tempAssets[i].Import_FirstName1__c;

cnt1.LastName = tempAssets[i].Import_LastName1__c;

cnt1.Title = tempAssets[i].Import_Title1__c;

cnt1.Phone = tempAssets[i].Import_MobilePhone1__c;

cnt1.AccountId = accId;

contactLines.add(cnt1);

}

 

if (tempAssets[i].Import_FirstName2__c != null){

Contact cnt2 = new Contact();

cnt2.FirstName = tempAssets[i].Import_FirstName2__c;

cnt2.LastName = tempAssets[i].Import_LastName2__c;

cnt2.Title = tempAssets[i].Import_Title2__c;

cnt2.Phone = tempAssets[i].Import_MobilePhone2__c;

cnt2.AccountId = accId;

contactLines.add(cnt2);

}

 

if (tempAssets[i].Import_FirstName3__c != null){

Contact cnt3 = new Contact();

cnt3.FirstName = tempAssets[i].Import_FirstName3__c;

cnt3.LastName = tempAssets[i].Import_LastName3__c;

cnt3.Title = tempAssets[i].Import_Title3__c;

cnt3.Phone = tempAssets[i].Import_MobilePhone3__c;

cnt3.AccountId = accId;

contactLines.add(cnt3);

}

 

if (tempAssets[i].Import_ProductCode__c != null){

List<Product2> prod = [Select Id, Name from Product2 where ProductCode = :tempAssets[i].Import_ProductCode__c];

if (prod.size() > 0){

Asset assetNew;

assetNew = new Asset();

assetNew.Name = prod[0].Name;

assetNew.Product2Id = prod[0].Id;

assetNew.AccountId = accId;

assetNew.Status = 'Установлено';

assetNew.SerialNumber = tempAssets[i].SerialNumber;

assetLines.add(assetNew);

}

}

}

insert contactLines;

insert assetLines;

}

}

 

 Test class:

 

static testMethod void ManageAssets(){

String accId;

Product2 product = new Product2(Name = 'Test Product');

product.ProductCode = '1234567890';

insert product;

System.assert(product.id != null);

 

Account acc = new Account(Name = 'Test Account');

insert acc;

System.assert(acc.id != null);

 

accId = acc.id;

System.assert(accId != null);

 

Contact cnt = new Contact();

cnt.FirstName = 'Test';

cnt.LastName = 'Test';

cnt.AccountId = acc.Id;

insert cnt;

 

Asset asst = new Asset();

asst.Name = 'Test Product';

asst.Product2Id = product.Id;

asst.AccountId = acc.Id;

asst.ContactId = cnt.Id;

asst.Import_AccountAddress__c = 'Test Street';

asst.Import_AccountCity__c = 'Test City';

asst.Import_AccountName__c = 'Test Account';

asst.Import_AccountPhone2__c = '1234567890';

asst.Import_AccountPhone__c = '1234567890';

asst.Import_AccountUrl__c = 'www.test.com';

asst.Import_FirstName1__c = 'Test';

asst.Import_FirstName2__c = 'Test2';

asst.Import_FirstName3__c = 'Test3';

asst.Import_LastName1__c = 'Test';

asst.Import_LastName2__c = 'Test2';

asst.Import_LastName3__c = 'Test3';

asst.Import_MobilePhone1__c = '1234567890';

asst.Import_MobilePhone2__c = '1234567890';

asst.Import_MobilePhone3__c = '1234567890';

asst.Import_Title1__c = 'Title';

asst.Import_Title2__c = 'Title';

asst.Import_Title3__c = 'Title';

asst.Import_ProductCode__c = '1234567890';

insert asst;

System.assert(asst.Id != null);

System.assert(asst.Import_FirstName1__c != null);

System.assert(asst.Import_FirstName2__c != null);

System.assert(asst.Import_FirstName3__c != null);

System.assert(asst.Import_AccountName__c != null);

System.assert(asst.Import_ProductCode__c != null);

 

ManageAssets cc = new ManageAssets();

cc.startProcess();

 

PageReference pageRef = Page.ManageAssets;

Test.setCurrentPage(pageRef);

pageRef = cc.launch();

if (pageRef != null) {

Test.setCurrentPage(pageRef);

}

}

 

 

 

 

Message Edited by design on 07-29-2009 08:02 AM
Message Edited by design on 07-29-2009 08:04 AM
Message Edited by design on 07-29-2009 08:09 AM
Message Edited by design on 07-29-2009 08:10 AM

Good day, 
first sorry for my english. 
I am a newbie and ask the council for writing bulk trigger.

I created a trigger, which should create a contact, account and assets for imports through the Data Loader.

 

Now I get an error: Too Many SOQL queries

 

I know that all queries need to move out of for


I request your assistance in this matter. 

 

Here is my trigger code:

 

trigger ImportAsset on Asset (before insert) {

 

List<Asset> asset = Trigger.new;

String accId;

for (Asset a : asset){

if (a.Import_AccountName__c != null){

List<Account> acc = [Select Id from Account where Name = :a.Import_AccountName__c];

for (Account account: acc) {

if (acc.size() == 0){

Account accnew;

accnew = new Account();

accnew.Name = a.Import_AccountName__c;

accnew.BillingCity = a.Import_AccountCity__c;

accnew.BillingStreet = a.Import_AccountAddress__c;

accnew.Phone = a.Import_AccountPhone__c;

accnew.Tel2__c = a.Import_AccountPhone2__c;

accnew.Website = a.Import_AccountUrl__c;

insert accnew;

accId = accnew.Id;

} else {

accId = account.Id;

}

}

List<Contact> contactLines = new List<Contact>();

if (a.Import_FirstName1__c != null){

Contact cnt1 = new Contact();

cnt1.FirstName = a.Import_FirstName1__c;

cnt1.LastName = a.Import_LastName1__c;

cnt1.Title = a.Import_Title1__c;

cnt1.Phone = a.Import_MobilePhone1__c;

cnt1.AccountId = accId;

contactLines.add(cnt1);

}

if (a.Import_FirstName2__c != null){

Contact cnt2 = new Contact();

cnt2.FirstName = a.Import_FirstName2__c;

cnt2.LastName = a.Import_LastName2__c;

cnt2.Title = a.Import_Title2__c;

cnt2.Phone = a.Import_MobilePhone2__c;

cnt2.AccountId = accId;

contactLines.add(cnt2);

}

if (a.Import_FirstName3__c != null){

Contact cnt3 = new Contact();

cnt3.FirstName = a.Import_FirstName3__c;

cnt3.LastName = a.Import_LastName3__c;

cnt3.Title = a.Import_Title3__c;

cnt3.Phone = a.Import_MobilePhone3__c;

cnt3.AccountId = accId;

contactLines.add(cnt3);

}

insert contactLines;

}

if (a.Import_ProductCode__c != null){

List<Product2> prod = [Select Id, Name from Product2 where ProductCode = :a.Import_ProductCode__c];

for (Product2 p: prod){

a.Name = p.Name;

a.Product2Id = p.Id;

a.AccountId = accId;

a.Status = 'Setup';

}

}

}

}

 

 I'm grateful for any help..

 

Hi,

 

I have installed WAMP server on my laptop and deployed HTML5 application from Salesforce.com for Mobile workbook.

 

 

App location: 

C:\wamp\www\HTML5

 

Modified Login.js:

var clientId    = 'valid client key';

var redirectUri = 'http://localhost/HTML5/oauthcallback.html';

var proxyUrl    = 'http://localhost/HTML5/proxy.php?mode=native'; 

 

Problem:

========

After successful login I am not able to load the application. I am seeing spinning wheel "loading" .

 

Could someone help me. 

 

Thanks,

Rag

Hello,

 

Is there a way I can have a modal dialog box pop up over a standard object detail page?

 

My use case is:  If our sales team moves an opportunity into a certain stage we want a pop-up over the entire page to deliver some information to them regarding the opportunity based on certain criterea.

 

I've tried using jQuery and YUI via VF Pages but the modal popups only interact within the inline page.  Is there a way I could get it to pop up over the entire detail page without rebuilding the detail page in a custom VF Page?  Would an S-Control work?

 

Thanks

I've started working with Adobe flex and have copied the code from "Creating a Flex Mashup on Force.com" (found on this page: http://wiki.developerforce.com/index.php/Creating_a_Flex_Mashup_on_Force.com) in its entirety.

 

I've also tried the two other example provided by Salesforce on this page: http://wiki.developerforce.com/index.php/Getting_Started_with_the_Force.com_Toolkit_for_Adobe_AIR_and_Flex.

 

When I run the second sample i get these messages in the console: 

[SWF] demo.swf - 1,551,229 bytes after decompression

offline but we will succeed at logging in anyways

query - offline

SQLError: 'Error #3115: SQL Error.', details:'no such table: 'Contact'', operation:'execute', detailID:'2013'

Select Id, FirstName, LastName FROM `Contact`;

SQLError: 'Error #3115: SQL Error.', details:'no such table: 'Contact'', operation:'execute', detailID:'2013'

Select Id, FirstName, LastName FROM `Contact`;

 

It seems to imply that I'm off line, but I'm not.

 

In any event, it appears that I am unable to login in either case.

 

Does anyone have any idea of what might be going wrong?

 

Thanks for your help.

Hello,

in addition to this post, I made a controller for visualforce page, but I can't test cover lines in the if conditionals? Any idea how to do it? Now i have only 26% test coverage.

 

Controller:

 

public class ManageAssets {

Asset tempAssets;

List<Contact> contactLines = new List<Contact>();

List<Asset> assetLines = new List<Asset>();

 

public ManageAssets() {

// left blank

}

 

public PageReference launch() {

startProcess();

PageReference thisPage = ApexPages.currentPage();

thisPage.setRedirect(true);

return thisPage;

}

 

public void startProcess() {

List<Asset> tempAssets = [select Id, Import_AccountName__c, Import_AccountCity__c,

Import_AccountAddress__c, Import_AccountPhone__c, Import_AccountPhone2__c,

Import_AccountUrl__c, Import_FirstName1__c, Import_FirstName2__c,

Import_FirstName3__c, Import_LastName1__c, Import_LastName2__c,

Import_FirstName3__c, Import_LastName1__c, Import_LastName2__c,

Import_LastName3__c, Import_Title1__c, Import_Title2__c, Import_Title3__c,

Import_MobilePhone1__c, Import_MobilePhone2__c, Import_MobilePhone3__c,

Import_ProductCode__c, InstallDate, SerialNumber

from Asset

where Account.Name = 'Account For Imports'

and CreatedDate = today];

 

for (Integer i=0; i < tempAssets.size(); i++) {

String AccId;

if (tempAssets[i].Import_AccountName__c != null) {

List<Account> acc = [Select Id from Account where Name = :tempAssets[i].Import_AccountName__c];

if (acc.size() == 0){

Account accnew;

accnew = new Account();

accnew.Name = tempAssets[i].Import_AccountName__c;

accnew.BillingCity = tempAssets[i].Import_AccountCity__c;

accnew.BillingStreet = tempAssets[i].Import_AccountAddress__c;

accnew.Phone = tempAssets[i].Import_AccountPhone__c;

accnew.Tel2__c = tempAssets[i].Import_AccountPhone2__c;

accnew.Website = tempAssets[i].Import_AccountUrl__c;

insert accnew;

accId = accnew.Id;

} else {

accId = acc[0].Id;

}

}

 

if (tempAssets[i].Import_FirstName1__c != null){

Contact cnt1 = new Contact();

cnt1.FirstName = tempAssets[i].Import_FirstName1__c;

cnt1.LastName = tempAssets[i].Import_LastName1__c;

cnt1.Title = tempAssets[i].Import_Title1__c;

cnt1.Phone = tempAssets[i].Import_MobilePhone1__c;

cnt1.AccountId = accId;

contactLines.add(cnt1);

}

 

if (tempAssets[i].Import_FirstName2__c != null){

Contact cnt2 = new Contact();

cnt2.FirstName = tempAssets[i].Import_FirstName2__c;

cnt2.LastName = tempAssets[i].Import_LastName2__c;

cnt2.Title = tempAssets[i].Import_Title2__c;

cnt2.Phone = tempAssets[i].Import_MobilePhone2__c;

cnt2.AccountId = accId;

contactLines.add(cnt2);

}

 

if (tempAssets[i].Import_FirstName3__c != null){

Contact cnt3 = new Contact();

cnt3.FirstName = tempAssets[i].Import_FirstName3__c;

cnt3.LastName = tempAssets[i].Import_LastName3__c;

cnt3.Title = tempAssets[i].Import_Title3__c;

cnt3.Phone = tempAssets[i].Import_MobilePhone3__c;

cnt3.AccountId = accId;

contactLines.add(cnt3);

}

 

if (tempAssets[i].Import_ProductCode__c != null){

List<Product2> prod = [Select Id, Name from Product2 where ProductCode = :tempAssets[i].Import_ProductCode__c];

if (prod.size() > 0){

Asset assetNew;

assetNew = new Asset();

assetNew.Name = prod[0].Name;

assetNew.Product2Id = prod[0].Id;

assetNew.AccountId = accId;

assetNew.Status = 'Установлено';

assetNew.SerialNumber = tempAssets[i].SerialNumber;

assetLines.add(assetNew);

}

}

}

insert contactLines;

insert assetLines;

}

}

 

 Test class:

 

static testMethod void ManageAssets(){

String accId;

Product2 product = new Product2(Name = 'Test Product');

product.ProductCode = '1234567890';

insert product;

System.assert(product.id != null);

 

Account acc = new Account(Name = 'Test Account');

insert acc;

System.assert(acc.id != null);

 

accId = acc.id;

System.assert(accId != null);

 

Contact cnt = new Contact();

cnt.FirstName = 'Test';

cnt.LastName = 'Test';

cnt.AccountId = acc.Id;

insert cnt;

 

Asset asst = new Asset();

asst.Name = 'Test Product';

asst.Product2Id = product.Id;

asst.AccountId = acc.Id;

asst.ContactId = cnt.Id;

asst.Import_AccountAddress__c = 'Test Street';

asst.Import_AccountCity__c = 'Test City';

asst.Import_AccountName__c = 'Test Account';

asst.Import_AccountPhone2__c = '1234567890';

asst.Import_AccountPhone__c = '1234567890';

asst.Import_AccountUrl__c = 'www.test.com';

asst.Import_FirstName1__c = 'Test';

asst.Import_FirstName2__c = 'Test2';

asst.Import_FirstName3__c = 'Test3';

asst.Import_LastName1__c = 'Test';

asst.Import_LastName2__c = 'Test2';

asst.Import_LastName3__c = 'Test3';

asst.Import_MobilePhone1__c = '1234567890';

asst.Import_MobilePhone2__c = '1234567890';

asst.Import_MobilePhone3__c = '1234567890';

asst.Import_Title1__c = 'Title';

asst.Import_Title2__c = 'Title';

asst.Import_Title3__c = 'Title';

asst.Import_ProductCode__c = '1234567890';

insert asst;

System.assert(asst.Id != null);

System.assert(asst.Import_FirstName1__c != null);

System.assert(asst.Import_FirstName2__c != null);

System.assert(asst.Import_FirstName3__c != null);

System.assert(asst.Import_AccountName__c != null);

System.assert(asst.Import_ProductCode__c != null);

 

ManageAssets cc = new ManageAssets();

cc.startProcess();

 

PageReference pageRef = Page.ManageAssets;

Test.setCurrentPage(pageRef);

pageRef = cc.launch();

if (pageRef != null) {

Test.setCurrentPage(pageRef);

}

}

 

 

 

 

Message Edited by design on 07-29-2009 08:02 AM
Message Edited by design on 07-29-2009 08:04 AM
Message Edited by design on 07-29-2009 08:09 AM
Message Edited by design on 07-29-2009 08:10 AM

Good day, 
first sorry for my english. 
I am a newbie and ask the council for writing bulk trigger.

I created a trigger, which should create a contact, account and assets for imports through the Data Loader.

 

Now I get an error: Too Many SOQL queries

 

I know that all queries need to move out of for


I request your assistance in this matter. 

 

Here is my trigger code:

 

trigger ImportAsset on Asset (before insert) {

 

List<Asset> asset = Trigger.new;

String accId;

for (Asset a : asset){

if (a.Import_AccountName__c != null){

List<Account> acc = [Select Id from Account where Name = :a.Import_AccountName__c];

for (Account account: acc) {

if (acc.size() == 0){

Account accnew;

accnew = new Account();

accnew.Name = a.Import_AccountName__c;

accnew.BillingCity = a.Import_AccountCity__c;

accnew.BillingStreet = a.Import_AccountAddress__c;

accnew.Phone = a.Import_AccountPhone__c;

accnew.Tel2__c = a.Import_AccountPhone2__c;

accnew.Website = a.Import_AccountUrl__c;

insert accnew;

accId = accnew.Id;

} else {

accId = account.Id;

}

}

List<Contact> contactLines = new List<Contact>();

if (a.Import_FirstName1__c != null){

Contact cnt1 = new Contact();

cnt1.FirstName = a.Import_FirstName1__c;

cnt1.LastName = a.Import_LastName1__c;

cnt1.Title = a.Import_Title1__c;

cnt1.Phone = a.Import_MobilePhone1__c;

cnt1.AccountId = accId;

contactLines.add(cnt1);

}

if (a.Import_FirstName2__c != null){

Contact cnt2 = new Contact();

cnt2.FirstName = a.Import_FirstName2__c;

cnt2.LastName = a.Import_LastName2__c;

cnt2.Title = a.Import_Title2__c;

cnt2.Phone = a.Import_MobilePhone2__c;

cnt2.AccountId = accId;

contactLines.add(cnt2);

}

if (a.Import_FirstName3__c != null){

Contact cnt3 = new Contact();

cnt3.FirstName = a.Import_FirstName3__c;

cnt3.LastName = a.Import_LastName3__c;

cnt3.Title = a.Import_Title3__c;

cnt3.Phone = a.Import_MobilePhone3__c;

cnt3.AccountId = accId;

contactLines.add(cnt3);

}

insert contactLines;

}

if (a.Import_ProductCode__c != null){

List<Product2> prod = [Select Id, Name from Product2 where ProductCode = :a.Import_ProductCode__c];

for (Product2 p: prod){

a.Name = p.Name;

a.Product2Id = p.Id;

a.AccountId = accId;

a.Status = 'Setup';

}

}

}

}

 

 I'm grateful for any help..