• DevNV
  • NEWBIE
  • 85 Points
  • Member since 2005

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

Hello, 

I am trying to add a visualforce page as a home page component to the home page layout. I created the visualforce page and also created  the home page component as n HTML section and added the following code to it:

 


<iframe src="https://cs1.salesforce.com/apex/Front_Page_News" width="100%" height="200px"></iframe>

 

But when I refresh the home page it only shows me the title of the component and the code instead of loading the visualforce page. Can anyone tell me what im doing wrong?

 

Thank you!

I thought this was not allowed - this morning I forgot I was looking at Production code in Eclipse, made some changes and saved.  It took!  Is this a change to Salesforce's policy on editing code in Production?  Anyone else notice this?
  • February 01, 2014
  • Like
  • 0

I'm trying to use a visualforce page to display content in my customer portal header to take advantage of translations and custom labels.  When I view the end result, all I see is the custom header and no tabs or portal content.  I'm doing the following:

  1. Create a VF page with the logos and content I want to see in the portal header.  Give all profiles access to this page.
  2. Create a basic htm file with an iframe tag pointing to the above VF page.  Uploaded into Documents
  3. Update the portal to point to this document in the Header file.

When I log into the portal, I can see the wonderful custom header with translations etc, but nothing else - no portal tabs or content whatsoever.  Anyone else able to display VF in the header?

 

VF Page code:

<apex:page showHeader="false" sidebar="false">
    <table width="100%"><tr>
        <td align="left">
            <apex:outputPanel rendered="{!$CurrentPage.parameters.logoId != ''}">
                <a href="/home/home.jsp" target="_top">
                <img src="https://na1.content.force.com/servlet/servlet.ImageServer?id={!$currentpage.parameters.logoId}&oid=00D300000006e0w" /></a>
            </apex:outputPanel>
            <img src="/s.gif" alt="" width="1" height="1" class="spacer" title=""/>
        </td>
        <td align="right">
            <div class="linkElements">
            <a href="/apex/Frequently_Asked_Questions?sfdc.tabName=01r30000000Z14v"  target="_top">{!$Label.Get_Help}</a>&nbsp;&nbsp;
            <a href="/apex/ResetPortalPwd"  target="_top">{!$Label.Change_Password}</a>&nbsp;&nbsp;
            <a href="/secur/logout.jsp"  target="_top">{!$Label.Logout}</a>&nbsp;
             
        </div></td>
    </tr></table>
</apex:page>

 

 

HTM File content:

<iframe width="100%" height="80px" src="/apex/PortalHeader?logoId=01530000000wGQe" frameBorder="0"/>

 

  • March 08, 2012
  • Like
  • 0

I'm building code to dynamically share a record with a portal owner's account's Executive Roles and Subordinates when a custom 'Job' record is created.  The code is working for me when the Job is created by an internal SF user, but when I try it as a portal user it fails.  The debug log shows it doesn't understand fields in the Job__Share object.  I thought that code called from a trigger is run with full permissions but it seems that the portal user can't access the sharing.  I've switched the code to a future call to see if that makes a difference but same error.

 

Has anyone else found a way to dynamically add apex sharing via actions from a portal user?

  • November 18, 2011
  • Like
  • 0

Hi all, 

 

I'm working on the sharing recalculation coding and have tried to implement the example code in the Apex Code documentation (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_recalc.htm).  I'm getting errors when saving the test code as documented at the bottom.  The calls to start() and execute() are not saving with the error that the method does not exist. 

 

Has anyone else figured it out?  

 

Cheers,

Niki

  • November 16, 2011
  • Like
  • 0

I have a very basic VF page, no extensions, that is working fine in Firefox.  When I open it in IE or Chrome I'm gettig an Invalid Session ID error message, and then the page loads just fine.  No ajax, no scripting.  Has anyone seen this before?  The page is set to override the opportunityProduct Edit link and is below:

 

