• TehNrd
  • PRO
  • 2352 Points
  • Member since 2007

  • Chatter
    Feed
  • 81
    Best Answers
  • 11
    Likes Received
  • 1
    Likes Given
  • 278
    Questions
  • 1479
    Replies

I know I can use an actionStatus to disable a specific button or input field during an action/rerender.  However, I would like to disable all user inputs (check boxes, date inputs, etc.) during a rerender that is triggered by just one input.  Basically, I'd like an actionStatus that all of the inputs are listening on so that they all disable themselves until the the action is complete. 

Hello,

 

i wrote pretty basic data collecting class in Apex for generating a PDF document.

This is the class:

 

public with sharing class pdfData {
	public String sys = Apexpages.currentPage().getParameters().get('sys');
	public String userID = UserInfo.getUserId();
	public Integer lineCount = 0;
	public Integer maxLines = 21;
	public List<ItemSystemRelation__c> list1 = new List<ItemSystemRelation__c>();
	public List<ItemSystemRelation__c> list2 = new List<ItemSystemRelation__c>();
	public User curUser = [Select Street, PostalCode, City FROM User WHERE Id = :userID];
	public Rental__c rental = [Select Id, Name,Period__c, Owner.Name, Rental_fee__c, Calculation_starts_week__c, Start__c, End__c, Account_ERP_No__c,Account_Tax_number__c, Account_City__c, Account_Street__c, Account_Zip_Code__c, Account__r.Name FROM Rental__c WHERE Rental_System__c = :sys limit 1];
	public Rental_Systems__c rsystem = [Select Id, Name, System_Name__c FROM Rental_Systems__c WHERE Id = :sys limit 1];
	private List<ItemSystemRelation__c> items = [Select Item__r.Short_description__c, Item__r.Name, Item__r.Item_Name__c FROM ItemSystemRelation__c WHERE Rental_System__c = :sys AND Item__r.Active__c = true order by Item__r.Name];
	public String curDate = system.today().format();
	public pdfData(){
	}
	public Rental__c getRental(){
		return rental;
	}
	public Rental_Systems__c getRSystem(){
		return rsystem;
	}
	public String getToday(){
		return System.today().format();
	}
	public String getStart(){
		return rental.Start__c.format();
	}
	public String getEnd(){
		return rental.End__c.format();
	}
	public User getUser(){
		return curUser;
	}
	public Integer getItemCount(){
		return items.size();
	}
	public List<ItemSystemRelation__c> getItems(){
		return items;
	}
	public String getCurDate(){
		return curDate;
	}
	public void populateLists(){
		Integer totalLines = 0;
		for(Integer i = 0;i < items.size();i++){
			if(items.get(i).Item__r.Short_description__c != null){
				totalLines = math.round(totalLines + items.get(i).Item__r.Short_description__c.length()/80);
			}else{
				totalLines++;
			}
			if(totalLines < maxLines){
				System.debug(items.get(i));
				list1.add(items.get(i));
			}else{
				list2.add(items.get(i));
			}
		}
	}
	public List<ItemSystemRelation__c> getList1(){
		populateLists();
		return list1;
	}
	public Integer getSize1(){
		return list1.size();
	}
	public List<ItemSystemRelation__c> getList2(){
		return list2;
	}
	public Boolean getShowList2(){
		if(list2.size() < 1){return false;}else{return true;}
	}

 

 

I am now writing the test methods to deploy it in production, but it fails at the database query where the URL parameter is used.

How can I set this variable when creating a new instance of the class in the beginning of my test method?

Or is there any way around this problem?

 

Regards,

hoomel

 

  • February 15, 2011
  • Like
  • 0

I'm having an issue with saving a Visualforce page as a PDF attachment.

 

My page is (simplified):

<apex:page id="thePage" standardController="Case" extensions="customStuff" renderAs="{!renderMode}" showHeader="{!renderMode != 'pdf'}" standardStylesheets="{!renderMode != 'pdf'}">

   <apex:form id="theForm" rendered="{!renderMode != 'pdf'}">
      <apex:pageBlock id="theBlock">
         <apex:pageBlockSection id="theSection" columns="3">
            <apex:pageBlockSectionItem id="theSectionItems">
               <apex:outputLabel for="chooseTemplate" value="Choose the EOB template to use:" />
                  <apex:outputPanel >
                     <apex:selectList id="chooseTemplate" value="{!template}" size="1">
                        <apex:selectOptions value="{!templates}" />
                        <apex:actionSupport event="onchange" rerender="theBlock, theLetterBody" status="loadStatus" onsubmit="javascript&colon;document.body.style.cursor = 'wait';" oncomplete="javascript&colon;document.body.style.cursor = 'default';" />
                     </apex:selectList>
                     <apex:actionStatus id="loadStatus">
                     <apex:facet name="start"><img src="/img/loading.gif" /></apex:facet>
                  </apex:actionStatus>
               </apex:outputPanel>
            </apex:pageBlockSectionItem>
            <apex:commandButton action="{!savePDF}" value="Attach PDF" rendered="{!len(template) > 1}"/>
         </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>

      <div id="content">
      </div>
</apex:page>

 

 

And the controller (also simplified):

 

public class customStuff {

  private string caseID;
  public Case activeCase {get; set;}
  public string renderMode {get; set;}
  public string Template {get; set;}
	
  public customStuff(ApexPages.StandardController controller) {
		
    caseID = ApexPages.currentPage().getParameters().get('id');
    if (caseID != null){
      setActiveCase();
    }
    	
    	if(ApexPages.currentpage().getParameters().get('t') != null) {
    		template = ApexPages.currentpage().getParameters().get('t');
    	}
    	
    if(ApexPages.currentPage().getParameters().get('p') != null) {
      renderMode = 'pdf';
    } else {
      renderMode = null;
    }
  }

  public pageReference setActiveCase() {
    activeCase = new Case();
    this.activeCase = [select id from Case where id = :caseID];
    return null;
  }

  public pageReference savePDF() { 
    pageReference thePage = Page.customStuff;
    thePage.getParameters().put('p','pdf');
    thePage.getParameters().put('t',Template);
    thePage.getParameters().put('id',CaseID);
    
    blob body = thePage.getContent();
    
    attachment pdf = new attachment();
    pdf.filename='my filename';
    pdf.body = body;
    pdf.ParentId = activeCase.id;
    pdf.isPrivate = false;
    
  }

  public list<selectOption> getTemplates() {
    list<selectOption> theTemplates = new list<selectOption>();
    theTemplates.add(new selectOption('', '--None--'));
    theTemplates.add(new selectOption('1', 'Item 1'));
    theTemplates.add(new selectOption('2', 'Item 2'));
    theTemplates.add(new selectOption('3', 'Item 3'));
    theTemplates.add(new selectOption('4', 'Item 4'));
    return theTemplates;
  }

}

 

 

My issue is that calling the page in the savePDF method seems to ignore the added parmeters, but only in certain instances. For example, the standard header and styles are removed, but the pageBlock is still rendered. And the page doesn't render as a pdf, even though it has received a parameter instructing it to.

 

This boggles the mind, but I'm hoping there's something simple I'm missing.

 

Thanks in advance!!

 

-Mike

  • January 13, 2011
  • Like
  • 0

Hi,

 

I need to have a  picklist with values for example: ( Template 1, Template 2, Template 3 ) Anytime time this pick list's selection is changed I need to place different text value in a text field corresponding to a custom field.

 

I tried with an s-control and some javascript, however I was wondering if anyone managed to do this with a visual force code?

I have chatter enabled and running so I assume I'm running the Summer 2010 release, but when I try to create a Set of SObjects I get the error "Set of SObject: Account not allowed."

 

I used the example code from the salesforce_summer10_release_notes.pdf on page 115:

 

Account a1 = new Account(name='MyAccount');

Set<Account> accountSet = new Set<Account>{a1};

 

I did upgrade the Eclipse IDE but I'm guessing I'm not actually using the latest release because when I try to create a new Apex class I can only select version 16.

 

Thanks in advance for any help.

  • June 29, 2010
  • Like
  • 0

I  am using a visual force page to replace a related list with the code below.

When the New Team Contact is clicked I want it to prefil the related ID field from the link.

 

Is this possible and if so can someone help me create this.

<apex:page standardcontroller="ADP__c" showHeader="false">


<apex:relatedList list="ADP_Account_Team__r" title="" />


    <apex:pageBlock mode="edit">
    
      <apex:outputLink target="_top" value="{!URLFOR($Action.ADP_Account_Team__c.New)}" style="font-weight: bold;">New Team Contact</apex:outputLink>

        <apex:pageBlockTable value="{!ADP__c.ADP_Account_Team__r}" var="thisService">
        
  <apex:column >
            <apex:outputLink value="{!URLFOR($Action.ADP_Account_Team__c.Edit,thisService.id)}" style="font-weight: bold;">Edit</apex:outputLink> |&nbsp; 
             <apex:outputLink value="{!URLFOR($Action.ADP_Account_Team__c.Delete,thisService.id,[retURL=URLFOR($Action.ADP__c.View, ADP__c.Id)])}" onclick="return window.confirm('Are you sure?');" style="font-weight: bold;">Del</apex:outputLink>
        </apex:column>
        
            <apex:column value="{!thisService.Role__c}"/>
            <apex:column value="{!thisService.User__c}"/>
            <apex:column value="{!thisService.Telephone__c}"/>
            <apex:column value="{!thisService.Email__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>

</apex:page>

 

 

  • May 04, 2010
  • Like
  • 0

How can I test a pagereference method such as below:

 

 

public class childContact {
    
    private List<Contact> cntz;
    private Account acct; 

    public childContact(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public Account getAt()
    {
        Account[] at = [Select id,name FROM Account where id= :acct.id];
        if(at.size()>0){
    		return at[0];
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Contact> getCntz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        cntz = [Select id, Name, Client_Potential__c, title, Address_City__c, Direct_Phone__c, Email, Open_Projects__c, Days_Since_Last_Contact__c, Account.name, Ownerid from Contact where (account.parentid = :act.id OR account.id = :act.id)];
    	return cntz;
    }

    public PageReference UpdateRecords() {
        // this simple line of code finds out which column was changed and update the 
        // relevant account record accordingly!
        update cntz;
        return null;
      }


}

 

The Visual Force pageBlockButton using the pagereference method looks like this:

 

  <apex:pageBlockButtons location="top">
    <apex:commandButton value="Update" action="{!UpdateRecords}" id="theButton" rerender="page" status="status" onComplete="window.location.reload()"></apex:commandButton>
  </apex:pageBlockButtons>   

Any help is much appreciated - thanks!

I have a visualforce page with both actionSupport and some JavaScript interacting with an actionFunction.  The controller for the page is a standard controller (custom object) with one extension.  The goal of both the actionSupport and actionFunction is simply to rerender parts of the page.

 

The funny part is that the rerendering pieces will only work if the user has populated the name field... or if the URL had an Id in it, which means the record loaded in the standard controller already had a name.  Either way, the fancy rerenders simply don't happen unless the record the page is working with has a name.  I'm sure that behind the scenes there is a logical explanation... but I am baffled.

 

To recreate the scenario I will paste below a very simple page, class combo that uses the standard account controller.  Once you have created these in your org, navigate to the page and WITHOUT entering a name, change the "Industry" field a few times... nothing will happen.  Then go and give it a name, then change the Industry field again... magically, the rerender begins to work.  Any ideas?

 

Page:

 

<apex:page standardController="account" extensions="testWeirdBugExtension">
    <apex:form>
        <apex:pageBlock>
        
            <apex:pageBlockSection>
                <apex:inputField value="{!theRecord.Name}"/>
                <apex:pageblockSectionItem>
                    <apex:outputLabel>Industry</apex:outputLabel>
                    <apex:selectList value="{!theRecord.Industry}" multiselect="false" size="1">
                        <apex:selectOption itemValue="Retail" itemLabel="Retail"/>
                        <apex:selectOption itemValue="Manufacturing" itemLabel="Manufacturing"/>
                        <apex:actionSupport event="onchange" reRender="showOff"/>
                    </apex:selectList>
                </apex:pageblockSectionItem>
            </apex:pageBlockSection>
            
            <apex:outputPanel id="showOff">
                {!theRecord.Industry}
            </apex:outputPanel>

        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

Extension class:

 

public class testWeirdBugExtension {

    public Account theRecord {get;set;}

    public testWeirdBugExtension(ApexPages.StandardController controller) {
        theRecord = (account)controller.getRecord();
    }
}

 

 

So, I am trying to start recycling my visual force pages/controllers by passing values in the URL string to determine some of the basic info in my cases instead of having individual pages/controllers for each circumstance.  I have my javascript that reads the URL and I have my controller making the changes on the back end for each circumstance, now I have to connect the two but I am having a bit of a difficult time... any suggestions?

 

VF Javascript Code

 

<SCRIPT LANGUAGE="JavaScript"> var GETDATA = new Array(); var sGet = window.location.search; if (sGet) { sGet = sGet.substr(1); var sNVPairs = sGet.split("&"); for (var i = 0; i < sNVPairs.length; i++) { var sNV = sNVPairs[i].split("="); var sName = sNV[0]; var sValue = sNV[1]; GETDATA[sName] = sValue; } } if (GETDATA["PageConfigName"] != undefined){{!PageConfigName} = GETDATA["PageConfigName"];} </SCRIPT>

 

 

Apex Controller getter/setter code (not complicated lol)

 

 

public String PageConfigName{set;get;}

 

Thanks for your help in advance!!

Hello. I'm creating a VF page and incorporating a PickList Field from a Custom Object.  I've set the Validation Rule to ensure that the field isn't empty but that only works from within Salesforce. 

 

I need to ensure a value is selected from the PickList when an end user is entering a record through the VisualForce page.

 

FYI: Text fields that are marked as Required DO spawn the appropriate Error Msg if they are left blank.

Message Edited by kenzo on 02-09-2010 03:57 PM
  • February 09, 2010
  • Like
  • 0

Hi,

 

I have created some batch apex code alongwith other triggers and class/controller codes. 

 

When I run individual test methods on them, I am able to get test success result alongwith nice code coverage %. However when I run all tests together, I get following test failure errors:-

 

1)System.AsyncException: Database.executeBatch cannot be called from a batch or future method.

2)System.AsyncException: Future method cannot be called from a future method: changeOwners(String, String)

3)System.AsyncException: Future method cannot be called from a future method: getLead_Rollup_Amount(Id)

