• p1 force developer
  • NEWBIE
  • 30 Points
  • Member since 2010

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

 

I want to know how do formula fields work with offline and mobile in Salesforce.

 

Does the formula fields behave the same way in offline and mobile .

 

Can we use cross object formulas and all  other functions in formula fields in offline and mobile edition of salesforce.

 

Thanks

 

Has any one experienced this issue with date input fields.

 

Date picker for a date input does not work when showHeader="false" in <apex:page>

 

<apex:page standardController="Account" showHeader="false">
<apex:form>
<apex:pageBlock title="Test Date Picker when showHeader is set to False" mode="edit">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.SLAExpirationDate__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

If you set showHeader to "true" then date picker works fine for date input fields.

 

I have tried it in IE8 and Firefox and it shows the same behaviour.

 

 

Thanks

Hi ,

 

I want to know, what is the best approach to change signature of a global apex class in a managed release package.


We have some apex classes and web service in our managed release package which is already being used by several customers in different versions.

 

We need to add a new parameter to these classes and web services. 

 

I already know that we cannot change the signature of a global class or web service. I want to know if we introduce a new class with new signature then how do we handle the test methods and maintain backward compatibility.


Thanks

 how to get the current datetime value in local time zone.

 

I tried system.now() but it returns the value in GMT

 

Thanks

 

We have multi-currency feture enabled.

 


We have several custom objects for documents like sales order, sales quote, ap invoice ,where values  are stored in the local exhange rate.  GBP, EUR, CHF etc. and the corporate currency is set as USD.
 
I need to be able to record an amount (in a new field) in USD
 
Does anyone have a solution to get values for a currency feild in its curporate currency value.

 

I have trieid using convertCurrency in the select statements but it returns the values in user's currency.

 

I want to know, how do we get the values in corporate currency for any  currency field value.

 

Thanks


Is there is a way you for Generating Barcode image on Visualforce and Formula Field. I need to show these on VF pages and also on screens so that it can be exposed on mobile devices or ipad....

 

thanks

 

The following example code demonstrates how to migrate a simple hierarchical query:

Oracle ======

SELECT "NAME", "PARENT", LEVEL FROM COMPANY START WITH ("NAME" = 'Company Ltd') CONNECT BY ("PARENT" = PRIOR "NAME");
SQL Server ==========

WITH h$cte AS ( SELECT COMPANY.NAME, COMPANY.PARENT, 1 AS LEVEL, CAST(row_number() OVER( ORDER BY @@spid) AS varchar(max)) AS path FROM dbo.COMPANY WHERE ((COMPANY.NAME = 'Company Ltd')) UNION ALL SELECT COMPANY.NAME, COMPANY.PARENT, h$cte.LEVEL + 1 AS LEVEL, path + ',' + CAST(row_number() OVER( ORDER BY @@spid) AS varchar(max)) AS path FROM dbo.COMPANY, h$cte WHERE ((COMPANY.PARENT = h$cte.NAME)) ) SELECT h$cte.NAME, h$cte.PARENT, h$cte.LEVEL FROM h$cte ORDER BY h$cte.path Note The ROW_NUMBER() function evaluates the path column to provide Oracle nodes ordering.

 

Above code is for Oracle and SQL Server.

 

I need to implement it in SFDC using SOQL and APEX. Can some one please help!!!!

 

thanks

 

 

 

 

Hi

 

I need to urgently develop a page which shows the mulit-level Bill of material.

 

This is based on 3 objects

 

Item Master

 BOMHeader

 BOM Lines

 

BOM Header is child of Item Master

BOM Lines is child of BOM Header

 

Following is a example bill of material for product A. 

 

Product A is made of assembly B, components C and D, and material E.  Assembly B is made from components F, G, and H (as well as other assemblies or products).  Note that a component can be made from another component (item D), or a component can be made from raw material (item  C and H).

 

 

 

BOM

 

 

I my case I will have Product A and There will be a BOM header which will have Bom Lines with Product B, C, D & E. Then Product B will have a BOM header records with Bom Lines with product  F, G & H and like wise there can be unlimited levels  of components. Practically there will be maximum 4-5 levels.

 

I need to be able to do a bom explosion and create a flat bom for the work order

 

Also

 

I need to be able to create a page which show the indented Multi-Level BOM for the product A

 

Please let me know, how I can do this using Apex and Visuaforce.

 

Any examples will be greately appreciated.

 

Thanks

 

 

 

 

 

 

 

Hi

 