<apex:page standardController="OpportunityLineItem">
  <apex:form >
  <apex:sectionHeader title="Opportunity Product Edit" subtitle="{!OpportunityLineItem.PricebookEntry.product2.name}"/>
  
  <apex:pageBlock title="Opportunity Product Edit" mode="edit">
      <apex:pageBlockButtons >
          <apex:commandButton action="{!save}" value="Save"/>
          <apex:commandButton action="{!cancel}" value="Cancel"/>
      </apex:pageBlockButtons>
      
      <apex:pageblockSection title="Product Information">
          <apex:outputField value="{!OpportunityLineItem.opportunity.name}"/>
          <apex:inputField value="{!OpportunityLineItem.quantity}" required="true"/>
          <apex:outputField value="{!OpportunityLineItem.PricebookEntry.product2.name}"/>
          <apex:inputField value="{!OpportunityLineItem.Unit_Price__c}" required="true"/>
          <apex:outputField value="{!OpportunityLineItem.PricebookEntry.product2.productcode}"/>          
          <apex:inputField value="{!OpportunityLineItem.Discount__c}"/>
      </apex:pageblockSection>

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

 

Any thoughts?

  • August 18, 2011
  • Like
  • 0

I'm trying to add my Opportunity related lists to a visualforce page and can't figure out a valid relationship name for Google Docs.  Eclipse IDE and Apex Explorer show the relationship name as "GoogleDocs" but when I add that to the page code it shows an error of 'GoogleDocs' is not a valid child relationship name for entity Opportunity

 

Any ideas on the valid relationship name to use?  Here is my list of related lists - all of which work except for the Google Docs.

 

 

<apex:relatedList list="OpenActivities"/> <apex:relatedList list="Activityhistories"/> <apex:relatedList list="GoogleDocs" /> <apex:relatedList list="OpportunityContactRoles"/> <apex:relatedList list="OpportunityPartnersFrom" /> <apex:relatedList list="OpportunityCompetitors"/> <apex:relatedList list="OpportunityHistories"/> <apex:relatedList list="ProcessSteps"/>

 Niki

 

 

  • October 30, 2009
  • Like
  • 0

I have an authenticated site where some users can switch the account which drives the data displayed on the site. The account could be either the one tied to the portal users account (the one the contact record is tied to) or another account which is a child account (though the parent account hierarchy).

 

Users can submit a record which essentailly just updates a date on the record. This date triggers an workflow email alert. When the user submits a record tied to "their" account, there is no problem, but when the user submits a record against a different account an Invalid Cross Reference ID error is thrown. The error occurs as the workflow is evaluated. Turning off the email alert results in a successful submission.

 

The workflow email alert does use a visualforce template, but I removed all the markup from that template and no error was thrown.

 

Error log below. Any help at all would be appreciated.

 