4)System.AsyncException: Future method cannot be called from a future method: changeOwners(String, String)

 

Please note again that the exceptions dont come when tested individually.

 

Please advise on same.

 

 

Thanks,

 

Vimal 

Hey - Newbie Q:  I found postings from '07 indicating SFDC doesn't support Radio Buttons, but instead allows for PickList functionality only in Custom Objects.

 

Just want to verify that this is still the case.

 

I found code for creating Radio Buttons on a page, but I'm assuming there is no way to connect the User's selection to a Custom Field in a Custom Object.  Correct?

 

Trying to avoid the visual design of many, many drop-down boxes.

 

Any status updates will be appreciated.  Thanks.

  • November 03, 2009
  • Like
  • 0

Can someone please let me know the easiest way to make an apex class available in production mode??

 

Is Eclipse the only way or can I also do it from the online user interface?

I'm trying to disable a commandButton on my VF page on click because I'm invoking a possibly long running action in my controller (10 seconds or more), and I wish to prevent the user from clicking the button again, and double submitting. I tried doing this using a simple javascript onclick function that disables the button and returns true. This doesn't work because once I disable the button in javascript, the action method doesn't get invoked in my controller. Any other suggestions?

  • October 29, 2009
  • Like
  • 0

I could use some help here. You'll notice in the code below that I have hardcoded int the Contact rt query the Id. I want the query to be run with a dynamic Id. I have tried everything especially =:ContactId or even the long version =:o.ContactId__c. The update that sets o.Registered_Member__c = ContactId is working so I know the variable is being populated. I am new to Eclipse and it won't let me do the above variable queries.

 