I need to urgently develop a page which shows the mulit-level Bill of material.

 

This is based on 3 objects

 

Item Master

 BOMHeader

 BOM Lines

 

BOM Header is child of Item Master

BOM Lines is child of BOM Header

 

Following is a example bill of material for product A. 

 

Product A is made of assembly B, components C and D, and material E.  Assembly B is made from components F, G, and H (as well as other assemblies or products).  Note that a component can be made from another component (item D), or a component can be made from raw material (item  C and H).

 

 

 

BOM

 

 

I my case I will have Product A and There will be a BOM header which will have Bom Lines with Product B, C, D & E. Then Product B will have a BOM header records with Bom Lines with product  F, G & H and like wise there can be unlimited levels  of components. Practically there will be maximum 4-5 levels.

 

I need to be able to do a bom explosion and create a flat bom for the work order

 

Also

 

I need to be able to create a page which show the indented Multi-Level BOM for the product A

 

Please let me know, how I can do this using Apex and Visuaforce.

 

Any examples will be greately appreciated.

 

Thanks

 

 

 

 

 

 

 

Has any one experienced this issue with date input fields.

 

Date picker for a date input does not work when showHeader="false" in <apex:page>

 

<apex:page standardController="Account" showHeader="false">
<apex:form>
<apex:pageBlock title="Test Date Picker when showHeader is set to False" mode="edit">
<apex:pageBlockButtons>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageBlockSection columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.SLAExpirationDate__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

If you set showHeader to "true" then date picker works fine for date input fields.

 

I have tried it in IE8 and Firefox and it shows the same behaviour.

 

 

Thanks

Hi ,

 

I want to know, what is the best approach to change signature of a global apex class in a managed release package.


We have some apex classes and web service in our managed release package which is already being used by several customers in different versions.

 

We need to add a new parameter to these classes and web services. 

 

I already know that we cannot change the signature of a global class or web service. I want to know if we introduce a new class with new signature then how do we handle the test methods and maintain backward compatibility.


Thanks

We have multi-currency feture enabled.

 


We have several custom objects for documents like sales order, sales quote, ap invoice ,where values  are stored in the local exhange rate.  GBP, EUR, CHF etc. and the corporate currency is set as USD.
 
I need to be able to record an amount (in a new field) in USD
 
Does anyone have a solution to get values for a currency feild in its curporate currency value.

 

I have trieid using convertCurrency in the select statements but it returns the values in user's currency.

 

I want to know, how do we get the values in corporate currency for any  currency field value.

 

Thanks


I think the Spring '11 release changed the behavior of some batch apex classes depending on how queries are used. I am now getting the following exception in a batch apex class that I haven't touched in over a year:

 

System.QueryException: Aggregate query has too many rows for direct assignment, use FOR loop

 

From what I can tell this started happening after the Spring 11 update.

 

Here is the simple code to reproduce the issue:

 

global class BatchJob implements Database.Batchable<sObject>{

	public string query = 'select Id, Name, (Select Id from Contacts) from Account';

	global Database.QueryLocator start(Database.BatchableContext bc){
		return Database.getQueryLocator(query); 
	}
	
	global void execute(Database.BatchableContext bc, List<sObject> objects){
	 	List<Account> accts = new List<Account>();
	 	for(sObject s : objects){
	 		Account a = (Account)s;
	 		system.debug('Throw error...');
	 		system.debug(a.Contacts); //This will throw a 'silent' System.QueryException
	 	}
	}
	 
	global void finish(Database.BatchableContext bc){
		system.debug('All done.');	 
	}
}

And here is the test class:

 

@isTest
private class BatchBugTEST {

    static testMethod void myUnitTest() {
        Account acct = new Account(Name = 'test');
        insert acct;
        
	//create some contacts
	List<Contact> cons = new List<Contact>();
		
	Integer count = 0;
	for(Integer i = 0; i < 200; i++){
		cons.add(new Contact(AccountId = acct.Id, LastName = 'test' + i));
	}
	insert cons;
	system.debug(cons.size());
		
	//Setup batch job       
        BatchJob job = new BatchJob();
	job.query += ' where Id = \'' + acct.Id + '\'';
		 
	Test.startTest();
	Database.executeBatch(job);
	Test.stopTest();
    }
}

What is most concerning about this is the System.QueryException is "silent". What I mean by this is that the code keeps running as if no exception occurred. Usually when a system exception occurs everything comes to a screeching halt and errors are displayed as test failures on the results page. In the case the code continues and the only way to see the error is to locate it in the debug logs.

 