16:41:02.646 (1646850000)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:01IA0000001wgKG
16:41:02.691 (1691668000)|WF_RULE_EVAL_BEGIN|Assignment
16:41:02.691 (1691690000)|WF_RULE_EVAL_BEGIN|Response
16:41:02.691 (1691699000)|WF_RULE_EVAL_BEGIN|Workflow
16:41:02.691 (1691724000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Shipping - Placed Thank You|01QA00000005Dqb|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.698 (1698456000)|WF_RULE_FILTER|[Shipping Schedule Header : Ordered Date not equal to null]
16:41:02.698 (1698480000)|WF_RULE_EVAL_VALUE|2012-03-29 00:00:00
16:41:02.698 (1698488000)|WF_CRITERIA_END|true
16:41:02.715 (1715916000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Shipping 6 month confirm|01QA00000005Dqc|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.715 (1715985000)|WF_RULE_FILTER|[Shipping Schedule Header : Confirmation Date equals null]
16:41:02.716 (1716005000)|WF_RULE_EVAL_VALUE|2012-03-29 00:00:00
16:41:02.716 (1716014000)|WF_CRITERIA_END|false
16:41:02.716 (1716029000)|WF_CRITERIA_BEGIN|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]|Portal Place Order reminder|01QA00000005DqZ|ON_CREATE_OR_TRIGGERING_UPDATE
16:41:02.716 (1716455000)|WF_RULE_NOT_EVALUATED
16:41:02.716 (1716540000)|WF_SPOOL_ACTION_BEGIN|Workflow
16:41:02.716 (1716564000)|WF_RULE_INVOCATION|[Shipping Schedule Header: Order-00015 a2AA00000000Bn1]
16:41:02.716 (1716578000)|WF_EMAIL_ALERT|Id=01WA00000008rih|CurrentRule:Portal Shipping - Placed Thank You (Id=01QA00000005Dqb)
16:41:02.809 (1809641000)|WF_ACTION| Email Alert: 1;
16:41:02.809 (1809660000)|WF_RULE_EVAL_BEGIN|Escalation
16:41:02.809 (1809667000)|WF_RULE_EVAL_END
16:41:02.809 (1809675000)|WF_TIME_TRIGGERS_BEGIN
16:41:02.809 (1809751000)|WF_ACTIONS_END| Email Alert: 1;
16:41:02.809 (1809757000)|CODE_UNIT_FINISHED|Workflow:01IA0000001wgKG
16:41:02.809 (1809920000)|DML_END|[258]
16:41:02.810 (1810050000)|EXCEPTION_THROWN|[258]|System.DmlException: Update failed. First exception on row 0 with id a2AA00000000Bn1MAE; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []
16

 

I'm trying to use a visualforce page to display content in my customer portal header to take advantage of translations and custom labels.  When I view the end result, all I see is the custom header and no tabs or portal content.  I'm doing the following:

  1. Create a VF page with the logos and content I want to see in the portal header.  Give all profiles access to this page.
  2. Create a basic htm file with an iframe tag pointing to the above VF page.  Uploaded into Documents
  3. Update the portal to point to this document in the Header file.

When I log into the portal, I can see the wonderful custom header with translations etc, but nothing else - no portal tabs or content whatsoever.  Anyone else able to display VF in the header?

 

VF Page code:

<apex:page showHeader="false" sidebar="false">
    <table width="100%"><tr>
        <td align="left">
            <apex:outputPanel rendered="{!$CurrentPage.parameters.logoId != ''}">
                <a href="/home/home.jsp" target="_top">
                <img src="https://na1.content.force.com/servlet/servlet.ImageServer?id={!$currentpage.parameters.logoId}&oid=00D300000006e0w" /></a>
            </apex:outputPanel>
            <img src="/s.gif" alt="" width="1" height="1" class="spacer" title=""/>
        </td>
        <td align="right">
            <div class="linkElements">
            <a href="/apex/Frequently_Asked_Questions?sfdc.tabName=01r30000000Z14v"  target="_top">{!$Label.Get_Help}</a>&nbsp;&nbsp;
            <a href="/apex/ResetPortalPwd"  target="_top">{!$Label.Change_Password}</a>&nbsp;&nbsp;
            <a href="/secur/logout.jsp"  target="_top">{!$Label.Logout}</a>&nbsp;
             
        </div></td>
    </tr></table>
</apex:page>

 

 

HTM File content:

<iframe width="100%" height="80px" src="/apex/PortalHeader?logoId=01530000000wGQe" frameBorder="0"/>

 

  • March 08, 2012
  • Like
  • 0

I have a custom save method that sets a Savepoint, does some inserts and either rolls back (using Database.rollback) if there's an error or redirects to one of the newly inserted records. I just started testing the roll back functionality and it is not working as I would expect. The insert is in fact rolled back, but instead of being sent back to the Visualforce page I was just on, I am sent to a Salesforce error page saying "Data Not Available". It seems to me like the roll back might be removing the view state of the Visualforce page or something strange.

 

public PageReference save() {
	Savepoint beforeInserts = Database.setSavepoint();
	if (trySave() == true) {
		return (new ApexPages.StandardController(record)).view();
	}
	Database.rollback(beforeInserts);
	return null;
}

private boolean trySave() {
    //do some validation and such
    try {
        insert record;
    }
    catch (Exception err) {
        ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, err.getMessage()));
        return false;
    }
    return false; //to test the roll back
}

 Has anyone seen something like this?

 