The Trigger looks like this:

 

trigger UpdateMember on Opportunity (before insert) { for(Opportunity o:Trigger.new)

{

String ContactId=o.ContactId__c;

String Member=o.Registered_Member__c;

String RegisteredId=o.Registered_UserId__c;

if(ContactId!='' && o.Registered_Member__c==null)

{

o.Registered_Member__c = ContactId;

Contact rt = [select Id, FirstName from Contact where Id='0038000000lqpyL' limit 1];

String FirstName=rt.FirstName;

o.Registered_Member_First__c = FirstName;

}

if(RegisteredId!='' && o.Registering_Contact__c==null)

{

o.Registering_Contact__c = RegisteredId;

}

}

}

 

Thanks.

Hi.

 

I've already lerned how to create a button with Visualforce. Now i want to execute Apex-Code with a button. How i do this?
  • October 13, 2009
  • Like
  • 0

I would like to highlight or color either the cell or the entire row when a user clicks on a commandLink in a table. I'm currently using a VF pageBlockTable but want somehow for the user's selection to persist on screen while another part of the screen is redrawn. Also if the user clicks on a different row then the original cell/row should revert to the default color and the newly clicked cell/row should be changed.

 

 

Does anyone have any code snippets / suggestions ?

Hi,

 

I want to build custom page that has a link "del and Edit" like what we have in standerd detail list section of any objects like lead.

 

If Del link is clicked than i want one confirmation dialog box and after saying yes then records should be deleted.

 

I unable to create java script dialog box can some one any IDEA..:)

 

Thanks all,

Deepak 

Hi,

 

Can I make use of merge fields (access merge fields) within a Javascript funtion which is present in a visualforce page? 

 

Thanks.

Is there a easy way to show pop up from a visual force page, without linking it to another visual force page.

I want to show some information .

 

I have seen example of yahoo model dialogue box.

 

I am in process of creating  a 100% native application, I do nt want to call to any external js libraries.

 

 

Setup some debug logs for a user ad then load a Visualforce page in the new Lightning UI. No debug logs are created.

Is this a known issue? Are there any workarounds?
  • August 28, 2015
  • Like
  • 0
As soon as we try to view a managed package by selecting its name in the list of packages we are gettting an internal server error.

Error ID: 985527738-145562 (1773998380)

Can anyone from Salesforce.com shed some light on this. Not being able to access this page means we can do push upgrades, create patch orgs, and more. Sort of a big show stopper for an ISV. 

Thanks,
Jason
  • March 20, 2015
  • Like
  • 0
We have a managed packaged that has an install script. Sometime within the last week queries agains the AsyncApexJob inside the install script started throwing the following error:

System.QueryException
sObject type 'AsyncApexJob' is not supported.

I guarantee this used to work. Anyone from salesforce know of a change that could have broken this?

HTML5 Geolocation does not work well on the Android version of Salesforce1. The Salesforce1 app permission for location accuracy is "approximate location":

 

 

This is not using the device GPS! This means all webviews (publisher actions & visualforce pages) inside the app are not able to get an accurate GPS location from the phone when using the HTML5 geolocaiton functionality as it inherits permissions from the parent app. User location can be off by half a mile or more!

 

I would consider this a major issue for a mobile application and I hope salesforce.com can put out a patch quickly.

 

Partner Portal Case #: 10004101

  • December 12, 2013
  • Like
  • 0

I hate to double post but I think I've found a gap in salesforce.com functionality to build scalable URL Buttons that can be packaged across all Editions.

 

Here is the thread in question, http://boards.developerforce.com/t5/Visualforce-Development/Communties-Sites-make-it-URL-buttons-not-work/td-p/697949 , and any insight you may have into this would be appreciated.

 

Thanks,

Jason 

  • October 30, 2013
  • Like
  • 0

It would appear if a customer is using Communities or force.com sites there is no way to build scalable custom object URL buttons that work everywhere.

 

Let's say on the Account object you have a custom URL button that opens a Visualforce page with the following text:

 

/apex/findNearby?id={!Account.Id}

In this example we can't make the Content Source of the button Visualforce as this findNearby.page does not use a standard controller or extension.

 

For a normal user inside salesforce.com this works fine but let's say an org has a Community named 'customers'. This is were things start to break. That link should then redirect to:

 

/customers/apex/findNearby?id={!Account.Id}

 

So you might be thinking, no problem, just use the $Site global variable and do the following in the URL button:

 

{!URLFOR($Site.Prefix+'/apex/findNearby?id='+Account.Id)}.

This would normally work but here is the final caveat...this is part of a managed packaged that needs to support Group and Professional editions and in these editions the $Site var does not exists.

 

Unless I am missing something this seems to be a gap in functionality for creating URL button links with Communities.

 

Is there anyway, within a button to detect the correct url or salesforce version and build the appropriate URL?

 

Thanks,

Jason

  • October 30, 2013
  • Like
  • 0

We are buiding a system that will automatically provision License Seats when a customer purchases our product from our custom store front. All of this logic is in Apex and we are trying to write tests to ensure this works correclty but it seems this may not be possible.

 

In its simplest form the test would pefrom the following:

- Create a License

- Update the Seats__c field on the license

- Assert Seat__c field was updated correctly

 

Seem simple but it doesn not appear to work as this is the error received when trying to accomplish this: 

Update failed. First exception on row 0 with id a07e0000000ySK2AAM; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []

 

Below is the code to reproduce:

 

//Create account license can be attached to
Account acct = new Account(Name = 'test');
insert acct;

//Create package
sfLma__Package__c pack = new sfLma__Package__c(
	Name = 'test',
	sfLma__Developer_Name__c = 'test',
	sfLma__Developer_Org_ID__c = 'abc',
	sfLma__Latest_Version__c = '3',
	sfLma__Lead_Manager__c = UserInfo.getUserId(),
	sfLma__Package_ID__c = '3',
	sfLma__Release_Date__c = system.today().addDays(-30)
);
insert pack;

//Create a package version
sfLma__Package_Version__c packVersion = new sfLma__Package_Version__c(
	Name = 'test',
	sfLma__Package__c = pack.id,
	sfLma__Is_Beta__c = false,
	sfLma__Release_Date__c = system.today(),
	sfLma__Sequence__c = 1,
	sfLma__Version__c = '3',
	sfLma__Version_ID__c = '3'
);
insert packVersion;

//Ceate a license record
Id recordTypeId = [select Id from RecordType where Name = 'Active' and SobjectType = 'sfLma__License__c'].Id;
sfLma__License__c lic = new sfLma__License__c(
    RecordTypeId = recordTypeId,
    sfLma__Status__c = 'Active',
    sfLma__Seats__c = 1,
    sfLma__License_Type__c = 'Editable',
    sfLma__Account__c = acct.Id,
    sfLma__Expiration__c = system.today().addDays(365),
    sfLma__Install_Date__c = system.today(),
    sfLma__Package_Version__c = packVersion.Id
);
insert lic;

//Update the Seats field on the license
lic.sfLma__Seats__c = 5;

//UPDATE FAILS
update lic;

 

Any ideas?

 

Thanks,

Jason

  • September 16, 2013
  • Like
  • 0

I'm writing some tests that insert and update an LMA license record but my updates are failing with the following error:

 

Update failed. First exception on row 0 with id a07e0000000ySK2AAM; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []

 

Below is the code to reproduce:

 

sfLma__License__c lic = new sfLma__License__c(
sfLma__Status__c = 'Active',
sfLma__Seats__c = 0
); insert lic; lic.sfLma__Seats__c = 5; update lic;

 

This looks to be coming from inside the LMA app and I am probaby not setting the the correct "required" fields on the License record. Anyone know what the minimun required fields are to peform an update DML on the License record?

  • September 16, 2013
  • Like
  • 0