The only reason I caught this error was good unit tests with assertions. If I didn't have these I would have had no idea this class stopped working correctly. I will be submitting a support ticket but if anyone from salesforce can run the code above on a Winter 11 instance I would be interested what the results are.

 

-Jason

 

 

 

 

  • February 14, 2011
  • Like
  • 0

Hi

 

I need to urgently develop a page which shows the mulit-level Bill of material.

 

This is based on 3 objects

 

Item Master

 BOMHeader

 BOM Lines

 

BOM Header is child of Item Master

BOM Lines is child of BOM Header

 

Following is a example bill of material for product A. 

 

Product A is made of assembly B, components C and D, and material E.  Assembly B is made from components F, G, and H (as well as other assemblies or products).  Note that a component can be made from another component (item D), or a component can be made from raw material (item  C and H).

 

 

 

BOM

 

 

I my case I will have Product A and There will be a BOM header which will have Bom Lines with Product B, C, D & E. Then Product B will have a BOM header records with Bom Lines with product  F, G & H and like wise there can be unlimited levels  of components. Practically there will be maximum 4-5 levels.

 

I need to be able to do a bom explosion and create a flat bom for the work order

 

Also

 

I need to be able to create a page which show the indented Multi-Level BOM for the product A

 

Please let me know, how I can do this using Apex and Visuaforce.

 

Any examples will be greately appreciated.

 

Thanks

 

 

 

 

 

 

 

 

I have code in production that passes all unit tests and works fine in most cases but in some instances I am getting an Invalid Query Locator error and I can't figure out why.

 

 

My code is a custom rollup trigger that  triggers when a case is 'Closed'.  Rolling up data from cases to their parent accounts.

 

 

My code loops through trigger.new to collect the accountid associated with each case that has just closed.  It then loops through the list of accounts pulling and account record and any associated cases.  Finally it loops through the accounts, loops through each account's cases, and adds up all of the appropriate values depositing the result into fields within the Account then updates the account.  A simple rollup really.

 

 

This works fine most of the time but I have come across some accounts that fail this process, it doesn't matter which case is closed on the account, I always get the same error so the problem is with the account not with the case.  This account has roughly 340 closed cases, though I don't believe that is anywhere near any kind of limit.

 

 

To get to my point, I'm not sure what 'Invalid Query Locator' means in this particular case.  I have seen very little info about the Query Locator, all of it old, but it all suggests problems that occur when querys time out or have been 'garbage collected'.  In this case the error comes back immediately so timeout or memory cleanup should not be an issue.

 

 

 

Below is the relevant code, it's chopped to remove specific custom field names and such so it's pretty ugly.

 

Any help is greatly appreciated.

 

Many Thanks

Jon

 

 

 

 

//if the given trigger has just been closed then roll up the FQTD follup values

set<ID> FQTDAccountIDs = new set<ID>(); //list of Accounts involved with fqtd rollup calculations
map<ID, Account> AccountsToUpdate = new map<ID, Account>(); //the accounts that will be updated by this trigger


//prepare for FQTD rollup

Integer i = 0;
for(case theCase : trigger.new)//loop through all of the available records in the trigger
{
if((trigger.old[i].status != 'Closed') && (trigger.new[i].status == 'Closed'))
{
if(!FQTDAccountIDs.contains(trigger.new[i].accountid))
{
FQTDAccountIDs.add(trigger.new[i].accountid);
System.Debug('Adding Account to the FQTD List: ' + trigger.new[i].accountid);
}
}
i++;
}


//ok, so we may have a list of records to update, lets get to the action
if(FQTDAccountIDs.size() > 0) //do we have any records to update?
{

 

  //loop through all accounts and add them, with their cases, to a map for later looping

for(Account thisAccount : [Select Id, name, (Select casenumber, status From Cases where status = 'Closed') From Account where id in :FQTDAccountIDs])
{
AccountsToUpdate.put(thisAccount.id, thisAccount);
}


//loop through each specified account
for(Account currentAccount : AccountsToUpdate.values())
{




// ****** This next for loop is the apparent problem; System.Exception: invalid query locator ********

//loop through all cases associated with this account
for(Case theCase : currentAccount.Cases)
{

//calculate the fields and rollup the data
// currentAccount.rolledupfield += theCase.rollupfield1__c + theCase.rollupfield2__c
}



}


//update the Accounts with the new values
update AccountsToUpdate.values();



}