Thanks!

  • November 19, 2011
  • Like
  • 0

Hi all, 

 

I'm working on the sharing recalculation coding and have tried to implement the example code in the Apex Code documentation (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_bulk_sharing_recalc.htm).  I'm getting errors when saving the test code as documented at the bottom.  The calls to start() and execute() are not saving with the error that the method does not exist. 

 

Has anyone else figured it out?  

 

Cheers,

Niki

  • November 16, 2011
  • Like
  • 0

Hello Salesforce Gurus,

 

Previous issue is resolved: http://boards.developerforce.com/t5/Visualforce-Development/Salesforce-winter-12-Visualforce-issue-crash/td-p/343229

 

But, I am now noticing many other issues with the sandbox salesforce system.

Here are few issues:

1. I get the message like "Stack overflow line 7" when I moved to different pages.

2. When I opened my visualforce page and updated a record, then tried to move to home or any other tab or page, I noticed the URL within the browser is not changing to other pages even though the body within the browser showing other areas. Its weird, and I don't know why system is behaving this way.

(this is happening in the IE Browser)

3. After working with few areas within salesforce, I tried to logout, system hangs out and IE doesn't respond at all. I had to kill the IE many times now.

4. I am also getting this error time to time when I am working within salesforce:

Unable to Process Request We apologize for the inconvenience

The salesforce.com servers are temporarily unable to respond to your request. We apologize for the inconvenience.
Thank you for your patience, and please try again in a few moments.

Visit http://trust.salesforce.com for current system status and availability.

back 

 

Please get back to me and I can share more details if needed.

 

~NK

  • October 05, 2011
  • Like
  • 0

Last night, we started having tests fail in our dev environment.  We have the following methods (shortened)

 



public static void updateTargetDate(...) {
     Set<Id> futureIds = new Set<Id>();
     ...
     // Add Ids
     ...
     if (!futureIds.isEmpty()) {
          updateTargetDateFromMilestone(futureIds);
     }
}

@future
public static void updateTargetDateFromMilestone(Set<Id> caseIds) {
     ...
}

 

Yesterday at noon (we run all tests in dev at noon and midnight) all the tests were running without error.  At midnight most of our tests were failing with the following error:

 

System.TypeException: Invalid conversion from runtime type SET<String> to SET<Id>

 

with a referral to the method of updateTargetDateFromMilestone(Set<Id> caseIds).  This file has not been updated since June 24th 2011.

 

So the question is, has anyone else seen this error crop up?  I know that in Apex Strings and Id "should" be interchangeable, however, it doesn't matter in this case since the Set being made is of type Id and the Set parameter for the calling method is of type Id.

  • September 30, 2011
  • Like
  • 0

Dear All,

 

I have cloudswarm installed last week. After that, I noticed one of my batch code failed with the below error message.

 

Update failed. First exception on row 0 with id 00k3000000GhuidAAB; first error: CANNOT_INSERT_UPDATE_ACTIVATE_

ENTITY, cloudswarm.opptySwarm: execution of AfterUpdate

caused by: System.AsyncException: Future method cannot be called from a future method: cloudswarm.SwarmHelper.evaluateOpptyRules(LIST<Id>)

(cloudswarm): []
Kindly help me in fixing the issue.



  • August 24, 2011
  • Like
  • 0

cannot get this field to save

 