It would appear there is a bug with the Winter 14 release and visualforce pageBlockSectionItem. Below is the markup to reproduce:

 

<apex:page">

	<apex:pageBlock>
		<apex:pageBlockSection >
			<apex:pageBlockSectionItem>
				<apex:outputPanel >
					Choose whether to define the fields for this Map Object or whether to refer to another object 
					already configured. (e.g. for Opportunities, you may want to refer to the Account object). Referring to 
					another object means this object need not be geocoded and will use the referring object's information.
				</apex:outputPanel>
				<apex:outputPanel >
					hi
				</apex:outputPanel>
			</apex:pageBlockSectionItem>
		</apex:pageBlockSection>				
	</apex:pageBlock>
	
</apex:page>

In Summer 13 it looked like this, correct:

 

 

In Winter 14 it looks like this:

  • September 12, 2013
  • Like
  • 0

We are seeing this issue in our managed packaged in Sandboxes that have been updated to Winter 14.

 

"The configuration of your org has changed, please reload the page. Missing dependent object: Field: Account.SicDesc"
 
We are catching this error and displaying the message but we are having a very hard time locating the source as even the Debug logs are not showing any exception occuring, caught or not.
 
Any ideas?

 

 

  • September 10, 2013
  • Like
  • 0

Is there a way to systematically check to see if the Chat Widget will be present in a Visualforce page?

 

I say "will be" present as the html elements are not present on load so you can't check to see if these elements exists on page load. Is there any JavaScript variable or salesforce.com provided method/merge field to determine if Chat is turned on?

 

Based on if this is present or not we need to modify our CSS so this widget doesn't cover our apps functionality.

 

Thanks,

Jason

When running a report and if Account Teams are enabled you have an option to search "My Account Team and My Accounts". This returns accounts in which you are listed on the sales team or you are the account owner. Belwo is the SOQL and error I am recieving:

 

List<Account> acc = [SELECT Id FROM account WHERE Id IN (SELECT accountId FROM accountteammember WHERE UserId = :UserInfo.getUserId()) OR ownerid = :UserInfo.getUserId()];

 Error: Semi join sub-selects are not allowed with the 'OR' operator

 

Is this a dead end? Any ideas how this could be accomplished with SOQL....or maybe even without SOQL.

 

Thanks,

Jason

 

The salesforce.com docs states remoting methods can take the following values as arugments, "primitives, collections, typed and generic sObjects, and user-defined Apex classes...". There appears to be an issue with generic sObject. Take a look at the following Visualforce page and the related remoting method.

 

<apex:page showHeader="true" sidebar="true" controller="RemotingSObject">
	<input value="Click Me" onclick="doRemote();" type="button"/>

	<script type="text/javascript">
		
		function doRemote(){
			var obj = {
				sobjectType: 'Account',
				Name: 'My new account'
			};

			//You can see there is a value of sbojectType set
			console.log(obj);

			Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemotingSObject.receiveSObject}', obj, function(result, event){
		        console.log(event);
		        console.log(result);
			});
		}

	</script>
</apex:page>

 The Class:

public with sharing class RemotingSObject {
	@RemoteAction
	public static void receiveSObject(SObject obj) {
		system.debug(obj); 
	}
}

 If you look in the browsers JavaScript console you will see this error message:

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

 

Makes no sense as an sobjectType value is being supplied. Oddly enough if you provide an id value it works...but if you are trying to insert a new sObject you do not yet have an id value to use.

 

Any ideas on how to make this work? Bug?

 

Thanks,

Jason

 

  • February 05, 2013
  • Like
  • 1

F5 Networks, a high tech company in Seattle is looking for a Salesforce.com Solution Developer that can own all aspects of salesforce.com and force.com development.

 

You can check out the official posting here: 

https://www.recruitingcenter.net/Clients/f5/PublicJobs/controller.cfm?jbaction=JobProfile&job_id=15324

 

Benefits are pretty good too. http://www.f5.com/about/careers/benefits/

 

  • December 18, 2012
  • Like
  • 0

On the appexchange I choose to recieve a Lead when a user clicks the Get It Now button and I also recieve a lead from LMA once the package is installed successfully.

 

I have noticed the information on these two types of Leads can vary greatly. Data will be different or missing. Does anyone know why and is there anything that can be done to ensure the data is the same. I am reciving both leads and merging simply to ensure I get all the data I can but ideally I'd only recieve on lead with all of the data

 

Thanks,

Jason

  • September 23, 2012
  • Like
  • 0

I have a simple managed package application that has a tab with a custom style and logo. The logo for a custom tab style is stored in a document folder. The issue with this is that once this package is installed a user could delete or change your logo. 

 

What is the best way to prevent this?

 

Thanks,

Jason

  • September 06, 2012
  • Like
  • 0

If you have a required selectList on a visualforce page with IE9 you are not going to have a good time. It would appear that with this combination all sorts of data binding issues are occuring and values entered into other fields are being wiped out. The good news is this is very easy to reproduce. All you need is the page below:

 

<apex:page standardController="Account" showHeader="false">
    <apex:form >
        <apex:outputPanel id="formSection">
            
		Enter something: <apex:inputField value="{!Account.Name}" required="true"/><br/>
		
		Don't select anything:  <br/> 
		<apex:selectList value="{!Account.BillingState}" id="state" required="true" size="1">
			<apex:selectOption itemvalue="" itemLabel="--None--"/>
			<apex:selectOption itemvalue="N/A" itemLabel="N/A"/>       		
		</apex:selectList>
		<apex:message styleClass="customError" for="state"/><br/><br/>

		Click this twice, the second time the value entered in the Account.Name will be wiped out.<br/>
           	<apex:commandButton value="Submit" action="{!save}" status="disableSave" rerender="formSection"/> 
            
        </apex:outputPanel>
    </apex:form>
</apex:page>

Open up IE9. I know this may be hard for you but you can do it. Enter a value in the name field, leave the pick list blank. Click Submit button. A nice little message will show up telling you the picklist field is blank. It may be tempting to fill this in but do not! Ignore it! Press the Submit button again. You will notice the value entered in the name field is wiped out, not good.

 

Any ideas as to a fix? If you figure this one out you have two ice cold beers from me waiting for you at Dreamforce but I have a  feeling this is a bug only salesforce.com can fix.

 

Oh, and forcing the page to run in some IE8/7 compatibilty mode isn't an option, sorry. The reason being is the actual page is iframed into a large corporate website and it is not possible to force the parent frame to run in compatibilty mode. Something that is required as compatibilty mode is inherited from the parent page with IE9.

 

-Jason

During a batch apex job I have noticed the number of Total Batches is changing, lowering. It starts high and then as the job progresses the number starts to lower. It would also appear that the batch apex job is missing some of the records that should have been originally queried and are never being processed by the batch apex class.

 

Here are some images showing the drop as the batch job progresses:

1670 Total Batches

 

1623 Total Batches

 

1527 Total Batches after complete

 

The difference is 143 batches or 29,000 records which is exactly how many records are not being processed.

 

This is bizarre. Any ideas?

 

Thanks,

Jason

I'm looking into the option of building a public facing REST based API on force.com but there is one issue about this that sticks out. Unlike public Visualforce pages, in which you can provide a custom URL (sort of, SSL is still not fully branded) there is no way to setup custom URLs for Apex REST or SOAP services. This includes logging in and invoking actions.

 

Even if we could brand these Apex Web Services we would still have the SSL issue. If salesforce.com wants force.com to become a real option for buidling services on it this issue needs to be addressed.

 

In the mean time is anyone familiar with work arounds? A proxy server perhaps that simply redirects requests to salesforce.com? I have no idea if this would work, just throwing out ideas.

 

Thanks,

Jason

I have an apex component in which the constructor in the controller is exectuting twice. I have made all the pages and classes as simple as possible to reproduce and this is what we have:

 

The Page

<apex:page >	
    <c:myComponent />
</apex:page>

 

The Component

<apex:component controller="MyController" >
    <apex:form >
        <apex:actionFunction name="thisIsMyName" action="{!doSomething}"  />	
    </apex:form>