this is the code i am using. it displays perfectly but when my users go to save it reverts back to an empty field

any suggestions or do i need to include more code?

 

 

</apex:PageblockSection>

  <apex:pageBlockSection title="Cross-Sell/Up-Sell" collapsible="true" columns="2">
                <apex:inputField value="{!Call_crm__c.Upsells__c}"/>
              
  </apex:pageBlockSection>  

Hi all,

 

I have a question, we have a custom object and the detail layout (standard page layout) is shown in a Visualforce page (so we can have different layouts shown based on the record type). When I collapse a section on the layout and go to another page and go back to the layout, the section is not collapsed anymore. So my question is: is there any way that it can be 'remembered' which sections are collapsed and which aren't, just like you have with the standard functionality?

 

Kind Regards,

Niels

Hi,

 

I'm trying to use Roles with Apex Managed Sharing, but I'm running in to a problem.  The documentation and example for Apex Sharing Rules implies that we can use Roles to populate the UserOrGroupId field on a sharing object, but I'm getting an error when I use an Id I derive from the UserRole object:

 

FIELD_INTEGRITY_EXCEPTION, User/Group ID: id value of incorrect type

 

In a nutshell, I've created an Apex class that is used to manage sharing on a custom object we have (Object B).  Object B is related to an Account.  I'm grabbing the account id and then using that to find any Customer Portal Roles (UserRoles object, these are created automatically when you create a portal user) associated to that account.  I then take the Id from the UserRole object and use it to populate the UserOrGroupId field on my ObjectB__Shares record.

 

Can I not use Roles with Apex Managed Sharing or am I doing something wrong?  Here's the relevant code (slightly modified to protect the innocent):

 

 

//Now that you have all the account ids, get the corresponding portal user roles
            Set<ID> allPortalRoleIDs = new Set<ID>();
            for(UserRole ur: [Select Id, Name From UserRole Where PortalAccountId in: allRelatedAcctIDs])
            {
                allPortalRoleIDs.add(ur.Id);
            }
            
            //Now that you have all the relevant Portal User Roles, populate the shares
            if(allPortalRoleIDs != null && allPortalRoleIDs.size() > 0)
            {
                for(ObjectB__c b: ForClientOnly)
                {
                    for(ID roleId : allPortalRoleIDs)
                    {
                        
                        ObjectB__Share bs = new ObjectB__Share();
                        bs.ParentID = b.id;
                        bs.UserOrGroupID = roleId;
                        bs.AccessLevel = 'read';
                        bs.RowCause = Schema.ObjectB__Share.RowCause.portal_access__c;
                        
                        allShares.add(bs);
                    }
                }
            }

            //Once you have all the Shares, insert them
            insert allShares;

 

Any thoughts?
Thanks in advance!

 

 

I have a list Button on a Salesforce Outof Box page. Using that List button I open a visualforce page. I want to hide that button to some users/profiles. I don't see any way to do that.

Can you please let me know if there is a way to hide for a profile.

 

To reproduce this. you can Create a List Button on Opportunity Buttons & Links

2. Assign that button in  Opportunity Search Layouts/Opportunities List View

 

go to Opportunity Tab and Claik Go  and you should see the button next to "Go" Button.

 

thanks

in advance.

  • April 28, 2011
  • Like
  • 0

My controller works correctly, but when I go to test it I get an error and I'm not sure how to fix it.  Can anybody help?

 

static testMethod void testInquiryToProject()
  {
      List<Case> inquiries = [SELECT ID FROM Case LIMIT 1];
    
    if (inquiries.size() > 0)
    {
        Case inquiry = inquiries[0];
      ApexPages.StandardController controller = new ApexPages.StandardController(inquiry);
      controller.reset();
      InquiryToProjectExtension ext = new InquiryToProjectExtension(controller);
    }else
      System.debug('No Cases available');
  }

 

////////////////////////////////////////////////////////////////////////////////////

 