</apex:component>

 

The Controller

public class MyController {
	
    //Constructor
    public MyController(){
        system.debug('I am a constructor and I am executing multiple times to drive you crazy.');
    }
    
    public void doSomething(){
    	//Blah blah blah
    }

}

 

The Debug Log

23.0 APEX_CODE,DEBUG
18:56:46.028 (28871000)|EXECUTION_STARTED
18:56:46.028 (28903000)|CODE_UNIT_STARTED|[EXTERNAL]|066500000008tEE|VF: /apex/mypage
18:56:46.039 (39198000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.039 (39850000)|METHOD_ENTRY|[1]|01p50000000DYoB|MyController.MyController()
18:56:46.039 (39939000)|METHOD_EXIT|[1]|MyController
18:56:46.041 (41245000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41308000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.041 (41830000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.041 (41872000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41894000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.071 (71248000)|CODE_UNIT_FINISHED|VF: /apex/mypage
18:56:46.071 (71263000)|EXECUTION_FINISHED

Any ideas why this is happening. It is making me go a little crazy.

 

If I move everything that is in the component directly to the page it will only execute once, as expected, but I need use components.

 

Thanks,

Jason

  • April 29, 2012
  • Like
  • 1

The salesforce.com docs states remoting methods can take the following values as arugments, "primitives, collections, typed and generic sObjects, and user-defined Apex classes...". There appears to be an issue with generic sObject. Take a look at the following Visualforce page and the related remoting method.

 

<apex:page showHeader="true" sidebar="true" controller="RemotingSObject">
	<input value="Click Me" onclick="doRemote();" type="button"/>

	<script type="text/javascript">
		
		function doRemote(){
			var obj = {
				sobjectType: 'Account',
				Name: 'My new account'
			};

			//You can see there is a value of sbojectType set
			console.log(obj);

			Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.RemotingSObject.receiveSObject}', obj, function(result, event){
		        console.log(event);
		        console.log(result);
			});
		}

	</script>
</apex:page>

 The Class:

public with sharing class RemotingSObject {
	@RemoteAction
	public static void receiveSObject(SObject obj) {
		system.debug(obj); 
	}
}

 If you look in the browsers JavaScript console you will see this error message:

Visualforce Remoting Exception: Unable to determine SObject type: SObject. Please provide an 'id' or 'sobjectType' value.

 

Makes no sense as an sobjectType value is being supplied. Oddly enough if you provide an id value it works...but if you are trying to insert a new sObject you do not yet have an id value to use.

 

Any ideas on how to make this work? Bug?

 

Thanks,

Jason

 

  • February 05, 2013
  • Like
  • 1

During a batch apex job I have noticed the number of Total Batches is changing, lowering. It starts high and then as the job progresses the number starts to lower. It would also appear that the batch apex job is missing some of the records that should have been originally queried and are never being processed by the batch apex class.

 

Here are some images showing the drop as the batch job progresses:

1670 Total Batches

 

1623 Total Batches

 

1527 Total Batches after complete

 

The difference is 143 batches or 29,000 records which is exactly how many records are not being processed.

 

This is bizarre. Any ideas?

 

Thanks,

Jason

I have an apex component in which the constructor in the controller is exectuting twice. I have made all the pages and classes as simple as possible to reproduce and this is what we have:

 

The Page

<apex:page >	
    <c:myComponent />
</apex:page>

 

The Component

<apex:component controller="MyController" >
    <apex:form >
        <apex:actionFunction name="thisIsMyName" action="{!doSomething}"  />	
    </apex:form>
</apex:component>

 

The Controller

public class MyController {
	
    //Constructor
    public MyController(){
        system.debug('I am a constructor and I am executing multiple times to drive you crazy.');
    }
    
    public void doSomething(){
    	//Blah blah blah
    }

}

 

The Debug Log

23.0 APEX_CODE,DEBUG
18:56:46.028 (28871000)|EXECUTION_STARTED
18:56:46.028 (28903000)|CODE_UNIT_STARTED|[EXTERNAL]|066500000008tEE|VF: /apex/mypage
18:56:46.039 (39198000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.039 (39850000)|METHOD_ENTRY|[1]|01p50000000DYoB|MyController.MyController()
18:56:46.039 (39939000)|METHOD_EXIT|[1]|MyController
18:56:46.041 (41245000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41308000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.041 (41830000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000DYoB|MyController <init>
18:56:46.041 (41872000)|USER_DEBUG|[5]|DEBUG|I am a constructor and I am executing multiple times to drive you crazy.
18:56:46.041 (41894000)|CODE_UNIT_FINISHED|MyController <init>
18:56:46.071 (71248000)|CODE_UNIT_FINISHED|VF: /apex/mypage
18:56:46.071 (71263000)|EXECUTION_FINISHED

Any ideas why this is happening. It is making me go a little crazy.

 

If I move everything that is in the component directly to the page it will only execute once, as expected, but I need use components.

 

Thanks,

Jason

  • April 29, 2012
  • Like
  • 1

I have a huge visualforce controller. The page it controls It has grown beyond what I ever imagined in terms of scope and features. Due to the massive amount of features and requirements I have hit the 100K character class limit. I think I can address this limit with class inheritance but please confirm I am doing this correctly.

 

"Parent" class. In this class I could store all variables, wrapper classes, and methods that are invoked from the constructor on initial page load

 

public virtual class Parent{

    public String input {get; set;}

    public Parent(){
        //Do initializations required on page load in this contructor, not child constructor.
        init();
    }
    
    public void init(){
        system.debug('Power up systems for launch!');
    }

    public void doSomethingParent(){
        system.debug('hi from parent');
    }
    
    public class wrapperClass{
        public String Name {get; set;}
    }
}

 

 

Child class that extends parent. Would contain mostly action methods called from page.

 

public class Child extends Parent{

    public void doSomethingChild(){
        system.debug('hi from child');
        doSomethingParent();
        WrapperClass test = new WrapperClass();
    }
}

 And the page which sets the controller as the "child" class. This way it can call methods in both classes.

 

<apex:page controller="Child" >
    <apex:form >
        <apex:commandButton value="Parent" action="{!doSomethingParent}"/>
        <apex:commandButton value="Child" action="{!doSomethingChild}"/>
    </apex:form>
</apex:page>

 

 

Does everything look good here. Am I following best practices?

 

Thanks,

Jason

 

Keyword: script too large

 

  • April 30, 2010
  • Like
  • 1

So I just burned a couple of hours trying to figure out what was breaking in my code. I figured it out but I still don't understand what is happening. You can paste the code below into the system log and execute.

 

 

Boolean someNullBoolean;
Contact c = new Contact(LastName = 'lname');
c.HasOptedOutOfEmail = someNullBoolean;
//c.HasOptedOutOfEmail should be null as it was contructed as null and we are also assigning the value of null, right? WRONG!

system.debug(c);
//cool, the value of HasOptedOutOfEmail is displaying as null, that makes sense
system.debug('HasOptedOutOfEmail; ' + c.HasOptedOutOfEmail);
//wait, what?!? HasOptedOutOfEmail is now false? I thought we set it to null

//eh, none of this should matter right? let's try to insert this contact
insert c;

//aw snap,
//System.DmlException: Insert failed. First exception on row 0; first error: INVALID_TYPE_ON_FIELD_IN_RECORD, Email Opt Out: value not of required type: {0}: [HasOptedOutOfEmail]

Is this a bug, some expected behvior with booleans I don't understand, or am I in the matrix?

 

Thanks,

Jason

 

 

Message Edited by TehNrd on 08-18-2009 03:47 PM
  • August 18, 2009
  • Like
  • 1

When rendering a page as a PDF the filename of the PDF is the name of the page which is not a good thing. The problem with this is that the name is not unique and can cause confusion with the user.

 

I'm working on a quoting app that renders a quote as a PDF. Some broswers open the PDF embed, others automatically launch your PDF reader, and some prompt you to save or open. The problem is that if opened or saved theses files are all saved as qoute.pdf, qoute[1].pdf, quote[2].pdf, quote[3].pdf. The problem should be obvious.

 

Ideally you should be able to define the name of the generated PDF but I haven't figured out how to do this.

 

Thanks,

Jason

  • February 25, 2009
  • Like
  • 1
There were a few times I thought I may have been literally losing my mind trying to isolate this issue but I was finally able to nail down the steps to reproduce (and solution). Sometimes the param value is not being assign to the variable in the controller.

Here is the code to reproduce. I tried to make it as short as possible but sorry it is still a little long, see steps below code:
Code:
Page:

<apex:page controller="paramBug" > <apex:form > <apex:pageBlock > <apex:outputPanel id="table"> {!showTable} <apex:pageBlockTable value="{!opps}" var="o" rendered="{!showTable}"> <apex:column headerValue="Status"> <apex:outputPanel id="oppStatus"> <apex:outputText value="Y" rendered="{!IF(o.status = 'modified', true, false)}"/> </apex:outputPanel> </apex:column> <apex:column value="{!o.opp.Name}"/> <apex:column > <apex:facet name="header"> <apex:commandLink value="Stage" rerender="table,debug" action="{!sortTable}" status="sorting"> <apex:param value="StageName" assignTo="{!sortColumn}" /> </apex:commandLink> </apex:facet> <apex:inputField value="{!o.opp.StageName}"> <apex:actionSupport event="onchange" action="{!change}" rerender="oppStatus,buttons"> <apex:param name="oid" value="{!o.opp.id}" assignTo="{!changedOpp}" /> </apex:actionSupport> </apex:inputField> </apex:column> </apex:pageBlockTable> </apex:outputPanel> </apex:pageBlock> </apex:form> </apex:page>

Controller:

public class paramBug {

List<oppWrapper> opps = new List<oppWrapper>();
List<SelectOption> stages;
public ID changedOpp {get; set;}
public string sortColumn {get; set;}
Map<String,String> sortOrder = new Map<String,String>();

//Constructor
public paramBug(){
for(Opportunity opp : [select Id, Name, StageName from Opportunity limit 10]){
opps.add(new oppWrapper(opp));
}
}

public List<oppWrapper> getOpps(){
return opps;
}

public void change(){
for(oppWrapper o : getOpps()){
if(o.opp.Id == changedOpp){
o.status = 'modified';
}
}
}

public Boolean getShowTable(){
Boolean show = true;
if(opps.size() == 0 ){
show = false;
}
return show;
}

public void sortTable(){
transient List<oppWrapper> sortedOpps = new List<oppWrapper>();
transient Map<String, List<oppWrapper>> stringMap = new Map<String, List<oppWrapper>>();

system.debug('--------------This is the debug line to watch--------------------');
system.debug('sColumn: ' + sortColumn);

if(sortColumn == 'StageName'){
for(oppWrapper o : getOpps()){
Object oField = o.opp.get(sortColumn);
String fieldValue = (String)oField;

if(stringMap.get(fieldValue) == null) {
stringMap.put(fieldValue, new List<oppWrapper>());
}
stringMap.get(fieldValue).add(o);
}

transient List<String> keys = new List<String>(stringMap.keySet());
keys.sort();

for(String key:keys){
sortedOpps.addAll(stringMap.get(key));
}

//reverse order
if(sortOrder.get(sortColumn) == 'asc'){
sortedOpps.clear();
for(Integer i = (keys.size()-1);i >= 0; i--) {
sortedOpps.addAll(stringMap.get(keys.get(i)));
}
}

if(sortOrder.get(sortColumn) == 'asc'){
sortOrder.put(sortColumn,'desc');
}else{
sortOrder.put(sortColumn,'asc');
}

}
system.debug('sortedOpps: ' + sortedOpps);
system.debug('Opps: ' + Opps);
opps = sortedOpps;
}

public class oppWrapper{

public Opportunity opp {get; set;}
public String status {get; set;}

//Contructor
public oppWrapper(Opportunity opp){
this.opp = opp;
}
}
}

First let's show it working correctly:
1) Open up this page and open the System Log.
2) Click the Stage Name header. This passes a param to the variable "sortColumn" in the controller and calls the action method sortTable().
3) Monitoring the debug log you can see that this is correctly being passed over: line 41, column 9: sColumn: StageName

Now let's show it not working:
1) Reload the page.
2) Change the Stage of the first opp in the table. This runs the change() method in the controller and rerenders the contents of the Status column. A 'Y' should appear in the row of the edited opp.
3) Click the Stage header to sort. The table will disappear because the sort logic did not execute. If you look at the system log you can see that the param was not passed to the controller and sortColumn is null: line 41, column 9: sColumn: null