ublic InquiryToProjectExtension(ApexPages.StandardController cont)
  {
    List<String> fields = new List<String>();
    fields.add('Account');
    fields.add('CaseNumber');
    fields.add('Neighborhood_Lookup__c');
    fields.add('Sector__c');
    fields.add('Owner');
    fields.add('In_a_Main_Street_District__c');
    fields.add('Main_Street_Districts__c');
    cont.addFields(fields);//I get my error here when my test method executes
    inquiry = (Case)cont.getRecord();
    project = new Project__c(RecordType = [select id, name from RecordType where Name =: 'Grant'], Project_Account__c = inquiry.accountID, Neighborhood_Lookup__c = inquiry.Neighborhood_Lookup__c, Sector__c = inquiry.Sector__c, Project_Manager__c = UserInfo.getUserId(), In_a_Main_Street_District__c = inquiry.In_a_Main_Street_District__c, Main_Street_District__c = inquiry.Main_Street_Districts__c);
    controller = new ApexPages.StandardController(project);
  }

Hi

 

I have an Invoice object and I want to create a button that on-click will send an email with the related Invoice information to the customer.

 

I have created an email template for this but I'm not sure how to write the APEX code such that when I mark an Invoice and press the button an email will be sent to the contact designated in the invoice including the rest of the detailes in the invoice.

 

If not APEX is there any other way to achieve the same?

 

Thanks

 

 

  • November 26, 2010
  • Like
  • 0
hi
 
i want to retrieve the Server URL in trigger or in APEX class?
 
Actual my requirement is:
 
i had an object RelatedAttachement. in that Hyperlink field is of URL type. in that i am saving the URL like /servlet/servlet.FileDownload?file=00PR0000000MqVH. For this i want to retrieve the server URL and concatenate that Server URL to this field and updating this field.  in one server it looks like http://cs2.salesforce.com/servlet/servlet.Download?file=00PR0000000MqVH and in another server it looks like http://na2.salesforce.com/servlet/servlet.Download?file=00PR0000000MqVH so for this one i want to retrieve the server URL and i want to concatenate that URL to that field.
 
So please tell me how to retrieve the Server URL in trigger or in APEX class? 
I am trying to automatically submit a record for approval in a visualforce page but hitting some problems.  I tried following the Apex Approval Processing example (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm) but I get this error:

Code:
System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval 
process found.

 
So I thought I needed to create a ProcessInstance but trying to insert this results in:

Code:
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, 
Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]

 
I have set up an approval process for my custom object and it is active so that doesn't seem to be the problem.  This is a controller extension for my VF page and the 'record' variable is the object that has been passed into the page.  Here is my function that uses the submit for approval :

Code:
public void SubmitApproval()
    {
/* Attempting to set up a ProcessInstance
ProcessInstance approvalProcess = new ProcessInstance(); approvalProcess.TargetObjectId = record.Id; //approvalProcess.ProcessDefinitionId = ; approvalProcess.Status = 'Started'; //approvalProcess.CurrentNodeId = ; //insert approvalProcess;
*/

// Create an approval request
  Approval.ProcessSubmitRequest approvalRequest = new Approval.ProcessSubmitRequest(); approvalRequest.setComments('Testing Approval Submit'); approvalRequest.setObjectId(record.Id); Approval.ProcessResult approvalResult = Approval.process(approvalRequest); if (!approvalResult.isSuccess()) { ApexPages.Message error = new ApexPages.Message(ApexPages.Severity.ERROR, 'There was an error with the Submit For Approval Request.'); ApexPages.addMessage(error); } }

 
Edit:  Just a quick update.  If I submit the record for approval using the normal way I can then create a commandButton that approves the pending request.  This approval doesn't run into any problems at all.  I must be missing something from my Submit request.






Message Edited by XactiumBen on 06-24-2008 03:21 AM

Message Edited by XactiumBen on 06-24-2008 03:50 AM