Now the fix. I don't know why or how this fixes it but it does. Simply adding the name attribute to the param component does the trick. It doesn't even matter what the name is, just as long as it is there:

Code:
Change this:
<apex:param value="StageName" assignTo="{!sortColumn}" />

to this:
<apex:param name="asdfasd" value="StageName" assignTo="{!sortColumn}" />

and it works.

So there you go. I'm pretty sure this is a bug but if it's not I'll modify the title.

-Jason




Message Edited by TehNrd on 01-16-2009 12:04 PM
  • January 16, 2009
  • Like
  • 1
First a little background. Our company already has a website that is managed the old fashion way by our IT department. It is massive, complicated, and there is no way on earth we (I am in a separate group from IT) could convince them to convert to Force.com sites. The website has the two typical navigation bars, one along the top and one on the left. So a much more realistic possibility is using an iframe to embed a force.com site/web app within our site.

Here lies the problem. For an iframe that does not need to navigate anywhere we are good, but based on the use case and logic we may want to redirect the users to different pages. I was hoping that in the the page controller, based on the logic, I could set a string which is a URL and then on the completion of this action method call a javascript method. When doing this it appears that the oncomplete attribute of the action method is actually called before all of the variables are set in the controller.

Here is an example:

Code:
Page:

<apex:page controller="iframe">
    <apex:form id="form">
        <apex:inputText value="{!one}"/> + <apex:inputText value="{!two}"/> = 8 <br/>
        <apex:commandButton value="Validate" action="{!submit}" rerender="form" oncomplete="done();"/>
        
        <script type="text/javascript">
            function done(){
                var result = '{!result}';
                alert(result);
                <!-- here I could use window.top.location.href = result to redirect the entire page -->
} </script> </apex:form> </apex:page> Controller: public class iframe { public Integer one {get; set;} public Integer two {get; set;} public String result {get; set;} /*In a real world example based on the logic I may want to pass the navigation URL*/ public PageReference submit() { if(one + two == 8){ result = 'You know math!'; // }else{ result = 'Keep trying!'; } system.debug(result ); return null; } }

As you can see if returns the value of the previous action.

1) Enter 4 + 4, it will return null
2) Enter 4 + 2, it will return 'You know math!'

Thanks,
Jason



Message Edited by TehNrd on 12-03-2008 04:36 PM
  • December 04, 2008
  • Like
  • 1
I thought that when you created a force.com site a profile corresponding to this site was automatically created so that you could control FLS, CRUD, etc for the unauthenticated guest user. I have created a site called "demo". When I edit the security for the pages in this site I see a profile called "demo profile" but when I navigate to Manage Users > Profiles this profile is not there.

So far this was the only doc I could find and it doesn't mention anything about the profiles:

http://www.adnsandbox.com/df08/workbook-sites.pdf

Thanks,
Jason
  • November 07, 2008
  • Like
  • 1
I'd like to re-open the discussion of SortOrder on the OpportunityLineItem object. A thread from 3.5 years ago can be located here:
http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=3154

Looks like people from SF were going to look into it but obviously nothing has come to fruition. The reason I have put this in the Visualforce board is that we have have a few VF applications that could really take advantage of access to this field. Visualforce has also opened up new possibilities to UI design where the ability to manage SortOrder could be useful.

Also, no offense to salesforce.com, but the tool for sorting OpportunityLineItems is not that useful when there are multiple products with the same name. I have actually built a pretty slick sorting application but this is currently useless.

A lot of the concerns were about error handling. What happens if you have 3 line items but sort order is defined as, 1, 2, 2. Or 1, 2, 4. How about just throwing a sortOrder exception and force the developers to write good code?

Ideas? Thoughts?
http://ideas.salesforce.com/article/show/10092062/OpportunityLineItem_SortOrder_to_be_CreatableUpdatable

-Jason


Message Edited by TehNrd on 09-05-2008 01:22 PM
  • September 03, 2008
  • Like
  • 1
I am having issues using the immediate attribute within actionSupport. The documentation says that "If set to true, the action happens immediately and any field validation rules are skipped." It doesn't mention anything about rerendering or data binding so I'm a little confused. Here is my problem:

I have a select list of contacts. When a contact is selected, a form with inputFields is rerendered to display the data of the selected contact. Some of these fields are required. If a field is null and you try to select a different contact you get an error message that the field is required. This is no good, so I added the immediate attribute to the actionSupport but now it does not appear to be rerendering the form.

Any ideas, suggestions?

Page:
Code:
<apex:page controller="input" >

<apex:form >
  <apex:selectList value="{!contactID}" size="5">
     <apex:selectOptions value="{!contacts}" />
     <apex:actionSupport event="onchange" action="{!updateContact}" rerender="form" immediate="true"/>
  </apex:selectList>
  <apex:pageBlock >
     <apex:panelGrid columns="2" id="form">
        Full Name: <apex:outputField value="{!c.Name}"/>
        Email: <apex:inputField value="{!c.Email}" required="true"/>
        Title: <apex:inputField value="{!c.Title}" required="true"/>
        Phone: <apex:inputField value="{!c.Phone}" required="true"/>
     </apex:panelGrid>  
  </apex:pageBlock>
</apex:form>

</apex:page>

Controller:
Code:
public class input {
    public String ContactId {set; get;}
    public Contact c {set; get;}
    private List<SelectOption> contacts;
    private Map<Id,Contact> contactMap = new Map<Id,Contact>();

    public List<SelectOption> getContacts(){
       if(contacts == null){
           Contact [] cons = [select Id, Name, Title, FirstName, LastName, Phone, Email from Contact limit 10];
           contactId = cons[0].Id;
           contacts = new List<SelectOption>();
    
           for(Contact c : cons){
              contacts.add(new SelectOption(c.ID,c.Name));
              contactMap.put(c.Id,c);
           }
       }
       return contacts;
    }
   
    public PageReference updateContact(){
        c = contactMap.get(ContactID);
        return null;
    }      
}

 

As soon as we try to view a managed package by selecting its name in the list of packages we are gettting an internal server error.

Error ID: 985527738-145562 (1773998380)

Can anyone from Salesforce.com shed some light on this. Not being able to access this page means we can do push upgrades, create patch orgs, and more. Sort of a big show stopper for an ISV. 

Thanks,
Jason
  • March 20, 2015
  • Like
  • 0
Hi,

Because of SSLv3 Poodle vulnerability, we have turned off SSLv3 support on our web server. This in term is causing Salesforce outbound messaging to fail.

Is there a work around with this from Salesforce end?

The outbound messaging processing issue was resolved once we turn SSLv3 back on our web server.

Ted Tsung
We have a managed packaged that has an install script. Sometime within the last week queries agains the AsyncApexJob inside the install script started throwing the following error:

System.QueryException
sObject type 'AsyncApexJob' is not supported.

I guarantee this used to work. Anyone from salesforce know of a change that could have broken this?

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.
 

I hate to double post but I think I've found a gap in salesforce.com functionality to build scalable URL Buttons that can be packaged across all Editions.

 

Here is the thread in question, http://boards.developerforce.com/t5/Visualforce-Development/Communties-Sites-make-it-URL-buttons-not-work/td-p/697949 , and any insight you may have into this would be appreciated.

 

Thanks,

Jason 

  • October 30, 2013
  • Like
  • 0

It would appear if a customer is using Communities or force.com sites there is no way to build scalable custom object URL buttons that work everywhere.

 

Let's say on the Account object you have a custom URL button that opens a Visualforce page with the following text:

 

/apex/findNearby?id={!Account.Id}

In this example we can't make the Content Source of the button Visualforce as this findNearby.page does not use a standard controller or extension.

 

For a normal user inside salesforce.com this works fine but let's say an org has a Community named 'customers'. This is were things start to break. That link should then redirect to:

 

/customers/apex/findNearby?id={!Account.Id}

 

So you might be thinking, no problem, just use the $Site global variable and do the following in the URL button:

 

{!URLFOR($Site.Prefix+'/apex/findNearby?id='+Account.Id)}.

This would normally work but here is the final caveat...this is part of a managed packaged that needs to support Group and Professional editions and in these editions the $Site var does not exists.

 

Unless I am missing something this seems to be a gap in functionality for creating URL button links with Communities.

 

Is there anyway, within a button to detect the correct url or salesforce version and build the appropriate URL?

 

Thanks,

Jason

  • October 30, 2013
  • Like
  • 0

We are buiding a system that will automatically provision License Seats when a customer purchases our product from our custom store front. All of this logic is in Apex and we are trying to write tests to ensure this works correclty but it seems this may not be possible.

 

In its simplest form the test would pefrom the following:

- Create a License

- Update the Seats__c field on the license

- Assert Seat__c field was updated correctly

 

Seem simple but it doesn not appear to work as this is the error received when trying to accomplish this: 

Update failed. First exception on row 0 with id a07e0000000ySK2AAM; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []

 

Below is the code to reproduce:

 

//Create account license can be attached to
Account acct = new Account(Name = 'test');
insert acct;

//Create package
sfLma__Package__c pack = new sfLma__Package__c(
	Name = 'test',
	sfLma__Developer_Name__c = 'test',
	sfLma__Developer_Org_ID__c = 'abc',
	sfLma__Latest_Version__c = '3',
	sfLma__Lead_Manager__c = UserInfo.getUserId(),
	sfLma__Package_ID__c = '3',
	sfLma__Release_Date__c = system.today().addDays(-30)
);
insert pack;

//Create a package version
sfLma__Package_Version__c packVersion = new sfLma__Package_Version__c(
	Name = 'test',
	sfLma__Package__c = pack.id,
	sfLma__Is_Beta__c = false,
	sfLma__Release_Date__c = system.today(),
	sfLma__Sequence__c = 1,
	sfLma__Version__c = '3',
	sfLma__Version_ID__c = '3'
);
insert packVersion;

//Ceate a license record
Id recordTypeId = [select Id from RecordType where Name = 'Active' and SobjectType = 'sfLma__License__c'].Id;
sfLma__License__c lic = new sfLma__License__c(
    RecordTypeId = recordTypeId,
    sfLma__Status__c = 'Active',
    sfLma__Seats__c = 1,
    sfLma__License_Type__c = 'Editable',
    sfLma__Account__c = acct.Id,
    sfLma__Expiration__c = system.today().addDays(365),
    sfLma__Install_Date__c = system.today(),
    sfLma__Package_Version__c = packVersion.Id
);
insert lic;

//Update the Seats field on the license
lic.sfLma__Seats__c = 5;

//UPDATE FAILS
update lic;

 

Any ideas?

 

Thanks,

Jason

  • September 16, 2013
  • Like
  • 0

I'm writing some tests that insert and update an LMA license record but my updates are failing with the following error:

 

Update failed. First exception on row 0 with id a07e0000000ySK2AAM; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []

 

Below is the code to reproduce:

 

sfLma__License__c lic = new sfLma__License__c(
sfLma__Status__c = 'Active',
sfLma__Seats__c = 0
); insert lic; lic.sfLma__Seats__c = 5; update lic;

 

This looks to be coming from inside the LMA app and I am probaby not setting the the correct "required" fields on the License record. Anyone know what the minimun required fields are to peform an update DML on the License record?

  • September 16, 2013
  • Like
  • 0

It would appear there is a bug with the Winter 14 release and visualforce pageBlockSectionItem. Below is the markup to reproduce:

 

<apex:page">

	<apex:pageBlock>
		<apex:pageBlockSection >
			<apex:pageBlockSectionItem>
				<apex:outputPanel >
					Choose whether to define the fields for this Map Object or whether to refer to another object 
					already configured. (e.g. for Opportunities, you may want to refer to the Account object). Referring to 
					another object means this object need not be geocoded and will use the referring object's information.
				</apex:outputPanel>
				<apex:outputPanel >
					hi
				</apex:outputPanel>
			</apex:pageBlockSectionItem>
		</apex:pageBlockSection>				
	</apex:pageBlock>
	
</apex:page>

In Summer 13 it looked like this, correct:

 

 

In Winter 14 it looks like this:

  • September 12, 2013
  • Like
  • 0

We are seeing this issue in our managed packaged in Sandboxes that have been updated to Winter 14.

 

"The configuration of your org has changed, please reload the page. Missing dependent object: Field: Account.SicDesc"
 
We are catching this error and displaying the message but we are having a very hard time locating the source as even the Debug logs are not showing any exception occuring, caught or not.
 
Any ideas?

 

 

  • September 10, 2013
  • Like
  • 0

We are using JS remoting. Found this interesting race condition:

  1. JS Remoting AJAX request made by user.
  2. Before it completes the user moves to another page
  3. When user moves browser to another page the js remoting ajax request is aborted.
  4. The abort invokes the error handler and we have a generic error handler which pops up a dialog showing exception info.
  5. In some cases, the dialog will flash up for a second because the page navigation away hasn't completed.

This looks ugly and we would prefer if the error handler knew there was a page unload happening and not show the error dialog if this was happening.

So, I tried adding a page unload listener and setting a flag in that which can be subsequently checked.

jQuery(window).unload(function() {
    unloadhappening = true;
});

This approach will work in most ajax designs but won't with JS remoting. JS remoting, calls the error handler before the unload event. Not sure why?

I tried the earlier beforeunload event:

jQuery(window).on('beforeunload', function() {
    unloadhappening = true;
    return '';  
}); 

This won't work because this event just shows up another dialog.

So I tried to add a listener to all anchor tags that have a http(s) hyperlink

jQuery('a[href^=http]').click( function() {
    unloadhappening = true; 
})

This won't work for relative URLs.

So I tried to adding a listener to all anchor tags that have a href

jQuery('a[href]').click( function() {
    unloadhappening = true; 
})

This will filter out components that won't work because it won't filter out components that don't trigger a page unload such as:

   <a href="#adviceTab">Advice</a>

So before I go and write a selector to filter out anything with a fragment identifier, there are also some anchors that are coming form JQuery UI that do:

   <a href="javascript&colon;%20void%280%29%3B" class="calToday"    onclick="DatePicker.datePicker.selectDate('today');return false;">Today</a>

I am starting to think this is a more of a hack that will never work as opposed to a solution. Do you have a good idea for this problem?

The only idea I can think of is to check the exception, error, event info returned by JS remoting for an aborted request. I see: Strings:

Unable to connect with Server 

and

Communication Failure

But they might be also used in another error that has nothing to do with a page unload. So wondering has anyone else seen this and if so what is your solution?

Note I have to use JS Remoting. Using forceTK etc is not an option.

Thanks

Hi. I am in the process of providing some automation for my sales teams LMO. My code is trying to set the status of a license to Active and this is failing with a validation error. The code is running in a test org. The licence, package version, and package have been created in a test method.

 

Have I missed some vital data from one of the LMA objects or is there some magic to changing the license status?

 

This error is raised on the update of the license:



20:49:10.362 (362243000)|EXCEPTION_THROWN|[39]|System.DmlException: Update failed. First exception on row 0 with id a06D000000PVrETIA1; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Argument 1 cannot be null: []

 

The test code is:



sfLma__Package__c pkg = new sfLma__Package__c(
	Name = 'Licence Testing',
	sfLma__Release_Date__c = Date.parse('01/01/2010'),
	sfLma__Package_ID__c = '033A00000000000IAA' );
insert pkg;

sfLma__Package_Version__c pkgVer = new sfLma__Package_Version__c(
	Name = 'Licence Testing Jan 2010',
	sfLma__Version__c = 'Jan-10',
	sfLma__Version_ID__c = '04tA00000000000IAA',
	sfLma__Package__c = pkg.Id,
	sfLma__Release_Date__c = Date.parse('01/01/2010') );
insert pkgVer;

Lead ld = new Lead(
	LastName	= 'Customer',
	FirstName	= 'Test',
	Company		= 'MyTestCompany',
	Email		= 'test@MyTestCompany.com',
	sfLma__Subscriber_Org_Type__c = 'EE' );
insert ld;

sfLma__License__c testLic = new sfLma__License__c(
	sfLma__Lead__c=ld.Id,
   	sfLma__Status__c='Trial',
    	sfLma__Package_Version__c=pkgVer.Id,
    	sfLma__Seats__c=40,
    	sfLma__Subscriber_Org_ID__c = UserInfo.getOrganizationId(),
    	sfLma__Package_License_ID__c='Testing',
    	sfLma__Used_Licenses__c=22 );
insert testLic;


System.debug([Select sfLma__Used_Licenses__c, sfLma__Subscriber_Org_ID__c, sfLma__Status__c, sfLma__Seats__c, sfLma__Proxy_User__c, sfLma__Package_Version__c, sfLma__Package_License_ID__c, sfLma__Licensed_Seats__c, sfLma__License_Type__c, sfLma__License_Status__c, sfLma__Lead__c, sfLma__Install_Date__c, sfLma__Help__c, sfLma__Expiration__c, sfLma__Expiration_Date__c, sfLma__Contact__c, sfLma__Account__c, RecordTypeId, Name, Id From sfLma__License__c WHERE Id=:testLic.Id]);

testLic.sfLma__Status__c='Active';

update testLic;

 

Thanks.

 

-       Andy



We are using JS remoting. Found this interesting race condition:

  1. JS Remoting AJAX request made by user.
  2. Before it completes the user moves to another page
  3. When user moves browser to another page the js remoting ajax request is aborted.
  4. The abort invokes the error handler and we have a generic error handler which pops up a dialog showing exception info.
  5. In some cases, the dialog will flash up for a second because the page navigation away hasn't completed.

This looks ugly and we would prefer if the error handler knew there was a page unload happening and not show the error dialog if this was happening.

So, I tried adding a page unload listener and setting a flag in that which can be subsequently checked.

jQuery(window).unload(function() {
    unloadhappening = true;
});

This approach will work in most ajax designs but won't with JS remoting. JS remoting, calls the error handler before the unload event. Not sure why?

I tried the earlier beforeunload event:

jQuery(window).on('beforeunload', function() {
    unloadhappening = true;
    return '';  
}); 

This won't work because this event just shows up another dialog.

So I tried to add a listener to all anchor tags that have a http(s) hyperlink

jQuery('a[href^=http]').click( function() {
    unloadhappening = true; 
})

This won't work for relative URLs.

So I tried to adding a listener to all anchor tags that have a href

jQuery('a[href]').click( function() {
    unloadhappening = true; 
})

This will filter out components that won't work because it won't filter out components that don't trigger a page unload such as:

   <a href="#adviceTab">Advice</a>

So before I go and write a selector to filter out anything with a fragment identifier, there are also some anchors that are coming form JQuery UI that do:

   <a href="javascript&colon;%20void%280%29%3B" class="calToday"    onclick="DatePicker.datePicker.selectDate('today');return false;">Today</a>

I am starting to think this is a more of a hack that will never work as opposed to a solution. Do you have a good idea for this problem?

The only idea I can think of is to check the exception, error, event info returned by JS remoting for an aborted request. I see: Strings:

Unable to connect with Server 

and

Communication Failure

But they might be also used in another error that has nothing to do with a page unload. So wondering has anyone else seen this and if so what is your solution?

Note I have to use JS Remoting. Using forceTK etc is not an option.

Thanks